mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
log warning on failure to sign and publish peer account age witness
This commit is contained in:
parent
072401386e
commit
a9c975466e
3 changed files with 11 additions and 11 deletions
|
@ -737,14 +737,13 @@ public class AccountAgeWitnessService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<SignedWitness> traderSignAndPublishPeersAccountAgeWitness(Trade trade) {
|
public Optional<SignedWitness> traderSignAndPublishPeersAccountAgeWitness(Trade trade) {
|
||||||
AccountAgeWitness peersWitness = findTradePeerWitness(trade).orElse(null);
|
|
||||||
BigInteger tradeAmount = trade.getAmount();
|
|
||||||
checkNotNull(trade.getTradePeer().getPubKeyRing(), "Peer must have a keyring");
|
checkNotNull(trade.getTradePeer().getPubKeyRing(), "Peer must have a keyring");
|
||||||
PublicKey peersPubKey = trade.getTradePeer().getPubKeyRing().getSignaturePubKey();
|
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");
|
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 {
|
try {
|
||||||
return signedWitnessService.signAndPublishAccountAgeWitness(tradeAmount, peersWitness, peersPubKey);
|
return signedWitnessService.signAndPublishAccountAgeWitness(tradeAmount, peersWitness, peersPubKey);
|
||||||
|
|
|
@ -105,12 +105,9 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
|
||||||
// advance state, arbitrator auto completes when payout published
|
// advance state, arbitrator auto completes when payout published
|
||||||
trade.advanceState(Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG);
|
trade.advanceState(Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG);
|
||||||
|
|
||||||
// publish signed witness
|
// buyer republishes signed witness for resilience
|
||||||
SignedWitness signedWitness = message.getBuyerSignedWitness();
|
SignedWitness signedWitness = message.getBuyerSignedWitness();
|
||||||
if (signedWitness != null && trade instanceof BuyerTrade) {
|
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);
|
processModel.getAccountAgeWitnessService().publishOwnSignedWitness(signedWitness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,12 @@ public abstract class SellerSendPaymentReceivedMessage extends SendMailboxMessag
|
||||||
// sign account witness
|
// sign account witness
|
||||||
AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService();
|
AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService();
|
||||||
if (accountAgeWitnessService.isSignWitnessTrade(trade)) {
|
if (accountAgeWitnessService.isSignWitnessTrade(trade)) {
|
||||||
|
try {
|
||||||
accountAgeWitnessService.traderSignAndPublishPeersAccountAgeWitness(trade).ifPresent(witness -> signedWitness = witness);
|
accountAgeWitnessService.traderSignAndPublishPeersAccountAgeWitness(trade).ifPresent(witness -> signedWitness = witness);
|
||||||
log.info("{} {} signed and published peers account age witness", trade.getClass().getSimpleName(), trade.getId());
|
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
|
// 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
|
||||||
|
|
Loading…
Reference in a new issue