Merge pull request #31 from braydonf/txwait

Wait to be able to query transactions from the mempool.
This commit is contained in:
Chris Kleeschulte 2015-07-16 17:10:04 -04:00
commit e9cc3b774e
1 changed files with 12 additions and 0 deletions

View File

@ -193,13 +193,25 @@ async_blocks_ready(uv_work_t *req) {
CBlockIndex* tip = chainActive.Tip();
uint256 tipHash = tip->GetBlockHash();
// Wait to be able to query for blocks by hash
while(mapBlockIndex.count(tipHash) == 0) {
usleep(1E6);
}
// Wait for chainActive to be able to get the hash
// for the genesis block for querying blocks by height
while(chainActive[0] == NULL) {
usleep(1E6);
}
// Wait until we can get a lock on cs_main
// And therefore ready to be able to quickly
// query for transactions from the mempool.
LOCK(cs_main);
{
return;
}
}
static void