Skip to content

Commit

Permalink
CopyTx also copies timeoutHeight (#8015)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 24, 2020
1 parent c15884a commit 12a02b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/tx/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func CopyTx(tx signing.Tx, builder client.TxBuilder, ignoreSignatureError bool)
builder.SetMemo(tx.GetMemo())
builder.SetFeeAmount(tx.GetFee())
builder.SetGasLimit(tx.GetGas())
builder.SetTimeoutHeight(tx.GetTimeoutHeight())

return nil
}
Expand Down
8 changes: 6 additions & 2 deletions client/tx/legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
)

const (
memo = "waboom"
gas = uint64(10000)
memo = "waboom"
gas = uint64(10000)
timeoutHeight = 5
)

var (
Expand All @@ -47,6 +48,7 @@ func buildTestTx(t *testing.T, builder client.TxBuilder) {
require.NoError(t, err)
err = builder.SetSignatures(sig)
require.NoError(t, err)
builder.SetTimeoutHeight(timeoutHeight)
}

type TestSuite struct {
Expand Down Expand Up @@ -105,6 +107,7 @@ func (s *TestSuite) TestConvertTxToStdTx() {
s.Require().Equal(gas, stdTx.Fee.Gas)
s.Require().Equal(fee, stdTx.Fee.Amount)
s.Require().Equal(msg, stdTx.Msgs[0])
s.Require().Equal(timeoutHeight, stdTx.TimeoutHeight)
s.Require().Equal(sig.PubKey, stdTx.Signatures[0].PubKey)
s.Require().Equal(sig.Data.(*signing2.SingleSignatureData).Signature, stdTx.Signatures[0].Signature)

Expand All @@ -123,6 +126,7 @@ func (s *TestSuite) TestConvertTxToStdTx() {
s.Require().Equal(gas, stdTx.Fee.Gas)
s.Require().Equal(fee, stdTx.Fee.Amount)
s.Require().Equal(msg, stdTx.Msgs[0])
s.Require().Equal(timeoutHeight, stdTx.TimeoutHeight)
s.Require().Empty(stdTx.Signatures)

// std tx
Expand Down

0 comments on commit 12a02b9

Please sign in to comment.