From 1b359e11310bc5f3a94cec1407b14dd6ab48d6ba Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 18 Oct 2016 15:54:27 -0700 Subject: [PATCH] BIP0144+wire: introduce the new SFNodeWitness service bit This commit introduces the new SFNodeWitness service bit which has been added to the protocol as part of BIP0144. The new service bit allows peers on the network to signal their acceptance and adherence to the new rules defined as part of the segwit soft-fork package. --- wire/protocol.go | 6 ++++++ wire/protocol_test.go | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wire/protocol.go b/wire/protocol.go index 26797c70..30fdb01e 100644 --- a/wire/protocol.go +++ b/wire/protocol.go @@ -66,6 +66,10 @@ const ( // SFNodeBloom is a flag used to indicate a peer supports bloom // filtering. SFNodeBloom + + // SFNodeWitness is a flag used to indicate a peer supports blocks + // and transactions including witness data (BIP0144). + SFNodeWitness ) // Map of service flags back to their constant names for pretty printing. @@ -73,6 +77,7 @@ var sfStrings = map[ServiceFlag]string{ SFNodeNetwork: "SFNodeNetwork", SFNodeGetUTXO: "SFNodeGetUTXO", SFNodeBloom: "SFNodeBloom", + SFNodeWitness: "SFNodeWitness", } // orderedSFStrings is an ordered list of service flags from highest to @@ -81,6 +86,7 @@ var orderedSFStrings = []ServiceFlag{ SFNodeNetwork, SFNodeGetUTXO, SFNodeBloom, + SFNodeWitness, } // String returns the ServiceFlag in human-readable form. diff --git a/wire/protocol_test.go b/wire/protocol_test.go index accc0495..db9991f4 100644 --- a/wire/protocol_test.go +++ b/wire/protocol_test.go @@ -16,7 +16,8 @@ func TestServiceFlagStringer(t *testing.T) { {SFNodeNetwork, "SFNodeNetwork"}, {SFNodeGetUTXO, "SFNodeGetUTXO"}, {SFNodeBloom, "SFNodeBloom"}, - {0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|0xfffffff8"}, + {SFNodeWitness, "SFNodeWitness"}, + {0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|0xfffffff0"}, } t.Logf("Running %d tests", len(tests))