diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-10-05 22:51:06 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-10-05 23:00:59 +0800 |
commit | 20ab29f8855982f28c6887743c737531065fa792 (patch) | |
tree | 745743d196b406563144bb62e7bb8a1cccbff092 /core/blockchain_test.go | |
parent | 5b34fa538e54320778314081df97da561f7c6314 (diff) | |
download | go-tangerine-20ab29f8855982f28c6887743c737531065fa792.tar.gz go-tangerine-20ab29f8855982f28c6887743c737531065fa792.tar.zst go-tangerine-20ab29f8855982f28c6887743c737531065fa792.zip |
core: fixed head write on block insertion
Due to a rebase this probably got overlooked / ignored. This fixes the
issue of a block insertion never writing the last block.
Diffstat (limited to 'core/blockchain_test.go')
-rw-r--r-- | core/blockchain_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/blockchain_test.go b/core/blockchain_test.go index e034417ce..13971ccba 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -153,6 +153,19 @@ func insertChain(done chan bool, blockchain *BlockChain, chain types.Blocks, t * done <- true } +func TestLastBlock(t *testing.T) { + db, err := ethdb.NewMemDatabase() + if err != nil { + t.Fatal("Failed to create db:", err) + } + bchain := theBlockChain(db, t) + block := makeChain(bchain.CurrentBlock(), 1, db, 0)[0] + bchain.insert(block) + if block.Hash() != GetHeadBlockHash(db) { + t.Errorf("Write/Get HeadBlockHash failed") + } +} + func TestExtendCanonical(t *testing.T) { CanonicalLength := 5 db, err := ethdb.NewMemDatabase() |