mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 18:00:11 +01:00
server: add OnGetCFTypes callback to serverPeer
This commit is contained in:
parent
2b7ebfd698
commit
5772bdde86
13
server.go
13
server.go
@ -873,6 +873,18 @@ func (sp *serverPeer) OnGetCFHeaders(_ *peer.Peer, msg *wire.MsgGetCFHeaders) {
|
||||
sp.QueueMessage(headersMsg, nil)
|
||||
}
|
||||
|
||||
// OnGetCFTypes is invoked when a peer receives a getcftypes bitcoin message.
|
||||
func (sp *serverPeer) OnGetCFTypes(_ *peer.Peer, msg *wire.MsgGetCFTypes) {
|
||||
// Ignore getcftypes requests if cfg.NoCFilters is set or we're not in
|
||||
// sync.
|
||||
if cfg.NoCFilters || !sp.server.blockManager.IsCurrent() {
|
||||
return
|
||||
}
|
||||
|
||||
cfTypesMsg := wire.NewMsgCFTypes([]uint8{0, 1})
|
||||
sp.QueueMessage(cfTypesMsg, nil)
|
||||
}
|
||||
|
||||
// enforceNodeBloomFlag disconnects the peer if the server is not configured to
|
||||
// allow bloom filters. Additionally, if the peer has negotiated to a protocol
|
||||
// version that is high enough to observe the bloom filter service support bit,
|
||||
@ -1722,6 +1734,7 @@ func newPeerConfig(sp *serverPeer) *peer.Config {
|
||||
OnGetHeaders: sp.OnGetHeaders,
|
||||
OnGetCFilter: sp.OnGetCFilter,
|
||||
OnGetCFHeaders: sp.OnGetCFHeaders,
|
||||
OnGetCFTypes: sp.OnGetCFTypes,
|
||||
OnFeeFilter: sp.OnFeeFilter,
|
||||
OnFilterAdd: sp.OnFilterAdd,
|
||||
OnFilterClear: sp.OnFilterClear,
|
||||
|
Loading…
Reference in New Issue
Block a user