Search in sources :

Example 1 with DisputeResultMessage

use of bisq.core.arbitration.messages.DisputeResultMessage 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);
        }
    });
}
Also used : DisputeResultMessage(bisq.core.arbitration.messages.DisputeResultMessage) NodeAddress(bisq.network.p2p.NodeAddress) SendMailboxMessageListener(bisq.network.p2p.SendMailboxMessageListener) Contract(bisq.core.trade.Contract) DisputeCommunicationMessage(bisq.core.arbitration.messages.DisputeCommunicationMessage) Date(java.util.Date)

Aggregations

DisputeCommunicationMessage (bisq.core.arbitration.messages.DisputeCommunicationMessage)1 DisputeResultMessage (bisq.core.arbitration.messages.DisputeResultMessage)1 Contract (bisq.core.trade.Contract)1 NodeAddress (bisq.network.p2p.NodeAddress)1 SendMailboxMessageListener (bisq.network.p2p.SendMailboxMessageListener)1 Date (java.util.Date)1