diff options
| author | Pieter Wuille <[email protected]> | 2016-11-11 16:23:17 -0800 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-12-02 18:37:43 -0800 |
| commit | 81e3228fcb33e8ed32d8b9fbe917444ba080073a (patch) | |
| tree | 345dd81bc1661003ea8957fe1f69050b3187d4ac /src/validation.cpp | |
| parent | Make DecodeHexTx return a CMutableTransaction (diff) | |
| download | discoin-81e3228fcb33e8ed32d8b9fbe917444ba080073a.tar.xz discoin-81e3228fcb33e8ed32d8b9fbe917444ba080073a.zip | |
Make CTransaction actually immutable
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index fe3456513..7eef14af2 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2859,8 +2859,9 @@ std::vector<unsigned char> GenerateCoinbaseCommitment(CBlock& block, const CBloc out.scriptPubKey[5] = 0xed; memcpy(&out.scriptPubKey[6], witnessroot.begin(), 32); commitment = std::vector<unsigned char>(out.scriptPubKey.begin(), out.scriptPubKey.end()); - const_cast<std::vector<CTxOut>*>(&block.vtx[0]->vout)->push_back(out); - block.vtx[0]->UpdateHash(); + CMutableTransaction tx(*block.vtx[0]); + tx.vout.push_back(out); + block.vtx[0] = MakeTransactionRef(std::move(tx)); } } UpdateUncommittedBlockStructures(block, pindexPrev, consensusParams); @@ -4090,10 +4091,9 @@ bool LoadMempool(void) file >> num; double prioritydummy = 0; while (num--) { - CTransaction tx; int64_t nTime; int64_t nFeeDelta; - file >> tx; + CTransaction tx(deserialize, file); file >> nTime; file >> nFeeDelta; |