fix invalid pub key warning on process mailbox messages

This commit is contained in:
woodser 2024-01-13 02:57:28 -05:00
parent 2966f8461c
commit ad77912171

View file

@ -139,7 +139,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
return; return;
} }
if (!isPubKeyValid(decryptedMessageWithPubKey, peer)) { if (!isPubKeyValid(decryptedMessageWithPubKey)) {
return; return;
} }
@ -159,7 +159,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
@Override @Override
public void onMailboxMessageAdded(DecryptedMessageWithPubKey decryptedMessageWithPubKey, NodeAddress peer) { public void onMailboxMessageAdded(DecryptedMessageWithPubKey decryptedMessageWithPubKey, NodeAddress peer) {
if (!isPubKeyValid(decryptedMessageWithPubKey, peer)) return; if (!isPubKeyValid(decryptedMessageWithPubKey)) return;
handleMailboxCollectionSkipValidation(Collections.singletonList(decryptedMessageWithPubKey)); handleMailboxCollectionSkipValidation(Collections.singletonList(decryptedMessageWithPubKey));
} }
@ -777,12 +777,6 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
} }
private boolean isPubKeyValid(DecryptedMessageWithPubKey message) { private boolean isPubKeyValid(DecryptedMessageWithPubKey message) {
MailboxMessage mailboxMessage = (MailboxMessage) message.getNetworkEnvelope();
NodeAddress sender = mailboxMessage.getSenderNodeAddress();
return isPubKeyValid(message, sender);
}
private boolean isPubKeyValid(DecryptedMessageWithPubKey message, NodeAddress sender) {
if (this instanceof ArbitratorProtocol) { if (this instanceof ArbitratorProtocol) {
// valid if traders unknown // valid if traders unknown
@ -806,7 +800,6 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
} }
// invalid // invalid
log.error("SignaturePubKey in message does not match the SignaturePubKey we have set for our arbitrator or trading peer.");
return false; return false;
} }