From d82e76cec9711a5544c16e69de76fee25973cc08 Mon Sep 17 00:00:00 2001 From: pedro martelletto Date: Tue, 13 Dec 2016 09:34:25 +0000 Subject: [PATCH] Introduce a service flag for CBFs. Add a service flag for CBFs in the wire protocol. --- wire/protocol.go | 7 +++++++ wire/protocol_test.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/wire/protocol.go b/wire/protocol.go index 30fdb01e..9ea704fb 100644 --- a/wire/protocol.go +++ b/wire/protocol.go @@ -10,6 +10,7 @@ import ( "strings" ) +// XXX pedro: we will probably need to bump this. const ( // ProtocolVersion is the latest protocol version this package supports. ProtocolVersion uint32 = 70013 @@ -70,6 +71,10 @@ const ( // SFNodeWitness is a flag used to indicate a peer supports blocks // and transactions including witness data (BIP0144). SFNodeWitness + + // SFNNodeCBF is a flag used to indicate a peer supports committed + // bloom filters (CBFs). + SFNodeCBF ) // Map of service flags back to their constant names for pretty printing. @@ -78,6 +83,7 @@ var sfStrings = map[ServiceFlag]string{ SFNodeGetUTXO: "SFNodeGetUTXO", SFNodeBloom: "SFNodeBloom", SFNodeWitness: "SFNodeWitness", + SFNodeCBF: "SFNodeCBF", } // orderedSFStrings is an ordered list of service flags from highest to @@ -87,6 +93,7 @@ var orderedSFStrings = []ServiceFlag{ SFNodeGetUTXO, SFNodeBloom, SFNodeWitness, + SFNodeCBF, } // String returns the ServiceFlag in human-readable form. diff --git a/wire/protocol_test.go b/wire/protocol_test.go index db9991f4..dd3ea11f 100644 --- a/wire/protocol_test.go +++ b/wire/protocol_test.go @@ -18,6 +18,8 @@ func TestServiceFlagStringer(t *testing.T) { {SFNodeBloom, "SFNodeBloom"}, {SFNodeWitness, "SFNodeWitness"}, {0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|0xfffffff0"}, + {SFNodeCBF, "SFNodeCBF"}, + {0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeCBF|0xfffffff0"}, } t.Logf("Running %d tests", len(tests))