Bitcoin Core 28.99.0
P2P Digital Currency
|
Transaction reconciliation is a way for nodes to efficiently announce transactions. More...
#include <txreconciliation.h>
Classes | |
class | Impl |
Actual implementation for TxReconciliationTracker's data structure. More... | |
Public Member Functions | |
TxReconciliationTracker (uint32_t recon_version) | |
~TxReconciliationTracker () | |
uint64_t | PreRegisterPeer (NodeId peer_id) |
Step 0. More... | |
ReconciliationRegisterResult | RegisterPeer (NodeId peer_id, bool is_peer_inbound, uint32_t peer_recon_version, uint64_t remote_salt) |
Step 0. More... | |
void | ForgetPeer (NodeId peer_id) |
Attempts to forget txreconciliation-related state of the peer (if we previously stored any). More... | |
bool | IsPeerRegistered (NodeId peer_id) const |
Check if a peer is registered to reconcile transactions with us. More... | |
Private Attributes | |
const std::unique_ptr< Impl > | m_impl |
Transaction reconciliation is a way for nodes to efficiently announce transactions.
This object keeps track of all txreconciliation-related communications with the peers. The high-level protocol is: 0. Txreconciliation protocol handshake.
SUCCESS. The initiator knows full symmetrical difference and can request what the initiator is missing and announce to the peer what the peer is missing.
FAILURE. The initiator notifies the peer about the failure and announces all transactions from the corresponding set. Once the peer received the failure notification, the peer announces all transactions from their set.
This is a modification of the Erlay protocol (https://arxiv.org/abs/1905.10518) with two changes (sketch extensions instead of bisections, and an extra INV exchange round), both are motivated in BIP-330.
Definition at line 51 of file txreconciliation.h.
|
explicit |
Definition at line 147 of file txreconciliation.cpp.
|
default |
void TxReconciliationTracker::ForgetPeer | ( | NodeId | peer_id | ) |
Attempts to forget txreconciliation-related state of the peer (if we previously stored any).
After this, we won't be able to reconcile transactions with the peer.
Definition at line 162 of file txreconciliation.cpp.
bool TxReconciliationTracker::IsPeerRegistered | ( | NodeId | peer_id | ) | const |
Check if a peer is registered to reconcile transactions with us.
Definition at line 167 of file txreconciliation.cpp.
uint64_t TxReconciliationTracker::PreRegisterPeer | ( | NodeId | peer_id | ) |
Step 0.
Generates initial part of the state (salt) required to reconcile txs with the peer. The salt is used for short ID computation required for txreconciliation. The function returns the salt. A peer can't participate in future txreconciliations without this call. This function must be called only once per peer.
Definition at line 151 of file txreconciliation.cpp.
ReconciliationRegisterResult TxReconciliationTracker::RegisterPeer | ( | NodeId | peer_id, |
bool | is_peer_inbound, | ||
uint32_t | peer_recon_version, | ||
uint64_t | remote_salt | ||
) |
Step 0.
Once the peer agreed to reconcile txs with us, generate the state required to track ongoing reconciliations. Must be called only after pre-registering the peer and only once.
Definition at line 156 of file txreconciliation.cpp.
|
private |
Definition at line 55 of file txreconciliation.h.