Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SPV-000): proper error on SPV failure #125

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions errors/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,7 @@ var (

// ErrNoMatchingTransactionsForInput is when no matching transaction for input can be found
ErrNoMatchingTransactionsForInput = SPVError{Message: "invalid parent transactions, no matching transactions for input", StatusCode: 417, Code: "error-spv-bump-ancestor-not-present"}

// ErrSPVFailed is when the SPV returns an error
ErrSPVFailed = SPVError{Message: "simplified payment verification has failed", StatusCode: 417, Code: "error-spv-failed"}
)
2 changes: 1 addition & 1 deletion server/p2p_receive_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (c *Configuration) p2pReceiveBeefTx(context *gin.Context) {

err = spv.ExecuteSimplifiedPaymentVerification(context.Request.Context(), dBeef, c.actions)
if err != nil {
errors.ErrorResponse(context, errors.ErrNoOutputs)
errors.ErrorResponse(context, errors.ErrSPVFailed)
return
}

Expand Down
Loading