Merge pull request #3351 from chimp1984/fix-missing-addition-of-mediator

Add mediator prefix to trade statistics
This commit is contained in:
Christoph Atteneder 2019-10-04 12:09:58 +02:00 committed by GitHub
commit 95e9bd459d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,6 +64,18 @@ public class PublishTradeStatistics extends TradeTask {
extraDataMap.put(TradeStatistics2.ARBITRATOR_ADDRESS, address);
}
NodeAddress mediatorNodeAddress = trade.getMediatorNodeAddress();
if (mediatorNodeAddress != null) {
// The first 4 chars are sufficient to identify an arbitrator.
// For testing with regtest/localhost we use the full address as its localhost and would result in
// same values for multiple arbitrators.
NetworkNode networkNode = model.getProcessModel().getP2PService().getNetworkNode();
String address = networkNode instanceof TorNetworkNode ?
mediatorNodeAddress.getFullAddress().substring(0, 4) :
mediatorNodeAddress.getFullAddress();
extraDataMap.put(TradeStatistics2.MEDIATOR_ADDRESS, address);
}
Offer offer = trade.getOffer();
checkNotNull(offer, "offer must not ne null");
checkNotNull(trade.getTradeAmount(), "trade.getTradeAmount() must not ne null");