core, network: add Notary module
This commit is contained in:
parent
cb56eb4696
commit
19fa0daaa6
18 changed files with 577 additions and 8 deletions
|
@ -37,6 +37,8 @@ type Designate struct {
|
|||
p2pSigExtensionsEnabled bool
|
||||
|
||||
OracleService atomic.Value
|
||||
// NotaryService represents Notary node module.
|
||||
NotaryService atomic.Value
|
||||
}
|
||||
|
||||
type roleData struct {
|
||||
|
@ -183,10 +185,15 @@ func (s *Designate) updateCachedRoleData(v *atomic.Value, d dao.DAO, r Role) err
|
|||
addr: s.hashFromNodes(r, nodeKeys),
|
||||
height: height,
|
||||
})
|
||||
if r == RoleOracle {
|
||||
switch r {
|
||||
case RoleOracle:
|
||||
if orc, _ := s.OracleService.Load().(services.Oracle); orc != nil {
|
||||
orc.UpdateOracleNodes(nodeKeys.Copy())
|
||||
}
|
||||
case RoleP2PNotary:
|
||||
if ntr, _ := s.NotaryService.Load().(services.Notary); ntr != nil {
|
||||
ntr.UpdateNotaryNodes(nodeKeys.Copy())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue