Skip to content

Commit

Permalink
fix npe cleaning up arbitrator's mailbox messages
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jan 13, 2024
1 parent ad77912 commit 022028b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package haveno.core.trade;

import haveno.common.crypto.PubKeyRing;
import haveno.common.proto.network.NetworkEnvelope;
import haveno.core.trade.messages.TradeMessage;
import haveno.network.p2p.AckMessage;
Expand Down Expand Up @@ -116,15 +115,6 @@ private boolean isMyMessage(AckMessage ackMessage, Trade trade) {
}

private boolean isPubKeyValid(DecryptedMessageWithPubKey decryptedMessageWithPubKey, Trade trade) {
// We can only validate the peers pubKey if we have it already. If we are the taker we get it from the offer
// Otherwise it depends on the state of the trade protocol if we have received the peers pubKeyRing already.
PubKeyRing peersPubKeyRing = trade.getTradePeer().getPubKeyRing();
boolean isValid = true;
if (peersPubKeyRing != null &&
!decryptedMessageWithPubKey.getSignaturePubKey().equals(peersPubKeyRing.getSignaturePubKey())) {
isValid = false;
log.warn("SignaturePubKey in decryptedMessageWithPubKey does not match the SignaturePubKey we have set for our trading peer.");
}
return isValid;
return trade.getProtocol().isPubKeyValid(decryptedMessageWithPubKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ private PubKeyRing getPeersPubKeyRing(NodeAddress address) {
return peer.getPubKeyRing();
}

private boolean isPubKeyValid(DecryptedMessageWithPubKey message) {
public boolean isPubKeyValid(DecryptedMessageWithPubKey message) {
if (this instanceof ArbitratorProtocol) {

// valid if traders unknown
Expand Down

0 comments on commit 022028b

Please sign in to comment.