Skip to content

Commit

Permalink
Fix acct sequences not incrementing when messages error ot
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Nov 30, 2023
1 parent bcdd85c commit eacfd87
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions testutil/simibc/relay_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ func UpdateReceiverClient(sender, receiver *ibctesting.Endpoint, header *ibctmty
true, !expectExpiration, receiver.Chain.SenderPrivKey,
)

setSequenceErr := receiver.Chain.SenderAccount.SetSequence(receiver.Chain.SenderAccount.GetSequence() + 1)
if err != nil {
return err
}

err = receiver.Chain.SenderAccount.SetSequence(receiver.Chain.SenderAccount.GetSequence() + 1)

if err != nil {
return err
if setSequenceErr != nil {
return setSequenceErr
}

return nil
Expand Down Expand Up @@ -85,14 +84,14 @@ func TryRecvPacket(sender, receiver *ibctesting.Endpoint, packet channeltypes.Pa
[]uint64{receiver.Chain.SenderAccount.GetSequence()},
true, !expectError, receiver.Chain.SenderPrivKey,
)
// need to set the sequence even if there was an error in delivery
setSequenceErr := receiver.Chain.SenderAccount.SetSequence(receiver.Chain.SenderAccount.GetSequence() + 1)
if err != nil {
return nil, err
}

err = receiver.Chain.SenderAccount.SetSequence(receiver.Chain.SenderAccount.GetSequence() + 1)

if err != nil {
return nil, err
if setSequenceErr != nil {
return nil, setSequenceErr
}

ack, err = ibctesting.ParseAckFromEvents(resWithAck.GetEvents())
Expand Down Expand Up @@ -129,14 +128,13 @@ func TryRecvAck(sender, receiver *ibctesting.Endpoint, packet channeltypes.Packe
true, true, receiver.Chain.SenderPrivKey,
)

setSequenceErr := receiver.Chain.SenderAccount.SetSequence(receiver.Chain.SenderAccount.GetSequence() + 1)
if err != nil {
return err
}

err = receiver.Chain.SenderAccount.SetSequence(receiver.Chain.SenderAccount.GetSequence() + 1)

if err != nil {
return err
if setSequenceErr != nil {
return setSequenceErr
}

return nil
Expand Down

0 comments on commit eacfd87

Please sign in to comment.