From d1a48e7d2dc3a23f889751567e253abb1fdb1e1e Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Mon, 19 Apr 2021 13:48:05 -0700 Subject: [PATCH] Verify rawtx --- frontend/service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/service.go b/frontend/service.go index 0c9cc088..0b6e0952 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -288,6 +288,11 @@ func (s *lwdStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawT // Result: // "hex" (string) The transaction hash in hex + // Verify rawtx + if rawtx == nil || rawtx.Data == nil { + return nil, errors.New("Bad transaction data") + } + // Construct raw JSON-RPC params params := make([]json.RawMessage, 1) txJSON, err := json.Marshal(hex.EncodeToString(rawtx.Data))