Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missed TestReorgReInsert to blockchain tests #1202

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions core/test_blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ var tests = []ChainTest{
"EmptyBlocks",
TestEmptyBlocks,
},
{
"ReorgReInsert",
TestReorgReInsert,
},
{
"AcceptBlockIdenticalStateRoot",
TestAcceptBlockIdenticalStateRoot,
Expand Down Expand Up @@ -867,9 +871,6 @@ func TestReorgReInsert(t *testing.T, create func(db ethdb.Database, gspec *Genes
key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
addr2 = crypto.PubkeyToAddress(key2.PublicKey)
// We use two separate databases since GenerateChain commits the state roots to its underlying
// database.
genDB = rawdb.NewMemoryDatabase()
chainDB = rawdb.NewMemoryDatabase()
)

Expand All @@ -879,7 +880,6 @@ func TestReorgReInsert(t *testing.T, create func(db ethdb.Database, gspec *Genes
Config: &params.ChainConfig{HomesteadBlock: new(big.Int)},
Alloc: GenesisAlloc{addr1: {Balance: genesisBalance}},
}
genesis := gspec.ToBlock()

blockchain, err := create(chainDB, gspec, common.Hash{})
if err != nil {
Expand All @@ -889,7 +889,7 @@ func TestReorgReInsert(t *testing.T, create func(db ethdb.Database, gspec *Genes

signer := types.HomesteadSigner{}
numBlocks := 3
chain, _, err := GenerateChain(gspec.Config, genesis, blockchain.engine, genDB, numBlocks, 10, func(i int, gen *BlockGen) {
_, chain, _, err := GenerateChainWithGenesis(gspec, blockchain.engine, numBlocks, 10, func(i int, gen *BlockGen) {
// Generate a transaction to create a unique block
tx, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr1), addr2, big.NewInt(10000), params.TxGas, nil, nil), signer, key1)
gen.AddTx(tx)
Expand Down Expand Up @@ -1375,8 +1375,6 @@ func TestInsertChainValidBlockFee(t *testing.T, create func(db ethdb.Database, g
key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
addr2 = crypto.PubkeyToAddress(key2.PublicKey)
// We use two separate databases since GenerateChain commits the state roots to its underlying
// database.
chainDB = rawdb.NewMemoryDatabase()
)

Expand Down
Loading