func tstCheckScriptError(gotErr, wantErr error) error {
	if reflect.TypeOf(gotErr) != reflect.TypeOf(wantErr) {
		return fmt.Errorf("wrong error - got %T (%[1]v), want %T",
			gotErr, wantErr)
	}
	if gotErr == nil {
		return nil
	}
	werr, ok := wantErr.(Error)
	if !ok {
		return fmt.Errorf("unexpected test error type %T", wantErr)
	}
	gotErrorCode := gotErr.(Error).ErrorCode
	if gotErrorCode != werr.ErrorCode {
		return fmt.Errorf("mismatched error code - got %v (%v), want %v",
			gotErrorCode, gotErr, werr.ErrorCode)
	}
	return nil
}
tstCheckScriptError ensures the type of the two passed errors are of the
same type (either both nil or both of type Error) and their error codes
match when not nil.
package txscript
import (
	"bytes"
	"errors"
	"fmt"
	"reflect"
	"testing"
)