From c18d8497670812ebc7355b7be7b853b6603c7667 Mon Sep 17 00:00:00 2001 From: Krzysztof Tomecki <152964795+chris-4chain@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:59:51 +0200 Subject: [PATCH 1/2] fix(SPV-000): proper error on SPV failure --- errors/definitions.go | 3 +++ server/p2p_receive_transaction.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/errors/definitions.go b/errors/definitions.go index 0dc39e4..cc52547 100644 --- a/errors/definitions.go +++ b/errors/definitions.go @@ -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"} ) diff --git a/server/p2p_receive_transaction.go b/server/p2p_receive_transaction.go index f6a2044..cc85b85 100644 --- a/server/p2p_receive_transaction.go +++ b/server/p2p_receive_transaction.go @@ -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 } From 4aae90f6e6d2c407e0d263ee65459ceaa403547b Mon Sep 17 00:00:00 2001 From: Krzysztof Tomecki <152964795+chris-4chain@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:29:30 +0200 Subject: [PATCH 2/2] fix(SPV-000): fix a test - moneybutton removed --- dns_sec_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/dns_sec_test.go b/dns_sec_test.go index c6ff3a6..6341a03 100644 --- a/dns_sec_test.go +++ b/dns_sec_test.go @@ -24,10 +24,8 @@ func TestClient_CheckDNSSEC(t *testing.T) { {"---", true}, {"---.---", true}, {"*.---", true}, - {"moneybutton", true}, {"asdfadfasdfasdfasdf10909.com", true}, {"google.com", false}, - {"moneybutton.com", true}, // {"relayx.io", false}, // Disabled for timeout issues {"cloudflare.com", false}, {"mrz1836.com", false},