check txid (hash0 length argument, must be 64

This commit is contained in:
Larry Ruane 2021-01-19 21:09:40 -07:00 committed by Larry Ruane
parent 5c5c4b882f
commit 86a76a96cb
1 changed files with 3 additions and 0 deletions

View File

@ -234,6 +234,9 @@ func (s *lwdStreamer) GetTreeState(ctx context.Context, id *walletrpc.BlockID) (
// by the zcashd 'getrawtransaction' RPC. // by the zcashd 'getrawtransaction' RPC.
func (s *lwdStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilter) (*walletrpc.RawTransaction, error) { func (s *lwdStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilter) (*walletrpc.RawTransaction, error) {
if txf.Hash != nil { if txf.Hash != nil {
if len(txf.Hash) != 32 {
return nil, errors.New("Transaction ID has invalid length")
}
leHashStringJSON, err := json.Marshal(hex.EncodeToString(parser.Reverse(txf.Hash))) leHashStringJSON, err := json.Marshal(hex.EncodeToString(parser.Reverse(txf.Hash)))
if err != nil { if err != nil {
return nil, err return nil, err