18 #include <boost/function.hpp> 25 static constexpr
int DB_PEAK_USAGE_FACTOR = 1;
29 static constexpr
int MAX_BLOCK_COINSDB_USAGE = 10 * DB_PEAK_USAGE_FACTOR;
32 static const int64_t nDefaultDbCache = 450;
34 static const int64_t nDefaultDbBatchSize = 16 << 20;
36 static const int64_t nMaxDbCache =
sizeof(
void*) > 4 ? 16384 : 1024;
38 static const int64_t nMinDbCache = 4;
40 static const int64_t nMaxBlockDBCache = 2;
44 static const int64_t nMaxBlockDBAndTxIndexCache = 1024;
46 static const int64_t nMaxCoinsDBCache = 8;
54 template <
typename Stream,
typename Operation>
79 CCoinsViewDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
81 bool GetCoin(
const COutPoint &outpoint,
Coin &coin)
const override;
82 bool HaveCoin(
const COutPoint &outpoint)
const override;
83 uint256 GetBestBlock()
const override;
84 std::vector<uint256> GetHeadBlocks()
const override;
90 size_t EstimateSize()
const override;
99 bool GetKey(
COutPoint &key)
const override;
100 bool GetValue(
Coin &coin)
const override;
101 unsigned int GetValueSize()
const override;
103 bool Valid()
const override;
104 void Next()
override;
119 CBlockTreeDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
124 bool WriteBatchSync(
const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo,
int nLastFile,
const std::vector<const CBlockIndex*>& blockinfo);
126 bool ReadLastBlockFile(
int &nFile);
127 bool WriteReindexing(
bool fReindex);
128 bool ReadReindexing(
bool &fReindex);
130 bool WriteTxIndex(
const std::vector<std::pair<uint256, CDiskTxPos> > &list);
131 bool WriteFlag(
const std::string &
name,
bool fValue);
132 bool ReadFlag(
const std::string &name,
bool &fValue);
136 bool WriteHeightIndex(
const CHeightTxIndexKey &heightIndex,
const std::vector<uint256>& hash);
149 int ReadHeightIndex(
int low,
int high,
int minconf,
150 std::vector<std::vector<uint256>> &blocksOfHashes,
151 std::set<dev::h160>
const &addresses);
152 bool EraseHeightIndex(
const unsigned int &height);
153 bool WipeHeightIndex();
158 #endif // FABCOIN_TXDB_H void SerializationOp(Stream &s, Operation ser_action)
#define function(a, b, c, d, k, s)
Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB.
std::unique_ptr< CDBIterator > pcursor
Access to the block database (blocks/index/)
Abstract view on the open txout dataset.
std::unordered_map< COutPoint, CCoinsCacheEntry, SaltedOutpointHasher > CCoinsMap
CCoinsViewDBCursor(CDBIterator *pcursorIn, const uint256 &hashBlockIn)
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn)
Parameters that influence chain consensus.
An outpoint - a combination of a transaction hash and an index n into its vout.
std::pair< char, COutPoint > keyTmp
The block chain is a tree shaped structure starting with the genesis block at the root...
CCoinsView backed by the coin database (chainstate/)
Cursor for iterating over CoinsView state.