From a02b71bcf95fdbf9b3487b19367d1b3a57892c77 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Thu, 18 Apr 2019 21:12:34 -0700 Subject: [PATCH] txscript/reference_test: Convert sighash calc test This converts the tests for calculating signature hashes to use the exported function which handles the raw script versus the now deprecated variant requiring parsed opcodes. Backport of 06f769ef72e6042e7f2b5ff1c512ef1371d615e5 --- txscript/reference_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/txscript/reference_test.go b/txscript/reference_test.go index 6ac9b68f..9d9c8f39 100644 --- a/txscript/reference_test.go +++ b/txscript/reference_test.go @@ -836,6 +836,7 @@ func TestCalcSignatureHash(t *testing.T) { err) } + const scriptVersion = 0 for i, test := range tests { if i == 0 { // Skip first line -- contains comments only. @@ -855,15 +856,14 @@ func TestCalcSignatureHash(t *testing.T) { } subScript, _ := hex.DecodeString(test[1].(string)) - parsedScript, err := parseScript(subScript) - if err != nil { + if err := checkScriptParses(scriptVersion, subScript); err != nil { t.Errorf("TestCalcSignatureHash failed test #%d: "+ "Failed to parse sub-script: %v", i, err) continue } hashType := SigHashType(testVecF64ToUint32(test[3].(float64))) - hash, err := calcSignatureHash(parsedScript, hashType, &tx, + hash, err := CalcSignatureHash(subScript, hashType, &tx, int(test[2].(float64))) if err != nil { t.Errorf("TestCalcSignatureHash failed test #%d: "+