|
|
|
@ -18,7 +18,6 @@ package light |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"context" |
|
|
|
|
"fmt" |
|
|
|
|
"math/big" |
|
|
|
|
"testing" |
|
|
|
|
|
|
|
|
@ -98,10 +97,7 @@ func testFork(t *testing.T, LightChain *LightChain, i, n int, comparator func(td |
|
|
|
|
t.Errorf("chain content mismatch at %d: have hash %v, want hash %v", i, hash2, hash1) |
|
|
|
|
} |
|
|
|
|
// Extend the newly created chain
|
|
|
|
|
var ( |
|
|
|
|
headerChainB []*types.Header |
|
|
|
|
) |
|
|
|
|
headerChainB = makeHeaderChain(LightChain2.CurrentHeader(), n, db, forkSeed) |
|
|
|
|
headerChainB := makeHeaderChain(LightChain2.CurrentHeader(), n, db, forkSeed) |
|
|
|
|
if _, err := LightChain2.InsertHeaderChain(headerChainB, 1); err != nil { |
|
|
|
|
t.Fatalf("failed to insert forking chain: %v", err) |
|
|
|
|
} |
|
|
|
@ -117,13 +113,6 @@ func testFork(t *testing.T, LightChain *LightChain, i, n int, comparator func(td |
|
|
|
|
comparator(tdPre, tdPost) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func printChain(bc *LightChain) { |
|
|
|
|
for i := bc.CurrentHeader().Number.Uint64(); i > 0; i-- { |
|
|
|
|
b := bc.GetHeaderByNumber(uint64(i)) |
|
|
|
|
fmt.Printf("\t%x %v\n", b.Hash(), b.Difficulty) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// testHeaderChainImport tries to process a chain of header, writing them into
|
|
|
|
|
// the database if successful.
|
|
|
|
|
func testHeaderChainImport(chain []*types.Header, lightchain *LightChain) error { |
|
|
|
|