1b359e1131
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.
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
// Copyright (c) 2013-2016 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package wire
|
|
|
|
import "testing"
|
|
|
|
// TestServiceFlagStringer tests the stringized output for service flag types.
|
|
func TestServiceFlagStringer(t *testing.T) {
|
|
tests := []struct {
|
|
in ServiceFlag
|
|
want string
|
|
}{
|
|
{0, "0x0"},
|
|
{SFNodeNetwork, "SFNodeNetwork"},
|
|
{SFNodeGetUTXO, "SFNodeGetUTXO"},
|
|
{SFNodeBloom, "SFNodeBloom"},
|
|
{SFNodeWitness, "SFNodeWitness"},
|
|
{0xffffffff, "SFNodeNetwork|SFNodeGetUTXO|SFNodeBloom|SFNodeWitness|0xfffffff0"},
|
|
}
|
|
|
|
t.Logf("Running %d tests", len(tests))
|
|
for i, test := range tests {
|
|
result := test.in.String()
|
|
if result != test.want {
|
|
t.Errorf("String #%d\n got: %s want: %s", i, result,
|
|
test.want)
|
|
continue
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestBitcoinNetStringer tests the stringized output for bitcoin net types.
|
|
func TestBitcoinNetStringer(t *testing.T) {
|
|
tests := []struct {
|
|
in BitcoinNet
|
|
want string
|
|
}{
|
|
{MainNet, "MainNet"},
|
|
{TestNet, "TestNet"},
|
|
{TestNet3, "TestNet3"},
|
|
{SimNet, "SimNet"},
|
|
{0xffffffff, "Unknown BitcoinNet (4294967295)"},
|
|
}
|
|
|
|
t.Logf("Running %d tests", len(tests))
|
|
for i, test := range tests {
|
|
result := test.in.String()
|
|
if result != test.want {
|
|
t.Errorf("String #%d\n got: %s want: %s", i, result,
|
|
test.want)
|
|
continue
|
|
}
|
|
}
|
|
}
|