1 // Copyright (c) 2013-2017 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
12 "github.com/btcsuite/btcd/txscript"
15 // TestCheckBlockScripts ensures that validating the all of the scripts in a
16 // known-good block doesn't return an error.
17 func TestCheckBlockScripts(t *testing.T) {
18 runtime.GOMAXPROCS(runtime.NumCPU())
20 testBlockNum := 277647
21 blockDataFile := fmt.Sprintf("%d.dat.bz2", testBlockNum)
22 blocks, err := loadBlocks(blockDataFile)
24 t.Errorf("Error loading file: %v\n", err)
28 t.Errorf("The test block file must only have one block in it")
32 t.Errorf("The test block file may not be empty")
36 storeDataFile := fmt.Sprintf("%d.utxostore.bz2", testBlockNum)
37 view, err := loadUtxoView(storeDataFile)
39 t.Errorf("Error loading txstore: %v\n", err)
43 scriptFlags := txscript.ScriptBip16
44 err = checkBlockScripts(blocks[0], view, scriptFlags, nil, nil)
46 t.Errorf("Transaction script validation failed: %v\n", err)