aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorBJ4 <bojie@dexon.org>2018-11-15 16:02:19 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:53 +0800
commit24e161879e478a589c8857a1b2fec66fa948d225 (patch)
treeaf407d2615b41ff4703cfa91f86708f6aced2ae7 /dex
parentb26e4c9adaa2952a63bf811f991a3e6fb9fc5646 (diff)
downloaddexon-24e161879e478a589c8857a1b2fec66fa948d225.tar.gz
dexon-24e161879e478a589c8857a1b2fec66fa948d225.tar.zst
dexon-24e161879e478a589c8857a1b2fec66fa948d225.zip
app: add cache to reuse same tx address which has already recovered (#26)
Diffstat (limited to 'dex')
-rw-r--r--dex/app.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/dex/app.go b/dex/app.go
index af8295c9a..38ca382e3 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -458,18 +458,11 @@ func (d *DexconApp) BlockDelivered(
d.chainLock(chainID)
defer d.chainUnlock(chainID)
- block := d.blockchain.GetConfirmedBlockByHash(chainID, blockHash)
+ block, txs := d.blockchain.GetConfirmedBlockByHash(chainID, blockHash)
if block == nil {
panic("Can not get confirmed block")
}
- var transactions types.Transactions
- err := rlp.DecodeBytes(block.Payload, &transactions)
- if err != nil {
- log.Error("Payload rlp decode failed", "error", err)
- panic(err)
- }
-
block.Payload = nil
dexconMeta, err := rlp.EncodeToBytes(block)
if err != nil {
@@ -485,7 +478,7 @@ func (d *DexconApp) BlockDelivered(
Round: block.Position.Round,
DexconMeta: dexconMeta,
Randomness: result.Randomness,
- }, transactions, nil, nil)
+ }, txs, nil, nil)
root, err := d.blockchain.ProcessPendingBlock(newBlock, &block.Witness)
if err != nil {