diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-26 10:00:31 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | f79bf330b4b649ea74d54faf749214c14f32af9c (patch) | |
tree | 1cf494fda8e45813c6e4062a587dfd3ecf1d5a54 /core | |
parent | b4f183ba63e3ab5dccc6371faaa57c77b61e967b (diff) | |
download | dexon-f79bf330b4b649ea74d54faf749214c14f32af9c.tar.gz dexon-f79bf330b4b649ea74d54faf749214c14f32af9c.tar.zst dexon-f79bf330b4b649ea74d54faf749214c14f32af9c.zip |
core: various changes on tps tuning (#46)
Diffstat (limited to 'core')
-rw-r--r-- | core/blockchain.go | 2 | ||||
-rw-r--r-- | core/genesis.go | 4 | ||||
-rw-r--r-- | core/tx_pool.go | 2 | ||||
-rw-r--r-- | core/tx_pool_test.go | 2 | ||||
-rw-r--r-- | core/types/transaction_signing.go | 15 |
5 files changed, 14 insertions, 11 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index dfc00ffd0..b9de195dc 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1834,6 +1834,8 @@ func (bc *BlockChain) processPendingBlock( bc.addPendingBlock(newPendingBlock, receipts) events = append(events, BlockConfirmedEvent{newPendingBlock}) + log.Debug("Inserted pending block", "height", newPendingBlock.Number(), "hash", newPendingBlock.Hash()) + // Start insert available pending blocks into db for pendingHeight := bc.CurrentBlock().NumberU64() + 1; pendingHeight <= witness.Height; pendingHeight++ { pendingIns, exist := bc.pendingBlocks[pendingHeight] diff --git a/core/genesis.go b/core/genesis.go index e7d26d4c2..e41fe9abd 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -387,7 +387,7 @@ func DefaultGenesisBlock() *Genesis { Timestamp: 1540024964, Nonce: 0x42, ExtraData: hexutil.MustDecode("0x5765692d4e696e6720536f6e696320426f6a696520323031382d31302d32302e"), - GasLimit: 80000000, + GasLimit: 40000000, Difficulty: big.NewInt(1), Alloc: decodePrealloc(mainnetAllocData), } @@ -399,7 +399,7 @@ func DefaultTestnetGenesisBlock() *Genesis { Config: params.TestnetChainConfig, Nonce: 0x42, ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"), - GasLimit: 80000000, + GasLimit: 40000000, Difficulty: big.NewInt(1), Alloc: decodePrealloc(testnetAllocData), } diff --git a/core/tx_pool.go b/core/tx_pool.go index b7f8896fa..1d69ea506 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -152,7 +152,7 @@ var DefaultTxPoolConfig = TxPoolConfig{ PriceLimit: 1, PriceBump: 10, - AccountSlots: 192, + AccountSlots: 512, GlobalSlots: 40960, AccountQueue: 1024, GlobalQueue: 20240, diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index 4c1d78f7f..dc664eedd 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -1437,7 +1437,9 @@ func TestTransactionPoolStableUnderpricing(t *testing.T) { blockchain := &testBlockChain{statedb, 1000000, new(event.Feed), new(event.Feed)} config := testTxPoolConfig + config.AccountSlots = 16 config.GlobalSlots = 128 + config.AccountQueue = 1024 config.GlobalQueue = 0 pool := NewTxPool(config, params.TestChainConfig, blockchain, false) diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 47c7a2f91..99e0c7896 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -173,9 +173,13 @@ func Sender(signer Signer, tx *Transaction) (common.Address, error) { } } - addr, err := signer.Sender(tx) - if err != nil { - return common.Address{}, err + addr, ok := GlobalSigCache.Get(tx.Hash()) + if !ok { + var err error + addr, err = signer.Sender(tx) + if err != nil { + return common.Address{}, err + } } tx.from.Store(sigCache{signer: signer, from: addr}) return addr, nil @@ -218,11 +222,6 @@ func (s EIP155Signer) Equal(s2 Signer) bool { var big8 = big.NewInt(8) func (s EIP155Signer) Sender(tx *Transaction) (common.Address, error) { - addr, ok := GlobalSigCache.Get(tx.Hash()) - if ok { - return addr, nil - } - if !tx.Protected() { return HomesteadSigner{}.Sender(tx) } |