Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,593 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::INV) { | ||||
pindexBestHeader->nHeight, hash.ToString(), | pindexBestHeader->nHeight, hash.ToString(), | ||||
pfrom->GetId()); | pfrom->GetId()); | ||||
} | } | ||||
} else { | } else { | ||||
pfrom->AddInventoryKnown(inv); | pfrom->AddInventoryKnown(inv); | ||||
if (fBlocksOnly) { | if (fBlocksOnly) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"transaction (%s) inv sent in violation of " | "transaction (%s) inv sent in violation of " | ||||
"protocol peer=%d\n", | "protocol, disconnecting peer=%d\n", | ||||
inv.hash.ToString(), pfrom->GetId()); | inv.hash.ToString(), pfrom->GetId()); | ||||
pfrom->fDisconnect = true; | |||||
return true; | |||||
} else if (!fAlreadyHave && !fImporting && !fReindex && | } else if (!fAlreadyHave && !fImporting && !fReindex && | ||||
!::ChainstateActive().IsInitialBlockDownload()) { | !::ChainstateActive().IsInitialBlockDownload()) { | ||||
RequestTx(State(pfrom->GetId()), TxId(inv.hash), | RequestTx(State(pfrom->GetId()), TxId(inv.hash), | ||||
current_time); | current_time); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::GETHEADERS) { | ||||
connman->PushMessage(pfrom, | connman->PushMessage(pfrom, | ||||
msgMaker.Make(NetMsgType::HEADERS, vHeaders)); | msgMaker.Make(NetMsgType::HEADERS, vHeaders)); | ||||
return true; | return true; | ||||
} | } | ||||
if (strCommand == NetMsgType::TX) { | if (strCommand == NetMsgType::TX) { | ||||
// Stop processing the transaction early if | // Stop processing the transaction early if | ||||
// We are in blocks only mode and peer is either not whitelisted or | // We are in blocks only mode and peer is either not whitelisted or | ||||
// whitelistrelay is off | // whitelistrelay is off or if this peer is supposed to be a | ||||
if (!g_relay_txes && !pfrom->HasPermission(PF_RELAY)) { | // block-relay-only peer | ||||
if ((!g_relay_txes && !pfrom->HasPermission(PF_RELAY)) || | |||||
(pfrom->m_tx_relay == nullptr)) { | |||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"transaction sent in violation of protocol peer=%d\n", | "transaction sent in violation of protocol peer=%d\n", | ||||
pfrom->GetId()); | pfrom->GetId()); | ||||
pfrom->fDisconnect = true; | |||||
return true; | return true; | ||||
} | } | ||||
CTransactionRef ptx; | CTransactionRef ptx; | ||||
vRecv >> ptx; | vRecv >> ptx; | ||||
const CTransaction &tx = *ptx; | const CTransaction &tx = *ptx; | ||||
const TxId &txid = tx.GetId(); | const TxId &txid = tx.GetId(); | ||||
▲ Show 20 Lines • Show All 2,050 Lines • Show Last 20 Lines |