From bb8059f6aa86d1052d7c2dd75a6985982cb278f4 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Tue, 26 Jul 2016 16:37:04 +0200 Subject: core: ensure the canonical block is written before the canonical hash is set --- core/database_util.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'core/database_util.go') diff --git a/core/database_util.go b/core/database_util.go index 1529d7369..5f9afe6ba 100644 --- a/core/database_util.go +++ b/core/database_util.go @@ -204,7 +204,11 @@ func GetTd(db ethdb.Database, hash common.Hash, number uint64) *big.Int { } // GetBlock retrieves an entire block corresponding to the hash, assembling it -// back from the stored header and body. +// back from the stored header and body. If either the header or body could not +// be retrieved nil is returned. +// +// Note, due to concurrent download of header and block body the header and thus +// canonical hash can be stored in the database but the body data not (yet). func GetBlock(db ethdb.Database, hash common.Hash, number uint64) *types.Block { // Retrieve the block header and body contents header := GetHeader(db, hash, number) -- cgit