mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
bitcoind rpc check should take main locks for mapBlockIndex, check for key
This commit is contained in:
parent
3634aaf98f
commit
ba8d498559
1 changed files with 13 additions and 7 deletions
|
|
@ -2220,9 +2220,12 @@ bool BitcoindRPCCheck(const bool init)
|
||||||
pblocktree->ReadInvalidBlockQueue(vblocksToReconsider);
|
pblocktree->ReadInvalidBlockQueue(vblocksToReconsider);
|
||||||
std::vector<uint256> vblocksToReconsiderAgain;
|
std::vector<uint256> vblocksToReconsiderAgain;
|
||||||
BOOST_FOREACH(uint256& blockhash, vblocksToReconsider) {
|
BOOST_FOREACH(uint256& blockhash, vblocksToReconsider) {
|
||||||
CBlockIndex* pblockindex = mapBlockIndex[blockhash];
|
LOCK(cs_main);
|
||||||
if ((pblockindex->nStatus & BLOCK_FAILED_MASK)) {
|
if (mapBlockIndex.count(blockhash)) {
|
||||||
vblocksToReconsiderAgain.push_back(blockhash);
|
CBlockIndex* pblockindex = mapBlockIndex[blockhash];
|
||||||
|
if ((pblockindex->nStatus & BLOCK_FAILED_MASK)) {
|
||||||
|
vblocksToReconsiderAgain.push_back(blockhash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vblocksToReconsider = vblocksToReconsiderAgain;
|
vblocksToReconsider = vblocksToReconsiderAgain;
|
||||||
|
|
@ -2312,11 +2315,14 @@ bool BitcoindRPCCheck(const bool init)
|
||||||
|
|
||||||
//Now to clear out now-valid blocks
|
//Now to clear out now-valid blocks
|
||||||
BOOST_FOREACH(const uint256& blockhash, vblocksToReconsider) {
|
BOOST_FOREACH(const uint256& blockhash, vblocksToReconsider) {
|
||||||
CBlockIndex* pblockindex = mapBlockIndex[blockhash];
|
LOCK(cs_main);
|
||||||
|
if (mapBlockIndex.count(blockhash)) {
|
||||||
|
CBlockIndex* pblockindex = mapBlockIndex[blockhash];
|
||||||
|
|
||||||
//Marked as invalid still, put back into queue
|
//Marked as invalid still, put back into queue
|
||||||
if((pblockindex->nStatus & BLOCK_FAILED_MASK)) {
|
if((pblockindex->nStatus & BLOCK_FAILED_MASK)) {
|
||||||
vblocksToReconsiderAgain.push_back(blockhash);
|
vblocksToReconsiderAgain.push_back(blockhash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue