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

core: redeem unknown match ID does not resolve. #3022

Open
JoeGruffins opened this issue Oct 15, 2024 · 1 comment · May be fixed by #3023
Open

core: redeem unknown match ID does not resolve. #3022

JoeGruffins opened this issue Oct 15, 2024 · 1 comment · May be fixed by #3023

Comments

@JoeGruffins
Copy link
Member

JoeGruffins commented Oct 15, 2024

Found by an mm user. If you have a match that makes it to redemption that is revoked by the server but you miss the revoke message, bisonw will continue to try to send a redemption but be met with the error:

2024-10-15 08:07:23.583 [ERR] CORE: notify: |ERROR| (order) Redeem reporting error - Error notifying DEX of redemption for match 72bdf8fc34dde82abdd1ccd8e33b2384e4282631de92e5af4089240ac4a8fc69: error sending 'redeem' message: rpc error: error code 6: unknown match ID - Order: 201196e096b15ab647bde6c0ee1328255c4939eb636249b5f1e24a2c55e0db87
2024-10-15 08:07:25.840 [DBG] CORE: Notifying DEX 127.0.0.1:17273 of our dcr swap redemption d4c7599c1d56ab34db4ff8f64392ebe0c2b49f820a39310b01168d5274433bcc:0 for match 72bdf8fc34dde82abdd1ccd8e33b2384e4282631de92e5af4089240ac4a8fc69
2024-10-15 08:07:25.840 [DBG] CORE: Soon to expire bond found: 0d1b7c9b6f133b3e52b8377e15e5c6b25eb8d0e9e971cc6ce868d9837a6b0cac:0 (dcr)
2024-10-15 08:07:25.840 [DBG] CORE: Expired bond 7ddcb0f21c59e74b3dbef09c93e472eebcb64080926b2dc03635cc65aab3de80:0 (dcr) with lock time 2024-10-15 17:05:14 +0900 JST not yet refundable according to wallet.
2024-10-15 08:07:25.855 [ERR] CORE: notify: |ERROR| (order) Redeem reporting error - Error notifying DEX of redemption for match 72bdf8fc34dde82abdd1ccd8e33b2384e4282631de92e5af4089240ac4a8fc69: error sending 'redeem' message: rpc error: error code 6: unknown match ID - Order: 201196e096b15ab647bde6c0ee1328255c4939eb636249b5f1e24a2c55e0db87
2024-10-15 08:07:28.331 [TRC] WEB[WS]: message of type 1 received for route acknotes
2024-10-15 08:07:33.339 [DBG] CORE: Notifying DEX 127.0.0.1:17273 of our dcr swap redemption d4c7599c1d56ab34db4ff8f64392ebe0c2b49f820a39310b01168d5274433bcc:0 for match 72bdf8fc34dde82abdd1ccd8e33b2384e4282631de92e5af4089240ac4a8fc69
2024-10-15 08:07:33.342 [ERR] CORE: notify: |ERROR| (order) Redeem reporting error - Error notifying DEX of redemption for match 72bdf8fc34dde82abdd1ccd8e33b2384e4282631de92e5af4089240ac4a8fc69: error sending 'redeem' message: rpc error: error code 6: unknown match ID - Order: 201196e096b15ab647bde6c0ee1328255c4939eb636249b5f1e24a2c55e0db87

The client never stops trying to send the redemption until restart and dc.compareServerMatches happens.

@JoeGruffins
Copy link
Member Author

Maybe it never resolves for taker. Can be induced with simnet and this diff. Move the chains manually and wait for server to revoke:

$ git diff
diff --git a/client/core/core.go b/client/core/core.go
index 8db99944b..b150fd968 100644
--- a/client/core/core.go
+++ b/client/core/core.go
@@ -8545,6 +8545,13 @@ func handleMatchProofMsg(c *Core, dc *dexConnection, msg *msgjson.Message) error
 
 // handleRevokeOrderMsg is called when a revoke_order message is received.
 func handleRevokeOrderMsg(c *Core, dc *dexConnection, msg *msgjson.Message) error {
+       fmt.Println("***** not really revoking order")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       return nil
        var revocation msgjson.RevokeOrder
        err := msg.Unmarshal(&revocation)
        if err != nil {
@@ -8587,6 +8594,13 @@ func handleRevokeOrderMsg(c *Core, dc *dexConnection, msg *msgjson.Message) erro
 
 // handleRevokeMatchMsg is called when a revoke_match message is received.
 func handleRevokeMatchMsg(c *Core, dc *dexConnection, msg *msgjson.Message) error {
+       fmt.Println("***** not really revoking match")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       fmt.Println("***** not really revoking")
+       return nil
        var revocation msgjson.RevokeMatch
        err := msg.Unmarshal(&revocation)
        if err != nil {
diff --git a/client/core/trade.go b/client/core/trade.go
index fc3584caa..6a18967c2 100644
--- a/client/core/trade.go
+++ b/client/core/trade.go
@@ -2831,6 +2831,9 @@ func (c *Core) redeemMatchGroup(t *trackedTrade, matches []*matchTracker, errs *
 // match and save the server's ack sig to db. Sends a notification if an error
 // occurs while sending the request or validating the server's response.
 func (c *Core) sendRedeemAsync(t *trackedTrade, match *matchTracker, coinID, secret []byte) {
+       if match.redemptionConfs < 1 {
+               return
+       }
        if !atomic.CompareAndSwapUint32(&match.sendingRedeemAsync, 0, 1) {
                return
        }

@JoeGruffins JoeGruffins linked a pull request Oct 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant