mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Move CTxInWitness inside CTxIn
This commit is contained in:
parent
d04aebaec7
commit
f6fb7acda4
18 changed files with 96 additions and 176 deletions
|
|
@ -93,8 +93,9 @@ static int verify_script(const unsigned char *scriptPubKey, unsigned int scriptP
|
|||
|
||||
// Regardless of the verification result, the tx did not error.
|
||||
set_error(err, bitcoinconsensus_ERR_OK);
|
||||
|
||||
PrecomputedTransactionData txdata(tx);
|
||||
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), nIn < tx.wit.vtxinwit.size() ? &tx.wit.vtxinwit[nIn].scriptWitness : NULL, flags, TransactionSignatureChecker(&tx, nIn, amount, txdata), NULL);
|
||||
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), &tx.vin[nIn].scriptWitness, flags, TransactionSignatureChecker(&tx, nIn, amount, txdata), NULL);
|
||||
} catch (const std::exception&) {
|
||||
return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing
|
||||
}
|
||||
|
|
|
|||
|
|
@ -656,6 +656,8 @@ struct CScriptWitness
|
|||
|
||||
bool IsNull() const { return stack.empty(); }
|
||||
|
||||
void SetNull() { stack.clear(); stack.shrink_to_fit(); }
|
||||
|
||||
std::string ToString() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -194,9 +194,7 @@ SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nI
|
|||
SignatureData data;
|
||||
assert(tx.vin.size() > nIn);
|
||||
data.scriptSig = tx.vin[nIn].scriptSig;
|
||||
if (tx.wit.vtxinwit.size() > nIn) {
|
||||
data.scriptWitness = tx.wit.vtxinwit[nIn].scriptWitness;
|
||||
}
|
||||
data.scriptWitness = tx.vin[nIn].scriptWitness;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
@ -204,10 +202,7 @@ void UpdateTransaction(CMutableTransaction& tx, unsigned int nIn, const Signatur
|
|||
{
|
||||
assert(tx.vin.size() > nIn);
|
||||
tx.vin[nIn].scriptSig = data.scriptSig;
|
||||
if (!data.scriptWitness.IsNull() || tx.wit.vtxinwit.size() > nIn) {
|
||||
tx.wit.vtxinwit.resize(tx.vin.size());
|
||||
tx.wit.vtxinwit[nIn].scriptWitness = data.scriptWitness;
|
||||
}
|
||||
tx.vin[nIn].scriptWitness = data.scriptWitness;
|
||||
}
|
||||
|
||||
bool SignSignature(const CKeyStore &keystore, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue