aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-21 16:14:51 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commit589393f8c64d94c268cd057715f8f8c247321aa5 (patch)
treebb2a0c96309d40d350a90e4b0f57bb84c9b84e2b /dex
parent38e42c16675bee26253886c28e41101c10d66496 (diff)
downloaddexon-589393f8c64d94c268cd057715f8f8c247321aa5.tar
dexon-589393f8c64d94c268cd057715f8f8c247321aa5.tar.gz
dexon-589393f8c64d94c268cd057715f8f8c247321aa5.tar.bz2
dexon-589393f8c64d94c268cd057715f8f8c247321aa5.tar.lz
dexon-589393f8c64d94c268cd057715f8f8c247321aa5.tar.xz
dexon-589393f8c64d94c268cd057715f8f8c247321aa5.tar.zst
dexon-589393f8c64d94c268cd057715f8f8c247321aa5.zip
core: add global signature cache and improve concurrency (#42)
From the go trace result, the bottleneck hides in the lock of StoreTxCache. To improve this, we update the cache in a batched fassion.
Diffstat (limited to 'dex')
-rw-r--r--dex/app.go2
-rw-r--r--dex/handler.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/dex/app.go b/dex/app.go
index 99514ed83..df76b2b7d 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -327,7 +327,7 @@ func (d *DexconApp) VerifyBlock(block *coreTypes.Block) coreTypes.BlockVerifySta
return coreTypes.VerifyInvalidBlock
}
- _, err = transactions.TouchSenders(types.MakeSigner(d.blockchain.Config(), new(big.Int)))
+ _, err = types.GlobalSigCache.Add(types.NewEIP155Signer(d.blockchain.Config().ChainID), transactions)
if err != nil {
log.Error("Failed to calculate sender", "error", err)
return coreTypes.VerifyInvalidBlock
diff --git a/dex/handler.go b/dex/handler.go
index a74c78e3b..a1a158560 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -724,7 +724,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
}
p.MarkTransaction(tx.Hash())
}
- types.Transactions(txs).TouchSenders(types.MakeSigner(pm.blockchain.Config(), new(big.Int)))
+ types.GlobalSigCache.Add(types.NewEIP155Signer(pm.blockchain.Config().ChainID), txs)
pm.txpool.AddRemotes(txs)
case msg.Code == MetaMsg: