Search in sources :

Example 1 with PeerPublishedDisputePayoutTxMessage

use of bisq.core.arbitration.messages.PeerPublishedDisputePayoutTxMessage in project bisq-core by bisq-network.

the class DisputeManager method sendPeerPublishedPayoutTxMessage.

// winner (or buyer in case of 50/50) sends tx to other peer
private void sendPeerPublishedPayoutTxMessage(Transaction transaction, Dispute dispute, Contract contract) {
    PubKeyRing peersPubKeyRing = dispute.isDisputeOpenerIsBuyer() ? contract.getSellerPubKeyRing() : contract.getBuyerPubKeyRing();
    NodeAddress peerNodeAddress = dispute.isDisputeOpenerIsBuyer() ? contract.getSellerNodeAddress() : contract.getBuyerNodeAddress();
    log.trace("sendPeerPublishedPayoutTxMessage to peerAddress " + peerNodeAddress);
    final PeerPublishedDisputePayoutTxMessage message = new PeerPublishedDisputePayoutTxMessage(transaction.bitcoinSerialize(), dispute.getTradeId(), p2PService.getAddress(), UUID.randomUUID().toString());
    p2PService.sendEncryptedMailboxMessage(peerNodeAddress, peersPubKeyRing, message, new SendMailboxMessageListener() {

        @Override
        public void onArrived() {
            log.info("Message arrived at peer. tradeId={}", message.getTradeId());
        }

        @Override
        public void onStoredInMailbox() {
            log.info("Message stored in mailbox. tradeId={}", message.getTradeId());
        }

        @Override
        public void onFault(String errorMessage) {
            log.error("sendEncryptedMailboxMessage failed. message=" + message);
        }
    });
}
Also used : PubKeyRing(bisq.common.crypto.PubKeyRing) NodeAddress(bisq.network.p2p.NodeAddress) SendMailboxMessageListener(bisq.network.p2p.SendMailboxMessageListener) PeerPublishedDisputePayoutTxMessage(bisq.core.arbitration.messages.PeerPublishedDisputePayoutTxMessage)

Aggregations

PubKeyRing (bisq.common.crypto.PubKeyRing)1 PeerPublishedDisputePayoutTxMessage (bisq.core.arbitration.messages.PeerPublishedDisputePayoutTxMessage)1 NodeAddress (bisq.network.p2p.NodeAddress)1 SendMailboxMessageListener (bisq.network.p2p.SendMailboxMessageListener)1