bnb-chain / go-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in method for get TX by hash

alexspark21 opened this issue · comments

Hey, when I try to get TX by hash (https://github.com/binance-chain/go-sdk/blob/fe7524098533a6ce6077cf5f28f677329963d17b/client/rpc/basic_client.go#L192) I get error The length of hash is not 32

This is my code
client := getRpcClient(nil)
res, err := client.Tx([]byte(params["hash"]), true)

in general every TxHash equal 64,
may be someone had at the same trouble?

commented

hi, would you check the value of params["hash"], is it a valid hash that the length is 32?

hi, would you check the value of params["hash"], is it a valid hash that the length is 32?

I think for rpc endpont, the tx hash needs to be decoded to 32 bytes
https://github.com/binance-chain/go-sdk/blob/fe7524098533a6ce6077cf5f28f677329963d17b/e2e/e2e_rpc_test.go#L211