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-04-09 21:32:53 +0800
commitbdfdd7cd028518e0bbbc6a7e0ed8322190b80582 (patch)
treebad3cb92055806b99a11827d479ce269c1ea662a /dex
parent1677355db643a52843a202529d0a044453b090b6 (diff)
downloaddexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.tar
dexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.tar.gz
dexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.tar.bz2
dexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.tar.lz
dexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.tar.xz
dexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.tar.zst
dexon-bdfdd7cd028518e0bbbc6a7e0ed8322190b80582.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 282de494f..b90a344c8 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)
}