aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-19 14:36:36 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit78dac82d810fe4a1ad6878adbc789f909155f472 (patch)
tree13189c293ed8603a7e9d8b15571fff1737c9bc1f /dex
parent8a0b917def2d80b112d7d8a5854aba62afc0a630 (diff)
downloadgo-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.gz
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.bz2
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.lz
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.xz
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.tar.zst
go-tangerine-78dac82d810fe4a1ad6878adbc789f909155f472.zip
governance: implement delegate/undelegate function and add tests (#33)
Implement delegate/undelegate function to allow others to delegate it's fund to stake on a node. Also added governance contract tests.
Diffstat (limited to 'dex')
-rw-r--r--dex/app.go2
-rw-r--r--dex/governance.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/dex/app.go b/dex/app.go
index e0280dc2c..99514ed83 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -245,7 +245,7 @@ func (d *DexconApp) PrepareWitness(consensusHeight uint64) (witness coreTypes.Wi
if lastPendingHeight == 0 && consensusHeight == 0 {
witnessBlock = d.blockchain.CurrentBlock()
} else if lastPendingHeight >= consensusHeight {
- witnessBlock = d.blockchain.GetPendingBlock()
+ witnessBlock = d.blockchain.PendingBlock()
} else {
log.Error("last pending height too low", "lastPendingHeight", lastPendingHeight,
"consensusHeight", consensusHeight)
diff --git a/dex/governance.go b/dex/governance.go
index f555b3508..db33f7820 100644
--- a/dex/governance.go
+++ b/dex/governance.go
@@ -100,7 +100,7 @@ func (d *DexconGovernance) Configuration(round uint64) *coreTypes.Config {
NumChains: c.NumChains,
LambdaBA: time.Duration(c.LambdaBA) * time.Millisecond,
LambdaDKG: time.Duration(c.LambdaDKG) * time.Millisecond,
- K: c.K,
+ K: int(c.K),
PhiRatio: c.PhiRatio,
NotarySetSize: c.NotarySetSize,
DKGSetSize: c.DKGSetSize,
@@ -172,12 +172,12 @@ func (d *DexconGovernance) ProposeCRS(round uint64, signedCRS []byte) {
}
}
-// NodeSet returns the current notary set.
+// NodeSet returns the current node set.
func (d *DexconGovernance) NodeSet(round uint64) []coreCrypto.PublicKey {
s := d.getGovStateAtRound(round)
var pks []coreCrypto.PublicKey
- for _, n := range s.Nodes() {
+ for _, n := range s.QualifiedNodes() {
pk, err := coreEcdsa.NewPublicKeyFromByteSlice(n.PublicKey)
if err != nil {
panic(err)