package neutrino import ( "testing" "git.smesh.lol/nostrino/pkg/btcwire" "git.smesh.lol/nostrino/pkg/chain" ) // TestPeerServicesAdvertisesTheFork: a forked chain's node holds a peer that // does not advertise the fork's bit to the last block the two chains share and // answers a header request above it with an empty message. The client has to // say it follows the fork before it asks. func TestPeerServicesAdvertisesTheFork(t *testing.T) { btc := &chain.Profile{Name: "btc"} if s := peerServices(btc); s&btcwire.ServiceNodeBlake2b != 0 { t.Fatalf("bitcoin mainnet advertises the forked chain bit: %#x", s) } xbt := &chain.Profile{Name: "xbt", HeaderV2Height: 961640} s := peerServices(xbt) if s&btcwire.ServiceNodeBlake2b == 0 { t.Fatalf("the forked chain does not advertise its bit: %#x", s) } if s&btcwire.ServiceNodeCompactFilters == 0 || s&btcwire.ServiceNodeWitness == 0 { t.Fatalf("the base service bits were dropped: %#x", s) } }