mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 22:45:21 +01:00
Republish only outside of voteReveal phase
This commit is contained in:
parent
1df485a4fa
commit
419da79232
1 changed files with 26 additions and 18 deletions
|
@ -135,7 +135,7 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen
|
|||
this.myVoteListService = myVoteListService;
|
||||
this.myProposalListService = myProposalListService;
|
||||
|
||||
numConnectedPeersListener = (observable, oldValue, newValue) -> rePublishMyBlindVoteOnceWellConnected();
|
||||
numConnectedPeersListener = (observable, oldValue, newValue) -> maybeRePublishMyBlindVote();
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen
|
|||
|
||||
@Override
|
||||
public void onParseBlockChainComplete() {
|
||||
rePublishMyBlindVoteOnceWellConnected();
|
||||
maybeRePublishMyBlindVote();
|
||||
}
|
||||
|
||||
|
||||
|
@ -351,7 +351,14 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen
|
|||
return bsqWalletService.signTx(txWithBtcFee);
|
||||
}
|
||||
|
||||
private void rePublishMyBlindVoteOnceWellConnected() {
|
||||
private void maybeRePublishMyBlindVote() {
|
||||
// We do not republish during vote reveal phase as peer would reject blindVote data to protect against
|
||||
// late publishing attacks.
|
||||
// This attack is only relevant during the vote reveal phase as there it could cause damage by disturbing the
|
||||
// data view of the blind votes of the voter for creating the majority hash.
|
||||
// To republish after the vote reveal phase still makes sense to reduce risk that some nodes have not received
|
||||
// it and would need to request the data then in the vote result phase.
|
||||
if (!periodService.isInPhase(daoStateService.getChainHeight(), DaoPhase.Phase.VOTE_REVEAL)) {
|
||||
// We republish at each startup at any block during the cycle. We filter anyway for valid blind votes
|
||||
// of that cycle so it is 1 blind vote getting rebroadcast at each startup to my neighbors.
|
||||
// Republishing only will have effect if the payload creation date is < 5 hours as other nodes would not
|
||||
|
@ -370,6 +377,7 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen
|
|||
UserThread.execute(() -> p2PService.getNumConnectedPeers().removeListener(numConnectedPeersListener));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addToP2PNetwork(BlindVote blindVote, @Nullable ErrorMessageHandler errorMessageHandler) {
|
||||
BlindVotePayload blindVotePayload = new BlindVotePayload(blindVote);
|
||||
|
|
Loading…
Add table
Reference in a new issue