Skip to content

Commit

Permalink
Make nStartingHeight atomic
Browse files Browse the repository at this point in the history
zcash: cherry picked from commit 96f42d8
zcash: bitcoin/bitcoin#9708
  • Loading branch information
TheBlueMatt authored and str4d committed Apr 1, 2021
1 parent c2c43e3 commit 651c46a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5754,8 +5754,11 @@ bool static ProcessMessage(const CChainParams& chainparams, CNode* pfrom, string
vRecv >> LIMITED_STRING(pfrom->strSubVer, MAX_SUBVERSION_LENGTH);
pfrom->cleanSubVer = SanitizeString(pfrom->strSubVer, SAFE_CHARS_SUBVERSION);
}
if (!vRecv.empty())
vRecv >> pfrom->nStartingHeight;
if (!vRecv.empty()) {
int nStartingHeight;
vRecv >> nStartingHeight;
pfrom->nStartingHeight = nStartingHeight;
}
if (!vRecv.empty())
vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message
else
Expand Down
2 changes: 1 addition & 1 deletion src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class CNode

public:
uint256 hashContinue;
int nStartingHeight;
std::atomic<int> nStartingHeight;

// flood relay
std::vector<CAddress> vAddrToSend;
Expand Down

0 comments on commit 651c46a

Please sign in to comment.