testHeaderChainImport tries to process a chain of header, writing them into the database if successful.
(chain []*types.Header, blockchain *BlockChain)
| 139 | // testHeaderChainImport tries to process a chain of header, writing them into |
| 140 | // the database if successful. |
| 141 | func testHeaderChainImport(chain []*types.Header, blockchain *BlockChain) error { |
| 142 | for _, header := range chain { |
| 143 | // Try and validate the header |
| 144 | if err := blockchain.engine.VerifyHeader(blockchain, header, false, nil); err != nil { |
| 145 | return err |
| 146 | } |
| 147 | // Manually insert the header into the database, but don't reorganise (allows subsequent testing) |
| 148 | blockchain.mu.Lock() |
| 149 | rawdb.WriteHeader(blockchain.db, header) |
| 150 | blockchain.mu.Unlock() |
| 151 | } |
| 152 | return nil |
| 153 | } |
| 154 | |
| 155 | func TestLastBlock(t *testing.T) { |
| 156 | db := database.NewMemDatabase() |
nothing calls this directly
no test coverage detected