Additional explanation for ordering of commit/insert_block

This commit is contained in:
Tomasz Drwięga 2016-03-10 11:16:54 +01:00
parent 204d31a056
commit 6d0578e19c

View File

@ -396,7 +396,8 @@ impl<V> Client<V> where V: Verifier {
.commit(header.number(), &header.hash(), ancient) .commit(header.number(), &header.hash(), ancient)
.expect("State DB commit failed."); .expect("State DB commit failed.");
// And update the chain // And update the chain after commit to prevent race conditions
// (when something is in chain but you are not able to fetch details)
self.chain.write().unwrap() self.chain.write().unwrap()
.insert_block(&block.bytes, receipts); .insert_block(&block.bytes, receipts);