// 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 ( "fmt" "runtime" "testing" "time" "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/integration/rpctest" ) const ( // vbLegacyBlockVersion is the highest legacy block version before the // version bits scheme became active. vbLegacyBlockVersion = 4 // vbTopBits defines the bits to set in the version to signal that the // version bits scheme is being used. vbTopBits = 0x20000000 ) // 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.Client.GetBlock(hash) if err != nil { t.Fatalf("failed to retrieve block %v: %v", hash, err) } switch { case set && block.Header.Version&(1< uint32(len(r.ActiveNet.Deployments)) { t.Fatalf("deployment ID %d does not exist", deploymentID) } deployment := &r.ActiveNet.Deployments[deploymentID] activationThreshold := r.ActiveNet.RuleChangeActivationThreshold signalForkVersion := int32(1<