aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-17 13:18:34 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commit0e3b223de19e1975453206d8a0d326b575cb0afe (patch)
tree5b845b41416efafa814c47769a198c0e1dc0edae /dex
parent4246c8733870b92a8090bff1b3dc0c1159c535ad (diff)
downloaddexon-0e3b223de19e1975453206d8a0d326b575cb0afe.tar.gz
dexon-0e3b223de19e1975453206d8a0d326b575cb0afe.tar.zst
dexon-0e3b223de19e1975453206d8a0d326b575cb0afe.zip
core: more fix on light node synchronization (#32)
Fix gas calculation in governance contract. Correctly register round height when processing pending blocks. We should register the mapping when we get the pending block instead of waiting for block confirmation.
Diffstat (limited to 'dex')
-rw-r--r--dex/config.go4
-rw-r--r--dex/governance.go11
2 files changed, 7 insertions, 8 deletions
diff --git a/dex/config.go b/dex/config.go
index e78a698a9..438e959e3 100644
--- a/dex/config.go
+++ b/dex/config.go
@@ -48,8 +48,8 @@ var DefaultConfig = Config{
},
BlockProposerEnabled: false,
DefaultGasPrice: big.NewInt(params.GWei),
- GasFloor: 8000000,
- GasCeil: 8000000,
+ GasFloor: 80000000,
+ GasCeil: 80000000,
GasLimitTolerance: 1000000,
}
diff --git a/dex/governance.go b/dex/governance.go
index 0251d2afd..f555b3508 100644
--- a/dex/governance.go
+++ b/dex/governance.go
@@ -79,6 +79,7 @@ func (d *DexconGovernance) getGovStateAtRound(round uint64) *vm.GovernanceStateH
state, _, err := d.b.StateAndHeaderByNumber(ctx, rpc.BlockNumber(blockHeight))
if state == nil || err != nil {
+ log.Error("Failed to retrieve governance state", "round", round, "height", blockHeight)
return nil
}
return &vm.GovernanceStateHelper{state}
@@ -119,17 +120,15 @@ func (d *DexconGovernance) sendGovTx(ctx context.Context, data []byte) error {
return err
}
- log.Info("sendGovTx", "nonce", nonce)
-
- // Increase gasPrice to 5 times of suggested gas price to make sure it will
+ // Increase gasPrice to 10 times of suggested gas price to make sure it will
// be included in time.
- gasPrice = new(big.Int).Mul(gasPrice, big.NewInt(5))
+ gasPrice = new(big.Int).Mul(gasPrice, big.NewInt(10))
tx := types.NewTransaction(
nonce,
vm.GovernanceContractAddress,
big.NewInt(0),
- uint64(2000000),
+ uint64(10000000),
gasPrice,
data)
@@ -140,7 +139,7 @@ func (d *DexconGovernance) sendGovTx(ctx context.Context, data []byte) error {
return err
}
- log.Info("Send governance transaction", "fullhash", tx.Hash().Hex())
+ log.Info("Send governance transaction", "fullhash", tx.Hash().Hex(), "nonce", nonce)
return d.b.SendTx(ctx, tx)
}