-
Notifications
You must be signed in to change notification settings - Fork 210
/
oracle.go
38 lines (30 loc) · 1.04 KB
/
oracle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package node
import (
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/eligibility"
)
// todo: configure oracle test constants like committee size and honesty.
type localOracle struct {
committeeSize int
oc *eligibility.FixedRolacle
nodeID types.NodeID
}
func (bo *localOracle) IsIdentityActiveOnConsensusView(string, types.LayerID) (bool, error) {
return true, nil
}
func (bo *localOracle) Register(isHonest bool, pubkey string) {
bo.oc.Register(isHonest, pubkey)
}
func (bo *localOracle) Eligible(layer types.LayerID, round int32, committeeSize int, id types.NodeID, sig []byte) (bool, error) {
return bo.oc.Eligible(layer, round, committeeSize, id, sig)
}
func (bo *localOracle) Proof(layer types.LayerID, round int32) ([]byte, error) {
return bo.oc.Proof(layer, round)
}
func newLocalOracle(rolacle *eligibility.FixedRolacle, committeeSize int, nodeID types.NodeID) *localOracle {
return &localOracle{
committeeSize: committeeSize,
oc: rolacle,
nodeID: nodeID,
}
}