From 6481c9ad594cca21168edd167ae268a1c24c7008 Mon Sep 17 00:00:00 2001 From: int88 Date: Thu, 4 Aug 2022 15:06:20 +0800 Subject: [PATCH 1/3] core: minor fix --- core/blockchain_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/blockchain_test.go b/core/blockchain_test.go index b42f572b1290..9f00b00b9b05 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -760,7 +760,7 @@ func TestFastVsFullChains(t *testing.T) { } } // If the block number is a multiple of 5, add a few bonus uncles to the block - if i%5 == 5 { + if i%5 == 0 { block.AddUncle(&types.Header{ParentHash: block.PrevBlock(i - 1).Hash(), Number: big.NewInt(int64(i - 1))}) } }) From d7705da593b7ea9d1b0577687a9f25422ececf31 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 4 Aug 2022 11:04:13 +0200 Subject: [PATCH 2/3] Update blockchain_test.go --- core/blockchain_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 9f00b00b9b05..0e21cc69849e 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -759,8 +759,8 @@ func TestFastVsFullChains(t *testing.T) { block.AddTx(tx) } } - // If the block number is a multiple of 5, add a few bonus uncles to the block - if i%5 == 0 { + // If the block number is a multiple of 5, add an uncle to the block + if i%5 == 4 { block.AddUncle(&types.Header{ParentHash: block.PrevBlock(i - 1).Hash(), Number: big.NewInt(int64(i - 1))}) } }) From c4c6d7e14c9ef4b7bdd92b75e8c4cf0cbb54bd35 Mon Sep 17 00:00:00 2001 From: int88 Date: Thu, 4 Aug 2022 18:43:43 +0800 Subject: [PATCH 3/3] fix panic --- core/blockchain_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 0e21cc69849e..8ee4c252e3a4 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -761,7 +761,7 @@ func TestFastVsFullChains(t *testing.T) { } // If the block number is a multiple of 5, add an uncle to the block if i%5 == 4 { - block.AddUncle(&types.Header{ParentHash: block.PrevBlock(i - 1).Hash(), Number: big.NewInt(int64(i - 1))}) + block.AddUncle(&types.Header{ParentHash: block.PrevBlock(i - 2).Hash(), Number: big.NewInt(int64(i))}) } }) // Import the chain as an archive node for the comparison baseline