spacing_test.go raw
1 package utxobuild_test
2
3 import (
4 "testing"
5
6 "git.smesh.lol/nostrino/pkg/crypto/chainhash"
7
8 "git.smesh.lol/btcd-lite/internal/utxobuild"
9 )
10
11 // TestBuildNodeBodiesAtEverySpacing runs the builder over the node's bodies at
12 // several spacings, so "the range is too big" and "the base grows into a state
13 // the merge cannot handle" are told apart by which spacing first fails.
14 func TestBuildNodeBodiesAtEverySpacing(t *testing.T) {
15 src := nodeBodies(t)
16 for _, spacing := range []uint32{1, 2, 3, 5, 10} {
17 dir := t.TempDir()
18 utxobuild.Debug(nil, nil)
19 _, err := utxobuild.Build(utxobuild.Config{
20 Dir: dir, Interval: spacing, From: 0, To: 21, Blocks: src,
21 })
22 if err != nil {
23 t.Logf("spacing %d: %v", spacing, err)
24 continue
25 }
26 t.Logf("spacing %d: built", spacing)
27 }
28 _ = chainhash.Hash{}
29 }
30