You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once we received a reconciliation announcement support
message from a peer and it doesn't violate our protocol,
we store the negotiated parameters which will be used
for future reconciliations.
// Received from a peer demonstrating readiness to announce transactions via reconciliations.
3481
+
// This feature negotiation must happen between VERSION and VERACK to avoid relay problems
3482
+
// from switching announcement protocols after the connection is up.
3483
+
if (msg_type == NetMsgType::SENDTXRCNCL) {
3484
+
if (!m_txreconciliation) {
3485
+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "sendtxrcncl from peer=%d ignored, as our node does not have txreconciliation enabled\n", pfrom.GetId());
3486
+
return;
3487
+
}
3488
+
3489
+
if (pfrom.fSuccessfullyConnected) {
3490
+
// Disconnect peers that send a SENDTXRCNCL message after VERACK.
3491
+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "sendtxrcncl received after verack from peer=%d; disconnecting\n", pfrom.GetId());
3492
+
pfrom.fDisconnect = true;
3493
+
return;
3494
+
}
3495
+
3496
+
if (!peer->GetTxRelay()) {
3497
+
// Disconnect peers that send a SENDTXRCNCL message even though we indicated we don't
3498
+
// support transaction relay.
3499
+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "sendtxrcncl received from peer=%d to which we indicated no tx relay; disconnecting\n", pfrom.GetId());
if (m_txreconciliation->IsPeerRegistered(pfrom.GetId())) {
3510
+
// A peer is already registered, meaning we already received SENDTXRCNCL from them.
3511
+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "txreconciliation protocol violation from peer=%d (sendtxrcncl received from already registered peer); disconnecting\n", pfrom.GetId());
3512
+
pfrom.fDisconnect = true;
3513
+
return;
3514
+
}
3515
+
3516
+
const ReconciliationRegisterResult result = m_txreconciliation->RegisterPeer(pfrom.GetId(), pfrom.IsInboundConn(),
3517
+
is_peer_initiator, is_peer_responder,
3518
+
peer_txreconcl_version,
3519
+
remote_salt);
3520
+
3521
+
// If it's a protocol violation, disconnect.
3522
+
// If the peer was not found (but something unexpected happened) or it was registered,
3523
+
// nothing to be done.
3524
+
if (result == ReconciliationRegisterResult::PROTOCOL_VIOLATION) {
3525
+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "txreconciliation protocol violation from peer=%d; disconnecting\n", pfrom.GetId());
3526
+
pfrom.fDisconnect = true;
3527
+
return;
3528
+
}
3529
+
return;
3530
+
}
3531
+
3480
3532
if (!pfrom.fSuccessfullyConnected) {
3481
3533
LogPrint(BCLog::NET, "Unsupported message \"%s\" prior to verack from peer=%d\n", SanitizeString(msg_type), pfrom.GetId());
0 commit comments