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

Steven Barclay notifications at github.com
Wed Dec 11 17:09:26 UTC 2019


stejbac commented on this pull request.



> @@ -145,6 +154,10 @@ private DaoState(int chainHeight,
         this.paramChangeList = paramChangeList;
         this.evaluatedProposalList = evaluatedProposalList;
         this.decryptedBallotsWithMeritsList = decryptedBallotsWithMeritsList;
+
+        txMap = blocks.stream()
+                .flatMap(block -> block.getTxs().stream())
+                .collect(Collectors.toMap(Tx::getId, Function.identity(), (x, y) -> y, HashMap::new));

I wanted to guarantee that the output is a HashMap and it looks like the only `toMap` overload with a mapFactory param also has a mergeFunction param, so I was forced to provide a dummy merge function.

-- 
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_r356724189
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191211/a9909ef0/attachment.html>


More information about the bisq-github mailing list