aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-27 18:54:10 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-13 18:11:44 +0800
commit7b8b4fcb0e8fd411bf523d06492e966e20e1b613 (patch)
tree9637c1e94b7cd1719a2ba79eea71efa800ae2eff
parent9d098bb29764280ad6799a2ab44ecdd3e28fa2ed (diff)
downloadgo-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.tar
go-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.tar.gz
go-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.tar.bz2
go-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.tar.lz
go-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.tar.xz
go-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.tar.zst
go-tangerine-7b8b4fcb0e8fd411bf523d06492e966e20e1b613.zip
dex: do not propose skip block if not in notary set (#303)
-rw-r--r--dex/recovery.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/dex/recovery.go b/dex/recovery.go
index 4c3da7d5a..adeb1f612 100644
--- a/dex/recovery.go
+++ b/dex/recovery.go
@@ -314,6 +314,7 @@ type Recovery struct {
gov *DexconGovernance
contract common.Address
confirmation int
+ publicKey string
privateKey *ecdsa.PrivateKey
nodeAddress common.Address
client *ethrpc.EthRPC
@@ -326,6 +327,7 @@ func NewRecovery(config *params.RecoveryConfig, networkRPC string,
gov: gov,
contract: config.Contract,
confirmation: config.Confirmation,
+ publicKey: hex.EncodeToString(crypto.FromECDSAPub(&privKey.PublicKey)),
privateKey: privKey,
nodeAddress: crypto.PubkeyToAddress(privKey.PublicKey),
client: client,
@@ -429,6 +431,14 @@ func (r *Recovery) genVoteForSkipBlockTx(height uint64) (*types.Transaction, err
}
func (r *Recovery) ProposeSkipBlock(height uint64) error {
+ notarySet, err := r.gov.NotarySet(r.gov.Round())
+ if err != nil {
+ return err
+ }
+ if _, ok := notarySet[r.publicKey]; !ok {
+ return errors.New("not in notary set")
+ }
+
tx, err := r.genVoteForSkipBlockTx(height)
if err == errAlreadyVoted {
return nil