diff --git a/integration/bip0009_test.go b/integration/bip0009_test.go new file mode 100644 index 00000000..7de6137c --- /dev/null +++ b/integration/bip0009_test.go @@ -0,0 +1,131 @@ +// Copyright (c) 2016 The btcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// This file is ignored during the regular tests due to the following build tag. +// +build rpctest + +package integration + +import ( + "runtime" + "testing" + + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/rpctest" +) + +// assertVersionBit gets the passed block hash from the given test harness and +// ensures its version either has the provided bit set or unset per the set +// flag. +func assertVersionBit(r *rpctest.Harness, t *testing.T, hash *chainhash.Hash, bit uint8, set bool) { + block, err := r.Node.GetBlock(hash) + if err != nil { + t.Fatalf("failed to retrieve block %v: %v", hash, err) + } + switch { + case set && block.Header.Version&(1<