Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle NPE when checking isSignWitnessTrade. #6842

Merged
merged 1 commit into from Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -930,17 +930,21 @@ public Set<SignedWitness> getUnsignedSignerPubKeys() {
}

public boolean isSignWitnessTrade(Trade trade) {
checkNotNull(trade, "trade must not be null");
checkNotNull(trade.getOffer(), "offer must not be null");
Contract contract = checkNotNull(trade.getContract());
PaymentAccountPayload sellerPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
AccountAgeWitness myWitness = getMyWitness(sellerPaymentAccountPayload);

getAccountAgeWitnessUtils().witnessDebugLog(trade, myWitness);

return accountIsSigner(myWitness) &&
!peerHasSignedWitness(trade) &&
tradeAmountIsSufficient(trade.getAmount());
try {
checkNotNull(trade, "trade must not be null");
checkNotNull(trade.getOffer(), "offer must not be null");
Contract contract = checkNotNull(trade.getContract());
PaymentAccountPayload sellerPaymentAccountPayload = checkNotNull(
contract.getSellerPaymentAccountPayload(), "paymentAccountPayload must not be null");
AccountAgeWitness myWitness = getMyWitness(sellerPaymentAccountPayload);
getAccountAgeWitnessUtils().witnessDebugLog(trade, myWitness);
return accountIsSigner(myWitness) &&
!peerHasSignedWitness(trade) &&
tradeAmountIsSufficient(trade.getAmount());
} catch (NullPointerException e) {
e.printStackTrace();
}
return false;
}

public String getSignInfoFromAccount(PaymentAccount paymentAccount) {
Expand Down