MCPcopy Create free account
hub / github.com/CPChain/chain / TestReorgShortBlocks

Function TestReorgShortBlocks

core/blockchain_test.go:308–322  ·  view source on GitHub ↗

Tests that reorganising a long difficult chain after a short easy one overwrites the canonical numbers and links in the database. func TestReorgLongBlocks(t *testing.T) { testReorg(t, []int64{0, 0, -9}, []int64{0, 0, 0, -9}, 1) } Tests that reorganising a short difficult chain after a long easy one

(t *testing.T)

Source from the content-addressed store, hash-verified

306// Tests that reorganising a short difficult chain after a long easy one
307// overwrites the canonical numbers and links in the database.
308func TestReorgShortBlocks(t *testing.T) {
309 t.Skip("=== Diff TestReorgShortBlocks failed to insert easy chain: invalid signer list on checkpoint block")
310 // Create a long easy chain vs. a short heavy one. Due to difficulty adjustment
311 // we need a fairly long chain of blocks with different difficulties for a short
312 // one to become heavyer than a long one. The 96 is an empirical value.
313 easy := make([]int64, 96)
314 for i := 0; i < len(easy); i++ {
315 easy[i] = 60
316 }
317 diff := make([]int64, len(easy)-1)
318 for i := 0; i < len(diff); i++ {
319 diff[i] = -9
320 }
321 testReorg(t, easy, diff, 12615120)
322}
323
324func testReorg(t *testing.T, first, second []int64, td int64) {
325 // Create a pristine chain and database

Callers

nothing calls this directly

Calls 1

testReorgFunction · 0.85

Tested by

no test coverage detected