Skip to content

Commit

Permalink
parseMemo correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ajansari95 committed Jul 13, 2023
1 parent 3be808b commit f0b940e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions x/interchainstaking/keeper/ibc_packet_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,15 +624,18 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUser() {
suite.Require().NoError(err)
}

hash, err := icstypes.ParseTxMsgMemo(test.memo, icstypes.MsgTypeUnbondSend)
suite.Require().NoError(err)

quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusSend, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool {
if withdrawal.Txhash == test.memo[11:] {
if withdrawal.Txhash == hash {
suite.Require().Fail("unexpected withdrawal record; status should be Completed.")
}
return false
})

quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusCompleted, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool {
if withdrawal.Txhash != test.memo[11:] {
if withdrawal.Txhash != hash {
suite.Require().Fail("unexpected withdrawal record; status should be Completed.")
}
return false
Expand Down Expand Up @@ -740,15 +743,18 @@ func (suite *KeeperTestSuite) TestHandleWithdrawForUserLSM() {
}
}

hash, err := icstypes.ParseTxMsgMemo(test.memo, icstypes.MsgTypeUnbondSend)
suite.Require().NoError(err)

quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusSend, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool {
if withdrawal.Txhash == test.memo[11:] {
if withdrawal.Txhash == hash {
suite.Require().Fail("unexpected withdrawal record; status should be Completed.")
}
return false
})

quicksilver.InterchainstakingKeeper.IterateZoneStatusWithdrawalRecords(ctx, zone.ChainId, icstypes.WithdrawStatusCompleted, func(idx int64, withdrawal icstypes.WithdrawalRecord) bool {
if withdrawal.Txhash != test.memo[11:] {
if withdrawal.Txhash != hash {
suite.Require().Fail("unexpected withdrawal record; status should be Completed.")
}
return false
Expand Down

0 comments on commit f0b940e

Please sign in to comment.