(t *testing.T)
| 153 | } |
| 154 | |
| 155 | func TestLastBlock(t *testing.T) { |
| 156 | db := database.NewMemDatabase() |
| 157 | blockchain, err := newCanonical(fakeDpor(db), 0, db) |
| 158 | if err != nil { |
| 159 | t.Fatalf("failed to create pristine chain: %v", err) |
| 160 | } |
| 161 | defer blockchain.Stop() |
| 162 | |
| 163 | blocks := makeBlockChain(blockchain.CurrentBlock(), 1, fakeDpor(db), blockchain.db, 0) |
| 164 | if _, err := blockchain.InsertChain(blocks); err != nil { |
| 165 | t.Fatalf("Failed to insert block: %v", err) |
| 166 | } |
| 167 | if blocks[len(blocks)-1].Hash() != rawdb.ReadHeadBlockHash(blockchain.db) { |
| 168 | t.Fatalf("Write/Get HeadBlockHash failed") |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | // Tests that given a starting canonical chain of a given size, it can be extended |
| 173 | // with various length chains. |
nothing calls this directly
no test coverage detected