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.
This commit is contained in:
Olaoluwa Osuntokun 2016-10-18 15:54:27 -07:00 committed by Dave Collins
parent 1e331153b4
commit 1b359e1131
2 changed files with 8 additions and 1 deletions

View file

@ -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.

View file

@ -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))