mirror of
https://github.com/boldsuck/haveno.git
synced 2025-01-22 07:44:33 +00:00
fix payment sent ack after offline: 'Cannot get peer's pub key ring'
This commit is contained in:
parent
3450f3799e
commit
7592d8fbca
2 changed files with 28 additions and 13 deletions
|
@ -519,18 +519,26 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (trade) {
|
synchronized (trade) {
|
||||||
if (trade.getPhase().ordinal() >= Trade.Phase.PAYMENT_RECEIVED.ordinal()) {
|
|
||||||
log.warn("Received another PaymentReceivedMessage which was already processed, ACKing");
|
|
||||||
handleTaskRunnerSuccess(peer, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
latchTrade();
|
latchTrade();
|
||||||
Validator.checkTradeId(processModel.getOfferId(), message);
|
Validator.checkTradeId(processModel.getOfferId(), message);
|
||||||
processModel.setTradeMessage(message);
|
processModel.setTradeMessage(message);
|
||||||
expect(anyPhase(
|
|
||||||
trade.isBuyer() ? new Trade.Phase[] {Trade.Phase.PAYMENT_SENT, Trade.Phase.PAYMENT_RECEIVED} :
|
|
||||||
trade.isArbitrator() ? new Trade.Phase[] {Trade.Phase.DEPOSITS_CONFIRMED, Trade.Phase.DEPOSITS_UNLOCKED, Trade.Phase.PAYMENT_SENT} : // arbitrator syncs slowly after deposits confirmed
|
// check minimum trade phase
|
||||||
new Trade.Phase[] {Trade.Phase.DEPOSITS_UNLOCKED, Trade.Phase.PAYMENT_SENT})
|
if (trade.isBuyer() && trade.getPhase().ordinal() < Trade.Phase.PAYMENT_SENT.ordinal()) {
|
||||||
|
log.warn("Received PaymentReceivedMessage before payment sent for {} {}, ignoring", trade.getClass().getSimpleName(), trade.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (trade.isArbitrator() && trade.getPhase().ordinal() < Trade.Phase.DEPOSITS_CONFIRMED.ordinal()) {
|
||||||
|
log.warn("Received PaymentReceivedMessage before deposits confirmed for {} {}, ignoring", trade.getClass().getSimpleName(), trade.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (trade.isSeller() && trade.getPhase().ordinal() < Trade.Phase.DEPOSITS_UNLOCKED.ordinal()) {
|
||||||
|
log.warn("Received PaymentReceivedMessage before deposits unlocked for {} {}, ignoring", trade.getClass().getSimpleName(), trade.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(anyPhase()
|
||||||
.with(message)
|
.with(message)
|
||||||
.from(peer))
|
.from(peer))
|
||||||
.setup(tasks(
|
.setup(tasks(
|
||||||
|
|
|
@ -53,6 +53,17 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
|
||||||
// verify signature of payment received message
|
// verify signature of payment received message
|
||||||
HavenoUtils.verifyPaymentReceivedMessage(trade, message);
|
HavenoUtils.verifyPaymentReceivedMessage(trade, message);
|
||||||
|
|
||||||
|
// update to the latest peer address of our peer if message is correct
|
||||||
|
trade.getSeller().setNodeAddress(processModel.getTempTradePeerNodeAddress());
|
||||||
|
if (trade.getSeller().getNodeAddress().equals(trade.getBuyer().getNodeAddress())) trade.getBuyer().setNodeAddress(null); // tests can reuse addresses
|
||||||
|
|
||||||
|
// ack and complete if already processed
|
||||||
|
if (trade.getPhase().ordinal() >= Trade.Phase.PAYMENT_RECEIVED.ordinal()) {
|
||||||
|
log.warn("Received another PaymentReceivedMessage which was already processed, ACKing");
|
||||||
|
complete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// save message for reprocessing
|
// save message for reprocessing
|
||||||
processModel.setPaymentReceivedMessage(message);
|
processModel.setPaymentReceivedMessage(message);
|
||||||
trade.requestPersistence();
|
trade.requestPersistence();
|
||||||
|
@ -62,10 +73,6 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
|
||||||
trade.getBuyer().setUpdatedMultisigHex(message.getPaymentSentMessage().getUpdatedMultisigHex());
|
trade.getBuyer().setUpdatedMultisigHex(message.getPaymentSentMessage().getUpdatedMultisigHex());
|
||||||
trade.getBuyer().setAccountAgeWitness(message.getBuyerAccountAgeWitness());
|
trade.getBuyer().setAccountAgeWitness(message.getBuyerAccountAgeWitness());
|
||||||
|
|
||||||
// update to the latest peer address of our peer if message is correct
|
|
||||||
trade.getSeller().setNodeAddress(processModel.getTempTradePeerNodeAddress());
|
|
||||||
if (trade.getSeller().getNodeAddress().equals(trade.getBuyer().getNodeAddress())) trade.getBuyer().setNodeAddress(null); // tests can reuse addresses
|
|
||||||
|
|
||||||
// close open disputes
|
// close open disputes
|
||||||
if (trade.getDisputeState().ordinal() >= Trade.DisputeState.DISPUTE_REQUESTED.ordinal()) {
|
if (trade.getDisputeState().ordinal() >= Trade.DisputeState.DISPUTE_REQUESTED.ordinal()) {
|
||||||
trade.advanceDisputeState(Trade.DisputeState.DISPUTE_CLOSED);
|
trade.advanceDisputeState(Trade.DisputeState.DISPUTE_CLOSED);
|
||||||
|
|
Loading…
Reference in a new issue