[bisq-network/bisq] Scan disputes for accounts where same user used diff. real names. (#4484)
sqrrm
notifications at github.com
Sun Sep 6 21:17:47 UTC 2020
@sqrrm approved this pull request.
utACK
> +
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ // Private
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ private void buildRealNameAccountMaps() {
+ buyerRealNameAccountByAddressMap.clear();
+ sellerRealNameAccountByAddressMap.clear();
+ disputeManager.getDisputesAsObservableList()
+ .forEach(dispute -> {
+ Contract contract = dispute.getContract();
+ PubKeyRing traderPubKeyRing = dispute.getTraderPubKeyRing();
+ String traderPubKeyHash = getTraderPuKeyHash(traderPubKeyRing);
+ String buyerPubKeyHash = getTraderPuKeyHash(contract.getBuyerPubKeyRing());
+ boolean isBuyer = contract.isMyRoleBuyer(traderPubKeyRing);
Isn't this also known in the next if statement, could just set `true` and `false` instead of `isBuyer` when adding to map.
> + String sellerAddress = contract.getSellerNodeAddress().getFullAddress();
+ addToMap(traderPubKeyHash, sellerRealNameAccountByAddressMap, sellerPaymentAccountPayload, sellerAddress, dispute, isBuyer);
+ }
+ });
+ }
+
+ private String getTraderPuKeyHash(PubKeyRing pubKeyRing) {
+ return Utilities.encodeToHex(Hash.getRipemd160hash(pubKeyRing.toProtoMessage().toByteArray()));
+ }
+
+ private void addToMap(String pubKeyHash, Map<String, List<RealNameAccountInfo>> map,
+ PaymentAccountPayload paymentAccountPayload,
+ String address,
+ Dispute dispute,
+ boolean isBuyer) {
+ if (paymentAccountPayload instanceof PayloadWithHolderName) {
Better to return early instead of big if blocks.
--
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/4484#pullrequestreview-483159725
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200906/02bb2151/attachment.html>
More information about the bisq-github
mailing list