mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Add Elements-style witness serialization
This commit is contained in:
parent
6ed8fd8ab0
commit
fb72ee8fc8
50 changed files with 873 additions and 414 deletions
|
|
@ -74,7 +74,8 @@ static void VerifyScriptBench(benchmark::State& state)
|
|||
CScript witScriptPubkey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(pubkeyHash) << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
const CMutableTransaction& txCredit = BuildCreditingTransaction(scriptPubKey);
|
||||
CMutableTransaction txSpend = BuildSpendingTransaction(scriptSig, txCredit);
|
||||
CScriptWitness& witness = txSpend.vin[0].scriptWitness;
|
||||
txSpend.witness.vtxinwit.resize(1);
|
||||
CScriptWitness& witness = txSpend.witness.vtxinwit[0].scriptWitness;
|
||||
witness.stack.emplace_back();
|
||||
key.Sign(SignatureHash(witScriptPubkey, txSpend, 0, SIGHASH_ALL, txCredit.vout[0].nValue, SigVersion::WITNESS_V0), witness.stack.back());
|
||||
witness.stack.back().push_back(static_cast<unsigned char>(SIGHASH_ALL));
|
||||
|
|
@ -86,7 +87,7 @@ static void VerifyScriptBench(benchmark::State& state)
|
|||
bool success = VerifyScript(
|
||||
txSpend.vin[0].scriptSig,
|
||||
txCredit.vout[0].scriptPubKey,
|
||||
&txSpend.vin[0].scriptWitness,
|
||||
&txSpend.witness.vtxinwit[0].scriptWitness,
|
||||
flags,
|
||||
MutableTransactionSignatureChecker(&txSpend, 0, txCredit.vout[0].nValue),
|
||||
&err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue