diff options
Diffstat (limited to 'src/primitives/block.h')
| -rw-r--r-- | src/primitives/block.h | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/primitives/block.h b/src/primitives/block.h index d59ac4427..dcde500ab 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin Core developers +// Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -35,11 +35,11 @@ public: ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(*(CPureBlockHeader*)this); - nVersion = this->nVersion; - if (this->nVersion.IsAuxpow()) { + if (this->IsAuxpow()) + { if (ser_action.ForRead()) auxpow.reset(new CAuxPow()); assert(auxpow); @@ -54,11 +54,6 @@ public: auxpow.reset(); } - int64_t GetBlockTime() const - { - return (int64_t)nTime; - } - /** * Set the block's auxpow (or unset it). This takes care of updating * the version accordingly. @@ -72,10 +67,10 @@ class CBlock : public CBlockHeader { public: // network and disk - std::vector<CTransaction> vtx; + std::vector<CTransactionRef> vtx; // memory only - mutable std::vector<uint256> vMerkleTree; + mutable bool fChecked; CBlock() { @@ -91,7 +86,7 @@ public: ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(*(CBlockHeader*)this); READWRITE(vtx); } @@ -100,7 +95,7 @@ public: { CBlockHeader::SetNull(); vtx.clear(); - vMerkleTree.clear(); + fChecked = false; } CBlockHeader GetBlockHeader() const @@ -127,7 +122,6 @@ public: std::string ToString() const; }; - /** Describes a place in the block chain to another node such that if the * other node doesn't have the same branch, it can find a recent common trunk. * The further back it is, the further before the fork it may be. @@ -146,8 +140,9 @@ struct CBlockLocator ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { - if (!(nType & SER_GETHASH)) + inline void SerializationOp(Stream& s, Operation ser_action) { + int nVersion = s.GetVersion(); + if (!(s.GetType() & SER_GETHASH)) READWRITE(nVersion); READWRITE(vHave); } @@ -163,4 +158,7 @@ struct CBlockLocator } }; +/** Compute the consensus-critical block weight (see BIP 141). */ +int64_t GetBlockWeight(const CBlock& tx); + #endif // BITCOIN_PRIMITIVES_BLOCK_H |