From fd92031e2783524dcfd47c9664b52ceba641c217 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Thu, 4 Aug 2022 20:34:47 -0700 Subject: [PATCH] rpc: handle "input not found" case in signrawtransaction --- rpc/legacyrpc/methods.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpc/legacyrpc/methods.go b/rpc/legacyrpc/methods.go index ea01fbb..90d3c52 100644 --- a/rpc/legacyrpc/methods.go +++ b/rpc/legacyrpc/methods.go @@ -1861,6 +1861,12 @@ func signRawTransaction(icmd interface{}, w *wallet.Wallet, chainClient *chain.R if err != nil { return nil, err } + if result == nil { + return nil, &btcjson.RPCError{ + Code: btcjson.ErrRPCNoTxInfo, + Message: "Input %s not found" + outPoint.String(), + } + } script, err := hex.DecodeString(result.ScriptPubKey.Hex) if err != nil { return nil, err