diff --git a/types/tx.go b/types/tx.go index a54d7caf0a..4d1455d7ab 100644 --- a/types/tx.go +++ b/types/tx.go @@ -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 { diff --git a/types/tx_test.go b/types/tx_test.go index 35f359c1c9..73ccbf54da 100644 --- a/types/tx_test.go +++ b/types/tx_test.go @@ -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)