diff options
author | Wei-Ning Huang <w@byzantine-lab.io> | 2019-07-25 20:41:46 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-17 16:57:31 +0800 |
commit | 174f6bfcdf4e2c7fea3a071653908b477ad9a3b3 (patch) | |
tree | 7990bd656bd9cc7ef3014534ad2fee5163da3790 /dex/governance.go | |
parent | a9a85fa746c727063015d6e70881426ce8b3a3fb (diff) | |
download | go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.tar go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.tar.gz go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.tar.bz2 go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.tar.lz go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.tar.xz go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.tar.zst go-tangerine-174f6bfcdf4e2c7fea3a071653908b477ad9a3b3.zip |
core: add GovUtil to unify governance state related access
Add GovUtil so we could use the same logic in everywhere that requires
access to governance state, such as configuration and CRS.
Diffstat (limited to 'dex/governance.go')
-rw-r--r-- | dex/governance.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/dex/governance.go b/dex/governance.go index 1ca94e1dc..50de31a0e 100644 --- a/dex/governance.go +++ b/dex/governance.go @@ -58,9 +58,13 @@ func NewDexconGovernance(backend *DexAPIBackend, chainConfig *params.ChainConfig return g } -// DexconConfiguration return raw config in state. -func (d *DexconGovernance) DexconConfiguration(round uint64) *params.DexconConfig { - return d.GetStateForConfigAtRound(round).Configuration() +// RawConfiguration return raw config in state. +func (d *DexconGovernance) RawConfiguration(round uint64) (*params.DexconConfig, error) { + gs, err := d.GetConfigState(round) + if err != nil { + return nil, err + } + return gs.Configuration(), nil } func (d *DexconGovernance) sendGovTx(ctx context.Context, data []byte) error { |