func assertSoftForkStatus(r *rpctest.Harness, t *testing.T, forkKey string, state blockdag.ThresholdState) {
	status, err := thresholdStateToStatus(state)
	if err != nil {
		_, _, line, _ := runtime.Caller(1)
		t.Fatalf("assertion failed at line %d: unable to convert "+
			"threshold state %v to string", line, state)
	}
	info, err := r.Node.GetBlockChainInfo()
	if err != nil {
		t.Fatalf("failed to retrieve chain info: %v", err)
	}
	desc, ok := info.Bip9SoftForks[forkKey]
	if !ok {
		_, _, line, _ := runtime.Caller(1)
		t.Fatalf("assertion failed at line %d: softfork status for %q "+
			"is not in getblockchaininfo results", line, forkKey)
	}
	statusFound := false
	for _, statusString := range desc.Statuses {
		if status == statusString {
			statusFound = true
			break
		}
	}
	if !statusFound {
		_, _, line, _ := runtime.Caller(1)
		t.Fatalf("assertion failed at line %d: softfork status for %q "+
			", %v, not found in statuses %v", line, forkKey,
			status, desc.Statuses)
	}
}
assertSoftForkStatus retrieves the current blockchain info from the given
test harness and ensures the provided soft fork key is both available and its
status is the equivalent of the passed state.
package integration
import (
	"fmt"
	"runtime"
	"testing"
	"time"
	"github.com/soteria-dag/soterd/blockdag"
	"github.com/soteria-dag/soterd/chaincfg"
	"github.com/soteria-dag/soterd/chaincfg/chainhash"
	"github.com/soteria-dag/soterd/integration/rpctest"
)
const (
	vbLegacyBlockVersion = 4
	vbTopBits = 0x20000000
)
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<<bit) == 0:
		_, _, line, _ := runtime.Caller(1)
		t.Fatalf("assertion failed at line %d: block %s, version 0x%x "+
			"does not have bit %d set", line, hash,
			block.Header.Version, bit)
	case !set && block.Header.Version&(1<<bit) != 0:
		_, _, line, _ := runtime.Caller(1)
		t.Fatalf("assertion failed at line %d: block %s, version 0x%x "+
			"has bit %d set", line, hash, block.Header.Version, bit)
	}
}
func assertChainHeight(r *rpctest.Harness, t *testing.T, expectedHeight uint32) {
	height, err := r.Node.GetBlockCount()
	if err != nil {
		t.Fatalf("failed to retrieve block height: %v", err)
	}
	if uint32(height) != expectedHeight {
		_, _, line, _ := runtime.Caller(1)
		t.Fatalf("assertion failed at line %d: block height of %d "+
			"is not the expected %d", line, height, expectedHeight)
	}
}
func thresholdStateToStatus(state blockdag.ThresholdState) (string, error) {
	switch state {
	case blockdag.ThresholdDefined:
		return "defined", nil
	case blockdag.ThresholdStarted:
		return "started", nil
	case blockdag.ThresholdLockedIn:
		return "lockedin", nil
	case blockdag.ThresholdActive:
		return "active", nil
	case blockdag.ThresholdFailed:
		return "failed", nil
	}
	return "", fmt.Errorf("unrecognized threshold state: %v", state)
}