[bisq-network/bisq] Dao: fix vote reveal tx publishing (#2195)
Manfred Karrer
notifications at github.com
Sat Jan 5 15:11:49 UTC 2019
ManfredKarrer commented on this pull request.
> + // BSQ because the blind vote tx is already in the snapshot and does not get parsed
+ // again. It would require a reset of the snapshot and parse all blocks again.
+ // As this is an exceptional case we prefer to have a simple solution instead and just
+ // publish the vote reveal tx but are aware that is is invalid.
+ log.warn("We missed the vote reveal phase but publish now the tx to unlock our locked " +
+ "BSQ from the blind vote tx. BlindVoteTxId={}", myVote.getTxId());
+
+ boolean isAfterVoteRevealPhase = periodService.getPhaseForHeight(chainHeight).ordinal() > DaoPhase.Phase.VOTE_REVEAL.ordinal();
+
+ // We missed the reveal phase but we are in the correct cycle
+ boolean missedPhaseSameCycle = isAfterVoteRevealPhase && isBlindVoteTxInCorrectPhaseAndCycle;
+
+ // If we missed the cycle we don't care about the phase anymore.
+ boolean isBlindVoteTxInPastCycle = periodService.isTxInPastCycle(myVote.getTxId(), chainHeight);
+
+ if (missedPhaseSameCycle || isBlindVoteTxInPastCycle) {
Yes the current checks are a bit verbose. I preferred to make it very explicit which cases are handled and not optimize on logical code flow (which could be optimized). But feel free to make a suggestion for a change.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/2195#discussion_r245480110
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190105/85290197/attachment-0001.html>
More information about the bisq-github
mailing list