diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e56af33..d55789937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ BREAKING CHANGES FIXES * \#1259 - fix bug where certain tests that could have a nil pointer in defer * Retry on HTTP request failure in CLI tests, add option to retry tests in Makefile +* Fixed bug where chain ID wasn't passed properly in x/bank REST handler ## 0.19.0 diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index d6a1b7742..8ad8b45db 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -8,6 +8,7 @@ import ( "regexp" "testing" + "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -440,6 +441,7 @@ func doSend(t *testing.T, port, seed, name, password string, addr sdk.Address) ( acc := getAccount(t, port, addr) accnum := acc.GetAccountNumber() sequence := acc.GetSequence() + chainID := viper.GetString(client.FlagChainID) // send coinbz, err := json.Marshal(sdk.NewCoin("steak", 1)) @@ -453,8 +455,9 @@ func doSend(t *testing.T, port, seed, name, password string, addr sdk.Address) ( "account_number":%d, "sequence":%d, "gas": 10000, - "amount":[%s] - }`, name, password, accnum, sequence, coinbz)) + "amount":[%s], + "chain_id":"%s" + }`, name, password, accnum, sequence, coinbz, chainID)) res, body := Request(t, port, "POST", "/accounts/"+receiveAddrBech+"/send", jsonStr) require.Equal(t, http.StatusOK, res.StatusCode, body) diff --git a/x/bank/client/rest/sendtx.go b/x/bank/client/rest/sendtx.go index 2639d2788..4678d8184 100644 --- a/x/bank/client/rest/sendtx.go +++ b/x/bank/client/rest/sendtx.go @@ -90,6 +90,8 @@ func SendRequestHandlerFn(cdc *wire.Codec, kb keys.Keybase, ctx context.CoreCont // add gas to context ctx = ctx.WithGas(m.Gas) + // add chain-id to context + ctx = ctx.WithChainID(m.ChainID) // sign ctx = ctx.WithAccountNumber(m.AccountNumber)