You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #13547: Make signrawtransaction* give an error when amount is needed but missing
685d1d8 [tests] Check signrawtransaction* errors on missing prevtx info (Anthony Towns)
a3b065b Error on missing amount in signrawtransaction* (Anthony Towns)
Pull request description:
Signatures using segregated witness commit to the amount being spent, so that value must be passed into signrawtransactionwithkey and signrawtransactionwithwallet. This ensures an error is issued if that doesn't happen, rather than just assuming the value is 0 and producing a signature that is almost certainly invalid.
Based on Ben Woosley's #12458, Fixes: #12429.
Tree-SHA512: 8e2ff89d5bcf79548e569210af0d850028bc98d86c149b92207c9300ab1d63664a7e2b222c1be403a15941aa5cf36ccc3c0d570ee1c1466f3496b4fe06c17e11
// amount must be specified for valid segwit signature
887
+
if (amount == MAX_MONEY && !txin.scriptWitness.IsNull()) {
888
+
throwJSONRPCError(RPC_TYPE_ERROR, strprintf("Missing amount for %s", coin.out.ToString()));
889
+
}
890
+
886
891
ScriptError serror = SCRIPT_ERR_OK;
887
892
if (!VerifyScript(txin.scriptSig, prevPubKey, &txin.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i, amount), &serror)) {
888
893
if (serror == SCRIPT_ERR_INVALID_STACK_OPERATION) {
0 commit comments