wire: update service bits for xthin, bit 5, cfilters, and segwit2x

This commit is contained in:
Alex 2017-10-12 19:37:27 -06:00 committed by Olaoluwa Osuntokun
parent 5772bdde86
commit 8d2ce855eb
2 changed files with 21 additions and 1 deletions

View file

@ -72,9 +72,20 @@ const (
// and transactions including witness data (BIP0144). // and transactions including witness data (BIP0144).
SFNodeWitness SFNodeWitness
// SFNodeXthin is a flag used to indicate a peer supports xthin blocks.
SFNodeXthin
// SFNodeBit5 is a flag used to indicate a peer supports a service
// defined by bit 5.
SFNodeBit5
// SFNodeCF is a flag used to indicate a peer supports committed // SFNodeCF is a flag used to indicate a peer supports committed
// filters (CFs). // filters (CFs).
SFNodeCF SFNodeCF
// SFNode2X is a flag used to indicate a peer is running the Segwit2X
// software.
SFNode2X
) )
// Map of service flags back to their constant names for pretty printing. // Map of service flags back to their constant names for pretty printing.
@ -83,7 +94,10 @@ var sfStrings = map[ServiceFlag]string{
SFNodeGetUTXO: "SFNodeGetUTXO", SFNodeGetUTXO: "SFNodeGetUTXO",
SFNodeBloom: "SFNodeBloom", SFNodeBloom: "SFNodeBloom",
SFNodeWitness: "SFNodeWitness", SFNodeWitness: "SFNodeWitness",
SFNodeXthin: "SFNodeXthin",
SFNodeBit5: "SFNodeBit5",
SFNodeCF: "SFNodeCF", SFNodeCF: "SFNodeCF",
SFNode2X: "SFNode2X",
} }
// orderedSFStrings is an ordered list of service flags from highest to // orderedSFStrings is an ordered list of service flags from highest to
@ -93,7 +107,10 @@ var orderedSFStrings = []ServiceFlag{
SFNodeGetUTXO, SFNodeGetUTXO,
SFNodeBloom, SFNodeBloom,
SFNodeWitness, SFNodeWitness,
SFNodeXthin,
SFNodeBit5,
SFNodeCF, SFNodeCF,
SFNode2X,
} }
// String returns the ServiceFlag in human-readable form. // String returns the ServiceFlag in human-readable form.

View file

@ -17,8 +17,11 @@ func TestServiceFlagStringer(t *testing.T) {
{SFNodeGetUTXO, "SFNodeGetUTXO"}, {SFNodeGetUTXO, "SFNodeGetUTXO"},
{SFNodeBloom, "SFNodeBloom"}, {SFNodeBloom, "SFNodeBloom"},
{SFNodeWitness, "SFNodeWitness"}, {SFNodeWitness, "SFNodeWitness"},
{SFNodeXthin, "SFNodeXthin"},
{SFNodeBit5, "SFNodeBit5"},
{SFNodeCF, "SFNodeCF"}, {SFNodeCF, "SFNodeCF"},
{0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|SFNodeCF|0xffffffe0"}, {SFNode2X, "SFNode2X"},
{0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|SFNodeXthin|SFNodeBit5|SFNodeCF|SFNode2X|0xffffff00"},
} }
t.Logf("Running %d tests", len(tests)) t.Logf("Running %d tests", len(tests))