Fix up the tx parsing for chain ids in address

This commit is contained in:
Ethan Frey 2017-06-30 18:30:02 +02:00
parent 4b815f4289
commit 6dc3aedc25
2 changed files with 4 additions and 4 deletions

View File

@ -123,12 +123,12 @@ func (txOut TxOutput) ChainAndAddress() ([]byte, []byte, abci.Result) {
var chainPrefix []byte
address := txOut.Address
if len(address) > 20 {
spl := bytes.Split(address, []byte("/"))
if len(spl) < 2 {
spl := bytes.SplitN(address, []byte("/"), 2)
if len(spl) != 2 {
return nil, nil, abci.ErrBaseInvalidOutput.AppendLog("Invalid address format")
}
chainPrefix = spl[0]
address = bytes.Join(spl[1:], nil)
address = spl[1]
}
if len(address) != 20 {

View File

@ -133,7 +133,7 @@ func TestSendTxIBC(t *testing.T) {
require.Nil(err)
short, err := hex.DecodeString("1960CA7E170862837AA8F22F947194F41F610B")
require.Nil(err)
long, err := hex.DecodeString("1960CA7E170862837AA8F22A947194F41F6186120B")
long, err := hex.DecodeString("1960CA7E170862837AA8F22F947194F41F6186120B")
require.Nil(err)
slash, err := hex.DecodeString("F40ECECEA86F29D0FDF2980EF72F1708687BD4BF")
require.Nil(err)