mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 14:14:00 +01:00
Merge #13429: Return the script type from Solver
984d72ec65 Return the script type from Solver (Ben Woosley)
Pull request description:
Because false is synonymous with TX_NONSTANDARD, this conveys the same
information and makes the handling explicitly based on script type,
simplifying each call site.
Prior to this change it was common for the return value to be ignored, or for the
return value and TX_NONSTANDARD to be redundantly handled.
Tree-SHA512: 31864f856b8cb75f4b782d12678070e8b1cfe9665c6f57cfb25e7ac8bcea8a22f9a78d7c8cf0101c841f2a612400666fb91798bffe88de856e98b873703b0965
This commit is contained in:
@@ -101,8 +101,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
||||
std::vector<unsigned char> sig;
|
||||
|
||||
std::vector<valtype> vSolutions;
|
||||
if (!Solver(scriptPubKey, whichTypeRet, vSolutions))
|
||||
return false;
|
||||
whichTypeRet = Solver(scriptPubKey, vSolutions);
|
||||
|
||||
switch (whichTypeRet)
|
||||
{
|
||||
@@ -329,9 +328,8 @@ SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nI
|
||||
}
|
||||
|
||||
// Get scripts
|
||||
txnouttype script_type;
|
||||
std::vector<std::vector<unsigned char>> solutions;
|
||||
Solver(txout.scriptPubKey, script_type, solutions);
|
||||
txnouttype script_type = Solver(txout.scriptPubKey, solutions);
|
||||
SigVersion sigversion = SigVersion::BASE;
|
||||
CScript next_script = txout.scriptPubKey;
|
||||
|
||||
@@ -342,7 +340,7 @@ SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nI
|
||||
next_script = std::move(redeem_script);
|
||||
|
||||
// Get redeemScript type
|
||||
Solver(next_script, script_type, solutions);
|
||||
script_type = Solver(next_script, solutions);
|
||||
stack.script.pop_back();
|
||||
}
|
||||
if (script_type == TX_WITNESS_V0_SCRIPTHASH && !stack.witness.empty() && !stack.witness.back().empty()) {
|
||||
@@ -352,7 +350,7 @@ SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nI
|
||||
next_script = std::move(witness_script);
|
||||
|
||||
// Get witnessScript type
|
||||
Solver(next_script, script_type, solutions);
|
||||
script_type = Solver(next_script, solutions);
|
||||
stack.witness.pop_back();
|
||||
stack.script = std::move(stack.witness);
|
||||
stack.witness.clear();
|
||||
|
||||
Reference in New Issue
Block a user