Skip to content

Commit

Permalink
fix(SPV-000): proper error on SPV failure
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain committed Oct 4, 2024
1 parent b1a379f commit c18d849
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

0 comments on commit c18d849

Please sign in to comment.