Bitcoin Core  25.99.0
P2P Digital Currency
txreconciliation.h
Go to the documentation of this file.
1 // Copyright (c) 2022 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_NODE_TXRECONCILIATION_H
6 #define BITCOIN_NODE_TXRECONCILIATION_H
7 
8 #include <net.h>
9 #include <sync.h>
10 
11 #include <memory>
12 #include <tuple>
13 
15 static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
17 static constexpr uint32_t TXRECONCILIATION_VERSION{1};
18 
20  NOT_FOUND,
21  SUCCESS,
24 };
25 
54 {
55 private:
56  class Impl;
57  const std::unique_ptr<Impl> m_impl;
58 
59 public:
60  explicit TxReconciliationTracker(uint32_t recon_version);
62 
70  uint64_t PreRegisterPeer(NodeId peer_id);
71 
76  ReconciliationRegisterResult RegisterPeer(NodeId peer_id, bool is_peer_inbound,
77  uint32_t peer_recon_version, uint64_t remote_salt);
78 
83  void ForgetPeer(NodeId peer_id);
84 
88  bool IsPeerRegistered(NodeId peer_id) const;
89 };
90 
91 #endif // BITCOIN_NODE_TXRECONCILIATION_H
Actual implementation for TxReconciliationTracker's data structure.
Transaction reconciliation is a way for nodes to efficiently announce transactions.
bool IsPeerRegistered(NodeId peer_id) const
Check if a peer is registered to reconcile transactions with us.
ReconciliationRegisterResult RegisterPeer(NodeId peer_id, bool is_peer_inbound, uint32_t peer_recon_version, uint64_t remote_salt)
Step 0.
const std::unique_ptr< Impl > m_impl
TxReconciliationTracker(uint32_t recon_version)
uint64_t PreRegisterPeer(NodeId peer_id)
Step 0.
void ForgetPeer(NodeId peer_id)
Attempts to forget txreconciliation-related state of the peer (if we previously stored any).
int64_t NodeId
Definition: net.h:94
ReconciliationRegisterResult
static constexpr uint32_t TXRECONCILIATION_VERSION
Supported transaction reconciliation protocol version.
static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE
Whether transaction reconciliation protocol should be enabled by default.