aboutsummaryrefslogtreecommitdiff
path: root/src/rpcrawtransaction.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-06-07 13:53:27 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-06-21 22:59:03 +0200
commit4949004d68dc08382df2c34ae519c1b1cfd60f1a (patch)
treee3c4b2d6fa162af1cfbe44f6deb39278c12c5672 /src/rpcrawtransaction.cpp
parent8f59251b83cd9c862aee53dd50ce32bcab12ed6d (diff)
downloadbitcoin-4949004d68dc08382df2c34ae519c1b1cfd60f1a.tar.xz
Add CMutableTransaction and make CTransaction immutable.
In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
Diffstat (limited to 'src/rpcrawtransaction.cpp')
-rw-r--r--src/rpcrawtransaction.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index dee7daeb2a..1b5d494beb 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -349,7 +349,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
Array inputs = params[0].get_array();
Object sendTo = params[1].get_obj();
- CTransaction rawTx;
+ CMutableTransaction rawTx;
BOOST_FOREACH(const Value& input, inputs)
{
@@ -554,11 +554,11 @@ Value signrawtransaction(const Array& params, bool fHelp)
vector<unsigned char> txData(ParseHexV(params[0], "argument 1"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
- vector<CTransaction> txVariants;
+ vector<CMutableTransaction> txVariants;
while (!ssData.empty())
{
try {
- CTransaction tx;
+ CMutableTransaction tx;
ssData >> tx;
txVariants.push_back(tx);
}
@@ -572,7 +572,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
// mergedTx will end up with all the signatures; it
// starts as a clone of the rawtx:
- CTransaction mergedTx(txVariants[0]);
+ CMutableTransaction mergedTx(txVariants[0]);
bool fComplete = true;
// Fetch previous transactions (inputs):
@@ -713,7 +713,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
// ... and merge in other signatures:
- BOOST_FOREACH(const CTransaction& txv, txVariants)
+ BOOST_FOREACH(const CMutableTransaction& txv, txVariants)
{
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
}