diff --git a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java index deab92eb50..4d91d75eff 100644 --- a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java +++ b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java @@ -737,14 +737,13 @@ public class AccountAgeWitnessService { } public Optional traderSignAndPublishPeersAccountAgeWitness(Trade trade) { - AccountAgeWitness peersWitness = findTradePeerWitness(trade).orElse(null); - BigInteger tradeAmount = trade.getAmount(); checkNotNull(trade.getTradePeer().getPubKeyRing(), "Peer must have a keyring"); PublicKey peersPubKey = trade.getTradePeer().getPubKeyRing().getSignaturePubKey(); - checkNotNull(peersWitness, "Not able to find peers witness, unable to sign for trade {}", - trade.toString()); - checkNotNull(tradeAmount, "Trade amount must not be null"); checkNotNull(peersPubKey, "Peers pub key must not be null"); + AccountAgeWitness peersWitness = findTradePeerWitness(trade).orElse(null); + checkNotNull(peersWitness, "Not able to find peers witness, unable to sign for trade " + trade.toString()); + BigInteger tradeAmount = trade.getAmount(); + checkNotNull(tradeAmount, "Trade amount must not be null"); try { return signedWitnessService.signAndPublishAccountAgeWitness(tradeAmount, peersWitness, peersPubKey); diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java b/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java index 28c61d51df..121d87d85a 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java @@ -105,12 +105,9 @@ public class ProcessPaymentReceivedMessage extends TradeTask { // advance state, arbitrator auto completes when payout published trade.advanceState(Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG); - // publish signed witness + // buyer republishes signed witness for resilience SignedWitness signedWitness = message.getBuyerSignedWitness(); if (signedWitness != null && trade instanceof BuyerTrade) { - // We received the signedWitness from the seller and publish the data to the network. - // The signer has published it as well but we prefer to re-do it on our side as well to achieve higher - // resilience. processModel.getAccountAgeWitnessService().publishOwnSignedWitness(signedWitness); } diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java b/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java index fe2f1ac442..cbfa0e3281 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java @@ -90,8 +90,12 @@ public abstract class SellerSendPaymentReceivedMessage extends SendMailboxMessag // sign account witness AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService(); if (accountAgeWitnessService.isSignWitnessTrade(trade)) { - accountAgeWitnessService.traderSignAndPublishPeersAccountAgeWitness(trade).ifPresent(witness -> signedWitness = witness); - log.info("{} {} signed and published peers account age witness", trade.getClass().getSimpleName(), trade.getId()); + try { + accountAgeWitnessService.traderSignAndPublishPeersAccountAgeWitness(trade).ifPresent(witness -> signedWitness = witness); + log.info("{} {} signed and published peers account age witness", trade.getClass().getSimpleName(), trade.getId()); + } catch (Exception e) { + log.warn("Failed to sign and publish peer's account age witness for {} {}, error={}\n", getClass().getSimpleName(), trade.getId(), e.getMessage(), e); + } } // We do not use a real unique ID here as we want to be able to re-send the exact same message in case the