mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-09 15:15:12 +01:00
Merge #17371: Refactor: Require scriptPubKey to get wallet SigningProvider
d0dab897afRefactor: Require scriptPubKey to get wallet SigningProvider (Andrew Chow)4b0c718f8fAccumulate result UniValue in SignTransaction (Andrew Chow) Pull request description: Easier to review ignoring whitespace: git log -p -n1 -w This commit does not change behavior. It passes new CScript arguments to signing functions, but the arguments aren't currently used. Split from #17261 ACKs for top commit: instagibbs: utACKd0dab897afryanofsky: Code review ACKd0dab897af. Thanks for the SignTransaction update. No other changes since last review Sjors: Code review ACKd0dab897afpromag: Code review ACKd0dab897af. meshcollider: Code review ACKd0dab897afTree-SHA512: c3f52df20fd9d6b3b5aa65562cf5f7dce7b7f44c148b0f988f8b578fce2a28e9b7bf010f5f04bb5bf60f5272b2899f1dbbfb8aee81579c21c9cba559d1d2bb70
This commit is contained in:
@@ -763,7 +763,9 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||
// Parse the prevtxs array
|
||||
ParsePrevouts(request.params[2], &keystore, coins);
|
||||
|
||||
return SignTransaction(mtx, &keystore, coins, request.params[3]);
|
||||
UniValue result(UniValue::VOBJ);
|
||||
SignTransaction(mtx, &keystore, coins, request.params[3], result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
@@ -268,7 +268,7 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
|
||||
}
|
||||
}
|
||||
|
||||
UniValue SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, const UniValue& hashType)
|
||||
void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, const UniValue& hashType, UniValue& result)
|
||||
{
|
||||
int nHashType = ParseSighashString(hashType);
|
||||
|
||||
@@ -319,12 +319,12 @@ UniValue SignTransaction(CMutableTransaction& mtx, const SigningProvider* keysto
|
||||
}
|
||||
bool fComplete = vErrors.empty();
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("hex", EncodeHexTx(CTransaction(mtx)));
|
||||
result.pushKV("complete", fComplete);
|
||||
if (!vErrors.empty()) {
|
||||
if (result.exists("errors")) {
|
||||
vErrors.push_backV(result["errors"].getValues());
|
||||
}
|
||||
result.pushKV("errors", vErrors);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ class SigningProvider;
|
||||
* @param keystore Temporary keystore containing signing keys
|
||||
* @param coins Map of unspent outputs
|
||||
* @param hashType The signature hash type
|
||||
* @returns JSON object with details of signed transaction
|
||||
* @param result JSON object where signed transaction results accumulate
|
||||
*/
|
||||
UniValue SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, const UniValue& hashType);
|
||||
void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, const UniValue& hashType, UniValue& result);
|
||||
|
||||
/**
|
||||
* Parse a prevtxs UniValue array and get the map of coins from it
|
||||
|
||||
Reference in New Issue
Block a user