|
|
|
@ -1359,7 +1359,7 @@ void PeerManager::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_
|
|
|
|
|
LockAssertion lock(::cs_main);
|
|
|
|
|
|
|
|
|
|
// TODO: Avoid the repeated-serialization here
|
|
|
|
|
if (pnode->nVersion < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect)
|
|
|
|
|
if (pnode->GetCommonVersion() < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect)
|
|
|
|
|
return;
|
|
|
|
|
ProcessBlockAvailability(pnode->GetId());
|
|
|
|
|
CNodeState &state = *State(pnode->GetId());
|
|
|
|
@ -2408,7 +2408,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|
|
|
|
pfrom.SetCommonVersion(greatest_common_version);
|
|
|
|
|
pfrom.nVersion = nVersion;
|
|
|
|
|
|
|
|
|
|
if (nVersion >= WTXID_RELAY_VERSION) {
|
|
|
|
|
if (greatest_common_version >= WTXID_RELAY_VERSION) {
|
|
|
|
|
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::WTXIDRELAY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2500,7 +2500,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|
|
|
|
AddTimeData(pfrom.addr, nTimeOffset);
|
|
|
|
|
|
|
|
|
|
// If the peer is old enough to have the old alert system, send it the final alert.
|
|
|
|
|
if (pfrom.nVersion <= 70012) {
|
|
|
|
|
if (greatest_common_version <= 70012) {
|
|
|
|
|
CDataStream finalAlert(ParseHex("60010000000000000000000000ffffff7f00000000ffffff7ffeffff7f01ffffff7f00000000ffffff7f00ffffff7f002f555247454e543a20416c657274206b657920636f6d70726f6d697365642c2075706772616465207265717569726564004630440220653febd6410f470f6bae11cad19c48413becb1ac2c17f908fd0fd53bdc3abd5202206d0e9c96fe88d4a0f01ed9dedae2b6f9e00da94cad0fecaae66ecf689bf71b50"), SER_NETWORK, PROTOCOL_VERSION);
|
|
|
|
|
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make("alert", finalAlert));
|
|
|
|
|
}
|
|
|
|
@ -2533,14 +2533,14 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|
|
|
|
pfrom.m_tx_relay == nullptr ? "block-relay" : "full-relay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pfrom.nVersion >= SENDHEADERS_VERSION) {
|
|
|
|
|
if (pfrom.GetCommonVersion() >= SENDHEADERS_VERSION) {
|
|
|
|
|
// Tell our peer we prefer to receive headers rather than inv's
|
|
|
|
|
// We send this to non-NODE NETWORK peers as well, because even
|
|
|
|
|
// non-NODE NETWORK peers can announce blocks (such as pruning
|
|
|
|
|
// nodes)
|
|
|
|
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::SENDHEADERS));
|
|
|
|
|
}
|
|
|
|
|
if (pfrom.nVersion >= SHORT_IDS_BLOCKS_VERSION) {
|
|
|
|
|
if (pfrom.GetCommonVersion() >= SHORT_IDS_BLOCKS_VERSION) {
|
|
|
|
|
// Tell our peer we are willing to provide version 1 or 2 cmpctblocks
|
|
|
|
|
// However, we do not request new block announcements using
|
|
|
|
|
// cmpctblock messages.
|
|
|
|
@ -2566,7 +2566,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|
|
|
|
pfrom.fDisconnect = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (pfrom.nVersion >= WTXID_RELAY_VERSION) {
|
|
|
|
|
if (pfrom.GetCommonVersion() >= WTXID_RELAY_VERSION) {
|
|
|
|
|
LOCK(cs_main);
|
|
|
|
|
if (!State(pfrom.GetId())->m_wtxid_relay) {
|
|
|
|
|
State(pfrom.GetId())->m_wtxid_relay = true;
|
|
|
|
@ -3581,8 +3581,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msg_type == NetMsgType::PING) {
|
|
|
|
|
if (pfrom.nVersion > BIP0031_VERSION)
|
|
|
|
|
{
|
|
|
|
|
if (pfrom.GetCommonVersion() > BIP0031_VERSION) {
|
|
|
|
|
uint64_t nonce = 0;
|
|
|
|
|
vRecv >> nonce;
|
|
|
|
|
// Echo the message back with the nonce. This allows for two useful features:
|
|
|
|
@ -4100,7 +4099,7 @@ bool PeerManager::SendMessages(CNode* pto)
|
|
|
|
|
}
|
|
|
|
|
pto->fPingQueued = false;
|
|
|
|
|
pto->m_ping_start = GetTime<std::chrono::microseconds>();
|
|
|
|
|
if (pto->nVersion > BIP0031_VERSION) {
|
|
|
|
|
if (pto->GetCommonVersion() > BIP0031_VERSION) {
|
|
|
|
|
pto->nPingNonceSent = nonce;
|
|
|
|
|
m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::PING, nonce));
|
|
|
|
|
} else {
|
|
|
|
@ -4639,7 +4638,7 @@ bool PeerManager::SendMessages(CNode* pto)
|
|
|
|
|
//
|
|
|
|
|
// Message: feefilter
|
|
|
|
|
//
|
|
|
|
|
if (pto->m_tx_relay != nullptr && pto->nVersion >= FEEFILTER_VERSION && gArgs.GetBoolArg("-feefilter", DEFAULT_FEEFILTER) &&
|
|
|
|
|
if (pto->m_tx_relay != nullptr && pto->GetCommonVersion() >= FEEFILTER_VERSION && gArgs.GetBoolArg("-feefilter", DEFAULT_FEEFILTER) &&
|
|
|
|
|
!pto->HasPermission(PF_FORCERELAY) // peers with the forcerelay permission should not filter txs to us
|
|
|
|
|
) {
|
|
|
|
|
CAmount currentFilter = m_mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
|
|
|
|
|