Skip to content

Commit 707fde7

Browse files
committed
add unused SnapshotMetadata class
1 parent 6a97e8a commit 707fde7

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ BITCOIN_CORE_H = \
159159
node/coinstats.h \
160160
node/psbt.h \
161161
node/transaction.h \
162+
node/utxo_snapshot.h \
162163
noui.h \
163164
optional.h \
164165
outputtype.h \

src/node/utxo_snapshot.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) 2009-2010 Satoshi Nakamoto
2+
// Copyright (c) 2009-2019 The Bitcoin Core developers
3+
// Distributed under the MIT software license, see the accompanying
4+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
6+
#ifndef BITCOIN_NODE_UTXO_SNAPSHOT_H
7+
#define BITCOIN_NODE_UTXO_SNAPSHOT_H
8+
9+
#include <uint256.h>
10+
#include <serialize.h>
11+
12+
//! Metadata describing a serialized version of a UTXO set from which an
13+
//! assumeutxo CChainState can be constructed.
14+
class SnapshotMetadata
15+
{
16+
public:
17+
//! The hash of the block that reflects the tip of the chain for the
18+
//! UTXO set contained in this snapshot.
19+
uint256 m_base_blockhash;
20+
21+
//! The number of coins in the UTXO set contained in this snapshot. Used
22+
//! during snapshot load to estimate progress of UTXO set reconstruction.
23+
uint64_t m_coins_count = 0;
24+
25+
//! Necessary to "fake" the base nChainTx so that we can estimate progress during
26+
//! initial block download for the assumeutxo chainstate.
27+
unsigned int m_nchaintx = 0;
28+
29+
SnapshotMetadata() { }
30+
SnapshotMetadata(
31+
const uint256& base_blockhash,
32+
uint64_t coins_count,
33+
unsigned int nchaintx) :
34+
m_base_blockhash(base_blockhash),
35+
m_coins_count(coins_count),
36+
m_nchaintx(nchaintx) { }
37+
38+
ADD_SERIALIZE_METHODS;
39+
40+
template <typename Stream, typename Operation>
41+
inline void SerializationOp(Stream& s, Operation ser_action)
42+
{
43+
READWRITE(m_base_blockhash);
44+
READWRITE(m_coins_count);
45+
READWRITE(m_nchaintx);
46+
}
47+
48+
};
49+
50+
#endif // BITCOIN_NODE_UTXO_SNAPSHOT_H

src/validation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <txmempool.h> // For CTxMemPool::cs
2222
#include <txdb.h>
2323
#include <versionbits.h>
24+
#include <serialize.h>
2425

2526
#include <algorithm>
2627
#include <atomic>

0 commit comments

Comments
 (0)