mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
[net processing] Simplify sendcmpct
processing
nCMPCTBLOCKVersion must always be 2 when processing.
This commit is contained in:
parent
42882fc8fc
commit
25edb2b7bd
1 changed files with 3 additions and 5 deletions
|
@ -2891,17 +2891,15 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||
// fProvidesHeaderAndIDs is used to "lock in" version of compact blocks we send (fWantsCmpctWitness)
|
||||
if (!State(pfrom.GetId())->fProvidesHeaderAndIDs) {
|
||||
State(pfrom.GetId())->fProvidesHeaderAndIDs = true;
|
||||
State(pfrom.GetId())->fWantsCmpctWitness = nCMPCTBLOCKVersion == 2;
|
||||
State(pfrom.GetId())->fWantsCmpctWitness = true;
|
||||
}
|
||||
if (State(pfrom.GetId())->fWantsCmpctWitness == (nCMPCTBLOCKVersion == 2)) { // ignore later version announces
|
||||
if (State(pfrom.GetId())->fWantsCmpctWitness) {
|
||||
State(pfrom.GetId())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK;
|
||||
// save whether peer selects us as BIP152 high-bandwidth peer
|
||||
// (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
|
||||
pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK;
|
||||
}
|
||||
if (!State(pfrom.GetId())->fSupportsDesiredCmpctVersion) {
|
||||
State(pfrom.GetId())->fSupportsDesiredCmpctVersion = (nCMPCTBLOCKVersion == 2);
|
||||
}
|
||||
State(pfrom.GetId())->fSupportsDesiredCmpctVersion = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue