aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-26 10:00:31 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commitce9dd85433e342b9ee13848414bc694921be1100 (patch)
tree892af82873805fb2e98eb7ef7e56b6130ea0438a /dex
parent8b0b015937c02207df440eee6e4c96eec846fae6 (diff)
downloaddexon-ce9dd85433e342b9ee13848414bc694921be1100.tar
dexon-ce9dd85433e342b9ee13848414bc694921be1100.tar.gz
dexon-ce9dd85433e342b9ee13848414bc694921be1100.tar.bz2
dexon-ce9dd85433e342b9ee13848414bc694921be1100.tar.lz
dexon-ce9dd85433e342b9ee13848414bc694921be1100.tar.xz
dexon-ce9dd85433e342b9ee13848414bc694921be1100.tar.zst
dexon-ce9dd85433e342b9ee13848414bc694921be1100.zip
core: various changes on tps tuning (#46)
Diffstat (limited to 'dex')
-rw-r--r--dex/app.go9
-rw-r--r--dex/handler.go2
2 files changed, 4 insertions, 7 deletions
diff --git a/dex/app.go b/dex/app.go
index 623bb8dff..0e3f34f70 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -174,10 +174,9 @@ func (d *DexconApp) PreparePayload(position coreTypes.Position) (payload []byte,
chainID := new(big.Int).SetUint64(uint64(position.ChainID))
chainNums := new(big.Int).SetUint64(uint64(d.gov.GetNumChains(position.Round)))
- blockGasLimit := new(big.Int).SetUint64(core.CalcGasLimit(d.blockchain.CurrentBlock(),
- d.config.GasFloor, d.config.GasCeil))
+ blockGasLimit := new(big.Int).SetUint64(d.blockchain.CurrentBlock().GasLimit())
blockGasUsed := new(big.Int)
- var allTxs types.Transactions
+ allTxs := make([]*types.Transaction, 0, 3000)
addressMap:
for address, txs := range txsMap {
@@ -374,8 +373,7 @@ func (d *DexconApp) VerifyBlock(block *coreTypes.Block) coreTypes.BlockVerifySta
}
// Validate if balance is enough for TXs in this block.
- blockGasLimit := new(big.Int).SetUint64(core.CalcGasLimit(
- d.blockchain.CurrentBlock(), d.config.GasFloor, d.config.GasCeil))
+ blockGasLimit := new(big.Int).SetUint64(d.blockchain.CurrentBlock().GasLimit())
blockGasUsed := new(big.Int)
for _, tx := range transactions {
@@ -451,7 +449,6 @@ func (d *DexconApp) BlockDelivered(
}
d.chainLatestRoot.Store(block.Position.ChainID, root)
- log.Info("Insert pending block success", "height", result.Height)
d.blockchain.RemoveConfirmedBlock(chainID, blockHash)
}
diff --git a/dex/handler.go b/dex/handler.go
index 70c3d9806..fe48c455b 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -1117,7 +1117,7 @@ func (pm *ProtocolManager) txBroadcastLoop() {
txs := make(types.Transactions, 0)
for {
select {
- case <-time.After(500 * time.Millisecond):
+ case <-time.After(100 * time.Millisecond):
pm.BroadcastTxs(txs)
txs = txs[:0]
currentSize = 0