Bitcoin Core  27.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 uint32_t TXRECONCILIATION_VERSION{1};
16 
18  NOT_FOUND,
19  SUCCESS,
22 };
23 
52 {
53 private:
54  class Impl;
55  const std::unique_ptr<Impl> m_impl;
56 
57 public:
58  explicit TxReconciliationTracker(uint32_t recon_version);
60 
68  uint64_t PreRegisterPeer(NodeId peer_id);
69 
74  ReconciliationRegisterResult RegisterPeer(NodeId peer_id, bool is_peer_inbound,
75  uint32_t peer_recon_version, uint64_t remote_salt);
76 
81  void ForgetPeer(NodeId peer_id);
82 
86  bool IsPeerRegistered(NodeId peer_id) const;
87 };
88 
89 #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:97
ReconciliationRegisterResult
static constexpr uint32_t TXRECONCILIATION_VERSION
Supported transaction reconciliation protocol version.