import DrandConfig from dtypes

This commit is contained in:
Yusef Napora 2020-06-23 16:23:06 -04:00
parent b448de422e
commit 5074cf8beb
2 changed files with 3 additions and 11 deletions

View File

@ -23,15 +23,11 @@ import (
"github.com/filecoin-project/lotus/chain/beacon" "github.com/filecoin-project/lotus/chain/beacon"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/node/modules/dtypes"
) )
var log = logging.Logger("drand") var log = logging.Logger("drand")
type DrandConfig struct {
Servers []string
ChainInfoJSON string
}
type drandPeer struct { type drandPeer struct {
addr string addr string
tls bool tls bool
@ -61,7 +57,7 @@ type DrandBeacon struct {
localCache map[uint64]types.BeaconEntry localCache map[uint64]types.BeaconEntry
} }
func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config DrandConfig) (*DrandBeacon, error) { func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes.DrandConfig) (*DrandBeacon, error) {
if genesisTs == 0 { if genesisTs == 0 {
panic("what are you doing this cant be zero") panic("what are you doing this cant be zero")
} }

View File

@ -124,9 +124,5 @@ func RandomBeacon(p RandomBeaconParams, _ dtypes.AfterGenesisSet) (beacon.Random
} }
//return beacon.NewMockBeacon(build.BlockDelay * time.Second) //return beacon.NewMockBeacon(build.BlockDelay * time.Second)
config := drand.DrandConfig{ return drand.NewDrandBeacon(gen.Timestamp, build.BlockDelay, p.PubSub, p.DrandConfig)
Servers: p.DrandConfig.Servers,
ChainInfoJSON: p.DrandConfig.ChainInfoJSON,
}
return drand.NewDrandBeacon(gen.Timestamp, build.BlockDelay, p.PubSub, config)
} }