all: protect self-mined block during reorg (#17656)
This commit is contained in:
		
				
					committed by
					
						 Péter Szilágyi
						Péter Szilágyi
					
				
			
			
				
	
			
			
			
						parent
						
							f89dce0126
						
					
				
				
					commit
					d6254f827b
				
			| @@ -42,7 +42,7 @@ func TestHeaderVerification(t *testing.T) { | ||||
| 		headers[i] = block.Header() | ||||
| 	} | ||||
| 	// Run the header checker for blocks one-by-one, checking for both valid and invalid nonces | ||||
| 	chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFaker(), vm.Config{}) | ||||
| 	chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFaker(), vm.Config{}, nil) | ||||
| 	defer chain.Stop() | ||||
|  | ||||
| 	for i := 0; i < len(blocks); i++ { | ||||
| @@ -106,11 +106,11 @@ func testHeaderConcurrentVerification(t *testing.T, threads int) { | ||||
| 		var results <-chan error | ||||
|  | ||||
| 		if valid { | ||||
| 			chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFaker(), vm.Config{}) | ||||
| 			chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFaker(), vm.Config{}, nil) | ||||
| 			_, results = chain.engine.VerifyHeaders(chain, headers, seals) | ||||
| 			chain.Stop() | ||||
| 		} else { | ||||
| 			chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFakeFailer(uint64(len(headers)-1)), vm.Config{}) | ||||
| 			chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFakeFailer(uint64(len(headers)-1)), vm.Config{}, nil) | ||||
| 			_, results = chain.engine.VerifyHeaders(chain, headers, seals) | ||||
| 			chain.Stop() | ||||
| 		} | ||||
| @@ -173,7 +173,7 @@ func testHeaderConcurrentAbortion(t *testing.T, threads int) { | ||||
| 	defer runtime.GOMAXPROCS(old) | ||||
|  | ||||
| 	// Start the verifications and immediately abort | ||||
| 	chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFakeDelayer(time.Millisecond), vm.Config{}) | ||||
| 	chain, _ := NewBlockChain(testdb, nil, params.TestChainConfig, ethash.NewFakeDelayer(time.Millisecond), vm.Config{}, nil) | ||||
| 	defer chain.Stop() | ||||
|  | ||||
| 	abort, results := chain.engine.VerifyHeaders(chain, headers, seals) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user