27 static constexpr
int MAX_BLOCK_COINSDB_USAGE = 10;
29 static const int64_t nDefaultDbCache = 450;
31 static const int64_t nDefaultDbBatchSize = 16 << 20;
33 static const int64_t nMaxDbCache =
sizeof(
void*) > 4 ? 16384 : 1024;
35 static const int64_t nMinDbCache = 4;
37 static const int64_t nMaxBlockDBCache = 2;
41 static const int64_t nMaxBlockDBAndTxIndexCache = 1024;
43 static const int64_t nMaxCoinsDBCache = 8;
51 template <
typename Stream,
typename Operation>
76 explicit CCoinsViewDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
78 bool GetCoin(
const COutPoint &outpoint,
Coin &coin)
const override;
79 bool HaveCoin(
const COutPoint &outpoint)
const override;
80 uint256 GetBestBlock()
const override;
81 std::vector<uint256> GetHeadBlocks()
const override;
87 size_t EstimateSize()
const override;
96 bool GetKey(
COutPoint &key)
const override;
97 bool GetValue(
Coin &coin)
const override;
98 unsigned int GetValueSize()
const override;
100 bool Valid()
const override;
101 void Next()
override;
116 explicit CBlockTreeDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false,
size_t maxFileSize = 2 << 20);
121 bool WriteBatchSync(
const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo,
int nLastFile,
const std::vector<const CBlockIndex*>& blockinfo);
123 bool ReadLastBlockFile(
int &nFile);
124 bool WriteReindexing(
bool fReindexing);
125 bool ReadReindexing(
bool &fReindexing);
127 bool WriteTxIndex(
const std::vector<std::pair<uint256, CDiskTxPos> > &vect);
129 bool UpdateSpentIndex(
const std::vector<std::pair<CSpentIndexKey, CSpentIndexValue> >&vect);
130 bool UpdateAddressUnspentIndex(
const std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue > >&vect);
131 bool ReadAddressUnspentIndex(
uint160 addressHash,
int type, std::string assetName,
132 std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &vect);
133 bool ReadAddressUnspentIndex(
uint160 addressHash,
int type,
134 std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &vect);
135 bool WriteAddressIndex(
const std::vector<std::pair<CAddressIndexKey, CAmount> > &vect);
136 bool EraseAddressIndex(
const std::vector<std::pair<CAddressIndexKey, CAmount> > &vect);
137 bool ReadAddressIndex(
uint160 addressHash,
int type, std::string assetName,
138 std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,
139 int start = 0,
int end = 0);
140 bool ReadAddressIndex(
uint160 addressHash,
int type,
141 std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,
142 int start = 0,
int end = 0);
144 bool ReadTimestampIndex(
const unsigned int &
high,
const unsigned int &
low,
const bool fActiveOnly, std::vector<std::pair<uint256, unsigned int> > &vect);
146 bool ReadTimestampBlockIndex(
const uint256 &hash,
unsigned int &logicalTS);
147 bool WriteFlag(
const std::string &name,
bool fValue);
148 bool ReadFlag(
const std::string &name,
bool &fValue);
152 #endif // RAVEN_TXDB_H void SerializationOp(Stream &s, Operation ser_action)
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.