aboutsummaryrefslogtreecommitdiffstats
path: root/core/database_util.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2016-07-26 22:37:04 +0800
committerBas van Kervel <bas@ethdev.com>2016-08-16 21:21:22 +0800
commitbb8059f6aa86d1052d7c2dd75a6985982cb278f4 (patch)
tree44c57f98592518652f9791655be98c75fc198760 /core/database_util.go
parent4c2cc32f2e279baa3059603b8c8a4329f31606f6 (diff)
downloadgo-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.tar
go-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.tar.gz
go-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.tar.bz2
go-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.tar.lz
go-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.tar.xz
go-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.tar.zst
go-tangerine-bb8059f6aa86d1052d7c2dd75a6985982cb278f4.zip
core: ensure the canonical block is written before the canonical hash is set
Diffstat (limited to 'core/database_util.go')
-rw-r--r--core/database_util.go6
1 files changed, 5 insertions, 1 deletions
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)