use of bisq.core.arbitration.messages.DisputeCommunicationMessage in project bisq-core by bisq-network.
the class DisputeManager method sendDisputeResultMessage.
// arbitrator send result to trader
public void sendDisputeResultMessage(DisputeResult disputeResult, Dispute dispute, String text) {
DisputeCommunicationMessage disputeCommunicationMessage = new DisputeCommunicationMessage(dispute.getTradeId(), dispute.getTraderPubKeyRing().hashCode(), false, text, null, p2PService.getAddress(), new Date().getTime(), false, false, UUID.randomUUID().toString());
dispute.addDisputeMessage(disputeCommunicationMessage);
disputeResult.setDisputeCommunicationMessage(disputeCommunicationMessage);
NodeAddress peerNodeAddress;
Contract contract = dispute.getContract();
if (contract.getBuyerPubKeyRing().equals(dispute.getTraderPubKeyRing()))
peerNodeAddress = contract.getBuyerNodeAddress();
else
peerNodeAddress = contract.getSellerNodeAddress();
p2PService.sendEncryptedMailboxMessage(peerNodeAddress, dispute.getTraderPubKeyRing(), new DisputeResultMessage(disputeResult, p2PService.getAddress(), UUID.randomUUID().toString()), new SendMailboxMessageListener() {
@Override
public void onArrived() {
log.info("Message arrived at peer. tradeId={}", disputeCommunicationMessage.getTradeId());
disputeCommunicationMessage.setArrived(true);
}
@Override
public void onStoredInMailbox() {
log.info("Message stored in mailbox. tradeId={}", disputeCommunicationMessage.getTradeId());
disputeCommunicationMessage.setStoredInMailbox(true);
}
@Override
public void onFault(String errorMessage) {
log.error("sendEncryptedMailboxMessage failed. disputeCommunicationMessage=" + disputeCommunicationMessage);
}
});
}
Aggregations