xbt_helpers_test.go raw

   1  package utxobuild_test
   2  
   3  import (
   4  	"encoding/hex"
   5  	"fmt"
   6  	"path/filepath"
   7  	"strings"
   8  	"testing"
   9  )
  10  
  11  // testdataPath is a captured body, under testdata/xbt for the fork's chain.
  12  func testdataPath(chain string, h uint32) string {
  13  	return filepath.Join("testdata", chain, fmt.Sprintf("body-%03d.hex", h))
  14  }
  15  
  16  func mustDecodeHex(t *testing.T, raw []byte) []byte {
  17  	t.Helper()
  18  	b, err := hex.DecodeString(strings.TrimSpace(string(raw)))
  19  	if err != nil {
  20  		t.Fatal(err)
  21  	}
  22  	return b
  23  }
  24