Skip to content

Commit d4a2d35

Browse files
committed
Remove ScriptVerifyStatus type and constants
Use C API constants directly instead of wrapping them in Go types. The status codes were only used internally for error checking and never exposed in the public API.
1 parent 9f9a1da commit d4a2d35

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

kernel/script_pubkey.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,11 @@ func (s *scriptPubkeyApi) Verify(amount int64, txTo *Transaction, spentOutputs [
125125
&cStatus,
126126
)
127127

128-
status := ScriptVerifyStatus(cStatus)
129-
130128
// Check for errors that prevented verification
131-
if status == ScriptVerifyErrorInvalidFlagsCombination {
129+
if cStatus == C.btck_ScriptVerifyStatus_ERROR_INVALID_FLAGS_COMBINATION {
132130
return false, ErrVerifyScriptVerifyInvalidFlagsCombination
133131
}
134-
if status == ScriptVerifyErrorSpentOutputsRequired {
132+
if cStatus == C.btck_ScriptVerifyStatus_ERROR_SPENT_OUTPUTS_REQUIRED {
135133
return false, ErrVerifyScriptVerifySpentOutputsRequired
136134
}
137135

@@ -155,12 +153,3 @@ const (
155153
ScriptFlagsVerifyTaproot ScriptFlags = C.btck_ScriptVerificationFlags_TAPROOT // Enable TAPROOT (BIPs 341 & 342)
156154
ScriptFlagsVerifyAll ScriptFlags = C.btck_ScriptVerificationFlags_ALL // All verification flags combined
157155
)
158-
159-
// ScriptVerifyStatus represents a collection of status codes that may be issued by the script verify function.
160-
type ScriptVerifyStatus C.btck_ScriptVerifyStatus
161-
162-
const (
163-
ScriptVerifyOK ScriptVerifyStatus = C.btck_ScriptVerifyStatus_OK // Script verification succeeded
164-
ScriptVerifyErrorInvalidFlagsCombination ScriptVerifyStatus = C.btck_ScriptVerifyStatus_ERROR_INVALID_FLAGS_COMBINATION // The verification flags were combined in an invalid way
165-
ScriptVerifyErrorSpentOutputsRequired ScriptVerifyStatus = C.btck_ScriptVerifyStatus_ERROR_SPENT_OUTPUTS_REQUIRED // The taproot flag was set, so valid spent outputs must be provided
166-
)

0 commit comments

Comments
 (0)