Instrument GetCBFilter RPC
This commit is contained in:
parent
76378e7167
commit
f6dff40733
1 changed files with 17 additions and 0 deletions
17
rpcserver.go
17
rpcserver.go
|
@ -2148,6 +2148,23 @@ func handleGetBlockTemplate(s *rpcServer, cmd interface{}, closeChan <-chan stru
|
|||
|
||||
// handleGetCBFilter implements the getcbfilter command.
|
||||
func handleGetCBFilter(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
|
||||
c := cmd.(*btcjson.GetCBFilterCmd)
|
||||
hash, err := chainhash.NewHashFromStr(c.Hash)
|
||||
if err != nil {
|
||||
return nil, rpcDecodeHexError(c.Hash)
|
||||
}
|
||||
|
||||
filterBytes, err := s.server.cbfIndex.GetFilterByBlockHash(hash)
|
||||
if len(filterBytes) > 0 {
|
||||
rpcsLog.Debugf("Found CB filter for %v", hash)
|
||||
} else {
|
||||
rpcsLog.Debugf("Could not find CB filter for %v: %v", hash, err)
|
||||
return nil, &btcjson.RPCError{
|
||||
Code: btcjson.ErrRPCBlockNotFound,
|
||||
Message: "Block not found",
|
||||
}
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue