mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-13 04:50:11 +00:00

* [NOD-592] Remove TODOs related to fake nonces. * [NOD-592] Remove irrelevant TODOs from handleRescanBlocks and parseTxAcceptedVerboseNtfnParams. * [NOD-592] Fix TODO in handleGetTxOut. * [NOD-592] Remove irrelevant TODO from updateAddress. * [NOD-592] Move StandardVerifyFlags to a separate file. * [NOD-592] Remove TODOs in sign.go. * [NOD-592] Remove TODO in scriptval_test.go. * [NOD-592] Remove TODO in reachabilitystore.go. * [NOD-592] Remove XXXs. * [NOD-592] Fix a comment. * [NOD-557] Move AddAddressByIP out of AddressManager since it's used only for tests.. * [NOD-557] Remove rescan blocks. * [NOD-592] Fix handleGetTxOut.
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
// Copyright (c) 2013-2017 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package blockdag
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/kaspanet/kaspad/domain/txscript"
|
|
)
|
|
|
|
// TestCheckBlockScripts ensures that validating the all of the scripts in a
|
|
// known-good block doesn't return an error.
|
|
func TestCheckBlockScripts(t *testing.T) {
|
|
t.Skip()
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
|
|
testBlockNum := 277647
|
|
blockDataFile := fmt.Sprintf("%d.dat", testBlockNum)
|
|
blocks, err := LoadBlocks(filepath.Join("testdata/", blockDataFile))
|
|
if err != nil {
|
|
t.Errorf("Error loading file: %v\n", err)
|
|
return
|
|
}
|
|
if len(blocks) > 1 {
|
|
t.Errorf("The test block file must only have one block in it")
|
|
return
|
|
}
|
|
if len(blocks) == 0 {
|
|
t.Errorf("The test block file may not be empty")
|
|
return
|
|
}
|
|
|
|
storeDataFile := fmt.Sprintf("%d.utxostore", testBlockNum)
|
|
utxoSet, err := loadUTXOSet(storeDataFile)
|
|
if err != nil {
|
|
t.Errorf("Error loading txstore: %v\n", err)
|
|
return
|
|
}
|
|
|
|
node := &blockNode{
|
|
hash: blocks[0].Hash(),
|
|
}
|
|
|
|
scriptFlags := txscript.ScriptNoFlags
|
|
err = checkBlockScripts(node, utxoSet, blocks[0].Transactions(), scriptFlags, nil)
|
|
if err != nil {
|
|
t.Errorf("Transaction script validation failed: %v\n", err)
|
|
return
|
|
}
|
|
}
|