Make drand build
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
029ffc2dc3
commit
7ee6388686
@ -2,6 +2,7 @@ package drand
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"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"
|
||||||
@ -19,22 +20,29 @@ type DrandBeacon struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewDrandBeacon() *DrandBeacon {
|
func NewDrandBeacon() *DrandBeacon {
|
||||||
return &DrandBeacon{dnet.NewGrpcClient()}
|
return &DrandBeacon{
|
||||||
|
client: dnet.NewGrpcClient(),
|
||||||
|
localCache: make(map[int64]types.BeaconEntry),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DrandBeacon)
|
//func (db *DrandBeacon)
|
||||||
|
|
||||||
func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan beacon.Response {
|
func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan beacon.Response {
|
||||||
// check cache, it it if there, otherwise query the endpoint
|
// check cache, it it if there, otherwise query the endpoint
|
||||||
resp, err := db.client.PublicRand(ctx, &dproto.PublicRandRequest{round})
|
resp, err := db.client.PublicRand(nil, &dproto.PublicRandRequest{Round: round})
|
||||||
|
_, _ = resp, err
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DrandBeacon) VerifyEntry(types.BeaconEntry, types.BeaconEntry) error {
|
func (db *DrandBeacon) VerifyEntry(types.BeaconEntry, types.BeaconEntry) error {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DrandBeacon) MaxBeaconRoundForEpoch(abi.ChainEpoch, types.BeaconEntry) uint64 {
|
func (db *DrandBeacon) MaxBeaconRoundForEpoch(abi.ChainEpoch, types.BeaconEntry) uint64 {
|
||||||
// this is just some local math
|
// this is just some local math
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ beacon.RandomBeacon = (*DrandBeacon)(nil)
|
var _ beacon.RandomBeacon = (*DrandBeacon)(nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user