package utxobuild_test import ( "os" "testing" "git.smesh.lol/btcd-lite/internal/utxobuild" ) // TestBuildOverTheForkBodies builds a checkpoint chain over the fork node's own // bodies, which the fork gate captures when it runs. The fork's headers are a // different size from Bitcoin's, so a parser that assumes either form fails // here and nowhere else. func TestBuildOverTheForkBodies(t *testing.T) { src := bodies{} for h := uint32(0); ; h++ { raw, err := os.ReadFile(testdataPath("xbt", h)) if err != nil { if h == 0 { t.Skip("no captured fork bodies") } break } src[h] = mustDecodeHex(t, raw) } dir := t.TempDir() _, err := utxobuild.Build(utxobuild.Config{Dir: dir, Interval: 20, From: 0, To: uint32(len(src)), Blocks: src, Logf: t.Logf}) if err != nil { t.Fatalf("build over the fork's bodies: %v", err) } }