mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Make CTransaction actually immutable
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user