[bitcoin/bitcoin] Make signrawtransaction* give an error when amount is needed but missing (#13547)

MarcoFalke commented on this pull request.

> + self.log.info(‘sendrawtransaction with missing prevtx info (%s)’ %(type))
+
+ # Test `signrawtransactionwithwallet` invalid `prevtxs`
+ inputs = [ {‘txid’ : txid, ‘vout’ : 3, ‘sequence’ : 1000}]
+ outputs = { self.nodes[0].getnewaddress() : 1 }
+ rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
+
+ prevtx = dict(txid=txid, scriptPubKey=pubkey, vout=3, amount=1)
+ succ = self.nodes[0].signrawtransactionwithwallet(rawtx, [prevtx])
+ assert succ[«complete»]
+ if type == «legacy»:
+ del prevtx[«amount»]
+ succ = self.nodes[0].signrawtransactionwithwallet(rawtx, [prevtx])
+ assert succ[«complete»]
+
+ if type != «legacy»:

Alternatively remove the `prevtx` variable from the patch and always pass a fresh dict: `prevtxs=dict(txid=txid, amount missing…)`

Добавить комментарий