[bisq-network/bisq] Add transient tx map to DaoState to speed up getTx queries (#3773)

Steven Barclay notifications at github.com
Tue Dec 10 20:51:12 UTC 2019


stejbac commented on this pull request.



> @@ -226,7 +230,15 @@ public void onNewBlockWithEmptyTxs(Block block) {
         }
     }
 
-    // Third we get the onParseBlockComplete called after all rawTxs of blocks have been parsed
+    // Third we add each successfully parsed BSQ tx to the last block
+    public void onNewTxForLastBlock(Tx tx) {
+        getLastBlock().ifPresent(block -> {

Yes, perhaps it would have been better to pass in the last block as a sanity check.

If getBlock() is not present, then the new block must have already been rejected in the method call onNewBlockWithEmptyTxs(block) above, since there are no blocks yet and it isn't the genesis block. In that case, it won't be incorporated into the DaoState and it's BSQ transactions cannot be correctly parsed yet anyway.

(Of course, this all assumes that there is no concurrent modification of the DaoState, but it's obviously not threadsafe anyway.)

-- 
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/3773#discussion_r356270239
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191210/439e65f3/attachment.html>


More information about the bisq-github mailing list