Merge pull request #1310: Fix x/bank REST handler

* Update sendtx.go

* Pass chain_id through in LCD tests

* Update changelog
This commit is contained in:
Christopher Goes 2018-06-20 19:34:12 +02:00 committed by Rigel
parent 0b0236f2bf
commit 2a9bc2153a
3 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)