Make nStartingHeight atomic

zcash: cherry picked from commit 96f42d8a12871b8d5c4e31fd27d8135f97c6b3e0
zcash: https://github.com/bitcoin/bitcoin/pull/9708
This commit is contained in:
Matt Corallo 2017-02-06 12:15:30 -05:00 committed by Jack Grigg
parent c2c43e39b2
commit 651c46a4b3
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -330,7 +330,7 @@ protected:
public:
uint256 hashContinue;
int nStartingHeight;
std::atomic<int> nStartingHeight;
// flood relay
std::vector<CAddress> vAddrToSend;