Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
index
txindex.h
Go to the documentation of this file.
1
// Copyright (c) 2017-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_INDEX_TXINDEX_H
6
#define BITCOIN_INDEX_TXINDEX_H
7
8
#include <
index/base.h
>
9
#include <
primitives/transaction.h
>
10
11
#include <cstddef>
12
#include <memory>
13
14
class
uint256
;
15
namespace
interfaces
{
16
class
Chain
;
17
}
18
19
static
constexpr
bool
DEFAULT_TXINDEX
{
false
};
20
26
class
TxIndex
final :
public
BaseIndex
27
{
28
protected
:
29
class
DB
;
30
31
private
:
32
const
std::unique_ptr<DB>
m_db
;
33
34
bool
AllowPrune
()
const override
{
return
false
; }
35
36
protected
:
37
bool
CustomAppend
(
const
interfaces::BlockInfo
& block)
override
;
38
39
BaseIndex::DB
&
GetDB
()
const override
;
40
41
public
:
43
explicit
TxIndex
(std::unique_ptr<interfaces::Chain> chain,
size_t
n_cache_size,
bool
f_memory =
false
,
bool
f_wipe =
false
);
44
45
// Destructor is declared because this class contains a unique_ptr to an incomplete type.
46
virtual
~TxIndex
()
override
;
47
54
bool
FindTx
(
const
Txid
& tx_hash,
uint256
& block_hash,
CTransactionRef
& tx)
const
;
55
};
56
58
extern
std::unique_ptr<TxIndex>
g_txindex
;
59
60
#endif
// BITCOIN_INDEX_TXINDEX_H
base.h
BaseIndex::DB
The database stores a block locator of the chain the database is synced to so that the index can effi...
Definition
base.h:65
BaseIndex::BaseIndex
BaseIndex(std::unique_ptr< interfaces::Chain > chain, std::string name)
Definition
base.cpp:95
TxIndex::DB
Access to the txindex database (indexes/txindex/).
Definition
txindex.cpp:39
TxIndex::GetDB
BaseIndex::DB & GetDB() const override
Definition
txindex.cpp:92
TxIndex::CustomAppend
bool CustomAppend(const interfaces::BlockInfo &block) override
Write update index entries for a newly connected block.
Definition
txindex.cpp:75
TxIndex::FindTx
bool FindTx(const Txid &tx_hash, uint256 &block_hash, CTransactionRef &tx) const
Look up a transaction by hash.
Definition
txindex.cpp:94
TxIndex::TxIndex
TxIndex(std::unique_ptr< interfaces::Chain > chain, size_t n_cache_size, bool f_memory=false, bool f_wipe=false)
Constructs the index, which becomes available to be queried.
Definition
txindex.cpp:69
TxIndex::~TxIndex
virtual ~TxIndex() override
TxIndex::AllowPrune
bool AllowPrune() const override
Definition
txindex.h:34
TxIndex::m_db
const std::unique_ptr< DB > m_db
Definition
txindex.h:32
interfaces::Chain
Definition
chain.h:118
uint256
256-bit opaque blob.
Definition
uint256.h:195
interfaces
Definition
interfaces.cpp:41
transaction.h
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition
transaction.h:403
interfaces::BlockInfo
Block data sent with blockConnected, blockDisconnected notifications.
Definition
chain.h:19
Txid
transaction_identifier< false > Txid
Txid commits to all transaction fields except the witness.
Definition
transaction_identifier.h:71
g_txindex
std::unique_ptr< TxIndex > g_txindex
The global transaction index, used in GetTransaction. May be null.
Definition
txindex.cpp:34
DEFAULT_TXINDEX
static constexpr bool DEFAULT_TXINDEX
Definition
txindex.h:19
Generated on
for Bitcoin Core by
1.17.0