diff options
author | Sonic <sonic@dexon.org> | 2018-11-20 14:13:53 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:18 +0800 |
commit | c5206f748e1a4a57707cffc8f867386f0d84f7be (patch) | |
tree | 7e840c9a4b686718f4bcb31b9f64d6330bbbd470 /dex/governance.go | |
parent | 91d3c571ef5e5628917c5a27d16bc0d8d7083224 (diff) | |
download | go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.tar go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.tar.gz go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.tar.bz2 go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.tar.lz go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.tar.xz go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.tar.zst go-tangerine-c5206f748e1a4a57707cffc8f867386f0d84f7be.zip |
dex: implement downloader for dex
We need governance state to verify block's signature (randomness),
but in ethereum fast sync mode, eth downloader only downloads the whole
state of pivot block, so we don't have governance state to verify the
downloaded block that is before pivot block if we don't processing
transaction.
To avoid running transactions, dex downloader also downloads the
governance state (merkle proof and storage) at snapshot height of each round,
so that we can verify blocks in fast sync mode.
Diffstat (limited to 'dex/governance.go')
-rw-r--r-- | dex/governance.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/dex/governance.go b/dex/governance.go index db33f7820..01f39b68c 100644 --- a/dex/governance.go +++ b/dex/governance.go @@ -46,7 +46,7 @@ func NewDexconGovernance(backend *DexAPIBackend, chainConfig *params.ChainConfig return g } -func (d *DexconGovernance) getRoundHeight(ctx context.Context, round uint64) (uint64, error) { +func (d *DexconGovernance) GetRoundHeight(ctx context.Context, round uint64) (uint64, error) { state, _, err := d.b.StateAndHeaderByNumber(ctx, rpc.LatestBlockNumber) if state == nil || err != nil { return 0, err @@ -72,7 +72,7 @@ func (d *DexconGovernance) getGovStateAtRound(round uint64) *vm.GovernanceStateH round -= dexCore.ConfigRoundShift } ctx := context.Background() - blockHeight, err := d.getRoundHeight(ctx, round) + blockHeight, err := d.GetRoundHeight(ctx, round) if err != nil { return nil } |