aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-26 10:00:31 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:54 +0800
commit622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7 (patch)
tree995b1db1cb20fc0fecb240338d089f0c49d1d986 /core
parentc11db35c2d3f5ca5f4b5749294e154f10ef6b1c1 (diff)
downloaddexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.tar
dexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.tar.gz
dexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.tar.bz2
dexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.tar.lz
dexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.tar.xz
dexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.tar.zst
dexon-622ae7fe3ef067d4f395937a9bb0f783a7c1e6c7.zip
core: various changes on tps tuning (#46)
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go2
-rw-r--r--core/genesis.go4
-rw-r--r--core/tx_pool.go2
-rw-r--r--core/tx_pool_test.go2
-rw-r--r--core/types/transaction_signing.go15
5 files changed, 14 insertions, 11 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 3d7171cd7..81e9f05b2 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 09ab5b701..0b59f4bbb 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)
}