From 333af136efc468731df137d405464a356e26b06d Mon Sep 17 00:00:00 2001 From: pedro martelletto Date: Tue, 13 Dec 2016 10:03:15 +0000 Subject: [PATCH] Create a knob to switch CBFs off. While having them on by default. We may want to revisit this and make no CBFs the default. --- config.go | 1 + doc.go | 1 + sample-btcd.conf | 3 +++ server.go | 6 +++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index 1192be4f..505b3fbb 100644 --- a/config.go +++ b/config.go @@ -150,6 +150,7 @@ type config struct { BlockPrioritySize uint32 `long:"blockprioritysize" description:"Size in bytes for high-priority/low-fee transactions when creating a block"` UserAgentComments []string `long:"uacomment" description:"Comment to add to the user agent -- See BIP 14 for more information."` NoPeerBloomFilters bool `long:"nopeerbloomfilters" description:"Disable bloom filtering support"` + NoCBFilters bool `long:"nocbfilters" description:"Disable committed bloom filtering (CBF) support"` SigCacheMaxSize uint `long:"sigcachemaxsize" description:"The maximum number of entries in the signature verification cache"` BlocksOnly bool `long:"blocksonly" description:"Do not accept transactions from remote peers."` TxIndex bool `long:"txindex" description:"Maintain a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC"` diff --git a/doc.go b/doc.go index 631568ff..9bb0f2e6 100644 --- a/doc.go +++ b/doc.go @@ -112,6 +112,7 @@ Application Options: --blockprioritysize= Size in bytes for high-priority/low-fee transactions when creating a block (50000) --nopeerbloomfilters Disable bloom filtering support. + --nocbfilters Disable committed bloom filtering (CBF) support. --sigcachemaxsize= The maximum number of entries in the signature verification cache. --blocksonly Do not accept transactions from remote peers. diff --git a/sample-btcd.conf b/sample-btcd.conf index 382b0114..729d18ec 100644 --- a/sample-btcd.conf +++ b/sample-btcd.conf @@ -167,6 +167,9 @@ ; Must not include characters '/', ':', '(' and ')'. ; uacomment= +; Disable committed peer bloom filtering (CBF). +; nocbfilters=1 + ; ------------------------------------------------------------------------------ ; RPC server options - The following options control the built-in RPC server ; which is used to control and query information from a running btcd process. diff --git a/server.go b/server.go index 4faa2116..80fd0f42 100644 --- a/server.go +++ b/server.go @@ -43,7 +43,8 @@ import ( const ( // defaultServices describes the default services that are supported by // the server. - defaultServices = wire.SFNodeNetwork | wire.SFNodeBloom | wire.SFNodeWitness + defaultServices = wire.SFNodeNetwork | wire.SFNodeBloom | + wire.SFNodeWitness | wire.SFNodeCF // defaultRequiredServices describes the default services that are // required to be supported by outbound peers. @@ -2158,6 +2159,9 @@ func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Param if cfg.NoPeerBloomFilters { services &^= wire.SFNodeBloom } + if cfg.NoCBFilters { + services &^= wire.SFNodeCBF + } amgr := addrmgr.New(cfg.DataDir, btcdLookup)