11#include <unordered_map>
35class TxReconciliationState
105 if (std::holds_alternative<TxReconciliationState>(
recon_state->second)) {
143 std::holds_alternative<TxReconciliationState>(
recon_state->second));
#define Assume(val)
Assume is the identity function.
uint64_t rand64() noexcept
Generate a random 64-bit integer.
A writer stream (for serialization) that computes a 256-bit hash.
Actual implementation for TxReconciliationTracker's data structure.
uint64_t PreRegisterPeer(NodeId peer_id) EXCLUSIVE_LOCKS_REQUIRED(!m_txreconciliation_mutex)
std::unordered_map< NodeId, std::variant< uint64_t, TxReconciliationState > > m_states GUARDED_BY(m_txreconciliation_mutex)
Keeps track of txreconciliation states of eligible peers.
Mutex m_txreconciliation_mutex
void ForgetPeer(NodeId peer_id) EXCLUSIVE_LOCKS_REQUIRED(!m_txreconciliation_mutex)
bool IsPeerRegistered(NodeId peer_id) const EXCLUSIVE_LOCKS_REQUIRED(!m_txreconciliation_mutex)
Impl(uint32_t recon_version)
ReconciliationRegisterResult RegisterPeer(NodeId peer_id, bool is_peer_inbound, uint32_t peer_recon_version, uint64_t remote_salt) EXCLUSIVE_LOCKS_REQUIRED(!m_txreconciliation_mutex)
Transaction reconciliation is a way for nodes to efficiently announce transactions.
~TxReconciliationTracker()
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).
HashWriter TaggedHash(const std::string &tag)
Return a HashWriter primed for tagged hashes (as specified in BIP 340).
#define LogDebug(category,...)
#define AssertLockNotHeld(cs)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
ReconciliationRegisterResult
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.