WIP: Json rpc federation, search/getclaimbyid, and shutdown #76

Merged
jeffreypicard merged 11 commits from json-rpc-federation-and-shutdown into master 2022-12-07 17:01:36 +01:00
2 changed files with 8 additions and 1 deletions
Showing only changes of commit ccabb3f182 - Show all commits

View file

@ -57,6 +57,10 @@ func (s *Server) RunNotifier() error {
case internal.HeightHash: case internal.HeightHash:
heightHash, _ := notification.(internal.HeightHash) heightHash, _ := notification.(internal.HeightHash)
s.DoNotify(&heightHash) s.DoNotify(&heightHash)
// Do we need this?
// case peerNotification:
// peer, _ := notification.(peerNotification)
// s.notifyPeerSubs(&Peer{Address: peer.address, Port: peer.port})
default: default:
logrus.Warn("unknown notification type") logrus.Warn("unknown notification type")
} }

View file

@ -47,7 +47,7 @@ type session struct {
// headersSub indicates header subscription // headersSub indicates header subscription
headersSub bool headersSub bool
// peersSub indicates peer subscription // peersSub indicates peer subscription
peersBool bool peersSub bool
// headersSubRaw indicates the header subscription mode // headersSubRaw indicates the header subscription mode
headersSubRaw bool headersSubRaw bool
// client provides the ability to send notifications // client provides the ability to send notifications
@ -103,6 +103,9 @@ func (s *session) doNotify(notification interface{}) {
} }
params = []string{orig, status} params = []string{orig, status}
case peerNotification: case peerNotification:
if !s.peersSub {
return
}
note, _ := notification.(peerNotification) note, _ := notification.(peerNotification)
method = "server.peers.subscribe" method = "server.peers.subscribe"
params = []string{note.address, note.port} params = []string{note.address, note.port}