diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-06-05 22:13:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-05 22:13:43 +0800 |
commit | 01a7e267dc6d7bbef94882542bbd01bd712f5548 (patch) | |
tree | fc31112c0c3a12d76f200e4cf5bf25ea18a89a9b /core/blockchain.go | |
parent | e8ea5aa0d59a722df616bc8c8cffacadd23c082d (diff) | |
parent | 2ab24a2a8f864e8c2f3c7ad2d494ccf02ffd8384 (diff) | |
download | go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.tar go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.tar.gz go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.tar.bz2 go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.tar.lz go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.tar.xz go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.tar.zst go-tangerine-01a7e267dc6d7bbef94882542bbd01bd712f5548.zip |
Merge pull request #16882 from karalabe/streaming-ecrecover
core: concurrent background transaction sender ecrecover
Diffstat (limited to 'core/blockchain.go')
-rw-r--r-- | core/blockchain.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 3eee75df7..bf1bbe6cb 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1005,6 +1005,10 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) { // only reason this method exists as a separate one is to make locking cleaner // with deferred statements. func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*types.Log, error) { + // Sanity check that we have something meaningful to import + if len(chain) == 0 { + return 0, nil, nil, nil + } // Do a sanity check that the provided chain is actually ordered and linked for i := 1; i < len(chain); i++ { if chain[i].NumberU64() != chain[i-1].NumberU64()+1 || chain[i].ParentHash() != chain[i-1].Hash() { @@ -1043,6 +1047,9 @@ func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*ty abort, results := bc.engine.VerifyHeaders(bc, headers, seals) defer close(abort) + // Start a parallel signature recovery (signer will fluke on fork transition, minimal perf loss) + senderCacher.recoverFromBlocks(types.MakeSigner(bc.chainConfig, chain[0].Number()), chain) + // Iterate over the blocks and insert when the verifier permits for i, block := range chain { // If the chain is terminating, stop processing blocks |