mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Make CTransaction actually immutable
This commit is contained in:
parent
42fd8dee30
commit
81e3228fcb
10 changed files with 132 additions and 141 deletions
|
|
@ -276,7 +276,7 @@ private:
|
|||
//! The Witness embedded script
|
||||
CScript witscript;
|
||||
CScriptWitness scriptWitness;
|
||||
CTransaction creditTx;
|
||||
CTransactionRef creditTx;
|
||||
CMutableTransaction spendTx;
|
||||
bool havePush;
|
||||
std::vector<unsigned char> push;
|
||||
|
|
@ -319,8 +319,8 @@ public:
|
|||
redeemscript = scriptPubKey;
|
||||
scriptPubKey = CScript() << OP_HASH160 << ToByteVector(CScriptID(redeemscript)) << OP_EQUAL;
|
||||
}
|
||||
creditTx = BuildCreditingTransaction(scriptPubKey, nValue);
|
||||
spendTx = BuildSpendingTransaction(CScript(), CScriptWitness(), creditTx);
|
||||
creditTx = MakeTransactionRef(BuildCreditingTransaction(scriptPubKey, nValue));
|
||||
spendTx = BuildSpendingTransaction(CScript(), CScriptWitness(), *creditTx);
|
||||
}
|
||||
|
||||
TestBuilder& ScriptError(ScriptError_t err)
|
||||
|
|
@ -421,7 +421,7 @@ public:
|
|||
{
|
||||
TestBuilder copy = *this; // Make a copy so we can rollback the push.
|
||||
DoPush();
|
||||
DoTest(creditTx.vout[0].scriptPubKey, spendTx.vin[0].scriptSig, scriptWitness, flags, comment, scriptError, nValue);
|
||||
DoTest(creditTx->vout[0].scriptPubKey, spendTx.vin[0].scriptSig, scriptWitness, flags, comment, scriptError, nValue);
|
||||
*this = copy;
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ public:
|
|||
array.push_back(wit);
|
||||
}
|
||||
array.push_back(FormatScript(spendTx.vin[0].scriptSig));
|
||||
array.push_back(FormatScript(creditTx.vout[0].scriptPubKey));
|
||||
array.push_back(FormatScript(creditTx->vout[0].scriptPubKey));
|
||||
array.push_back(FormatScriptFlags(flags));
|
||||
array.push_back(FormatScriptError((ScriptError_t)scriptError));
|
||||
array.push_back(comment);
|
||||
|
|
@ -461,7 +461,7 @@ public:
|
|||
|
||||
const CScript& GetScriptPubKey()
|
||||
{
|
||||
return creditTx.vout[0].scriptPubKey;
|
||||
return creditTx->vout[0].scriptPubKey;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue