Skip to content

fix(swaps): retry refund of maker swap v1 payment until successful#2132

Closed
shamardy wants to merge 2 commits intodevfrom
fix-swap-payments-retry
Closed

fix(swaps): retry refund of maker swap v1 payment until successful#2132
shamardy wants to merge 2 commits intodevfrom
fix-swap-payments-retry

Conversation

@shamardy
Copy link
Collaborator

@shamardy shamardy commented Jun 4, 2024

Related to #1941, #1703
More description will be added

@cipig
Copy link

cipig commented Jun 4, 2024

there are swaps that show this error on recover_funds_of_swap call:

e9249da7-03b0-4364-b8be-38f19cd63563
{
   "error" : "rpc:215] dispatcher_legacy:141] lp_swap:1402] saved_swap:111] maker_swap:1542] mm2src/coins/utxo/utxo_common.rs:2125] rpc_clients:2228] ResponseParseError(JsonRpcError { client_info: \"coin: DOGE\", request: JsonRpcRequest { jsonrpc: \"2.0\", id: \"75182\", method: \"blockchain.transaction.broadcast\", params: [String(\"01000000015e2eaf4d66e073ce853ba279d4142efce9d0e77a95899bf52e6d440edde5c39600000000b647304402206efba1e9a089bbecfbde544c125f207d3847f4e600d7d4ee17b32e1a9b313bf402202956b8cf5d93a88375556245e65a94cae717ce1ed84e85b6fbfdad76a49cc41b01514c6b63043a8eda65b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a9140543d68b6784de33975950a2e92871851de787698821024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5ac68feffffff01f972d3221b0000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac9e1a5f66\")] }, error: Response(electrum1.cipig.net:10060, Object({\"code\": Number(1), \"message\": String(\"the transaction was rejected by network rules.\\n\\nMissing inputs\\n[01000000015e2eaf4d66e073ce853ba279d4142efce9d0e77a95899bf52e6d440edde5c39600000000b647304402206efba1e9a089bbecfbde544c125f207d3847f4e600d7d4ee17b32e1a9b313bf402202956b8cf5d93a88375556245e65a94cae717ce1ed84e85b6fbfdad76a49cc41b01514c6b63043a8eda65b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a9140543d68b6784de33975950a2e92871851de787698821024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5ac68feffffff01f972d3221b0000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac9e1a5f66]\")})) })"
}

wonder what will happen to those? will mm2 retry those indefinitely?

this is the swap json from this swap on maker:

{
   "error_events" : [
      "StartFailed",
      "NegotiateFailed",
      "TakerFeeValidateFailed",
      "MakerPaymentTransactionFailed",
      "MakerPaymentDataSendFailed",
      "MakerPaymentWaitConfirmFailed",
      "TakerPaymentValidateFailed",
      "TakerPaymentWaitConfirmFailed",
      "TakerPaymentSpendFailed",
      "TakerPaymentSpendConfirmFailed",
      "MakerPaymentWaitRefundStarted",
      "MakerPaymentRefundStarted",
      "MakerPaymentRefunded",
      "MakerPaymentRefundFailed",
      "MakerPaymentRefundFinished"
   ],
   "events" : [
      {
         "event" : {
            "data" : {
               "lock_duration" : 7800,
               "maker_amount" : "1165.637020528194720045664515132669711351161032376322105600331621768099068144366543616458032172860479",
               "maker_coin" : "DOGE",
               "maker_coin_htlc_pubkey" : "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732",
               "maker_coin_start_block" : 5103685,
               "maker_payment_confirmations" : 2,
               "maker_payment_lock" : 1708822074,
               "maker_payment_requires_nota" : false,
               "maker_payment_trade_fee" : {
                  "amount" : "0.001",
                  "coin" : "DOGE",
                  "paid_from_trading_vol" : false
               },
               "my_persistent_pub" : "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732",
               "p2p_privkey" : null,
               "secret" : "4f1779b6e335889f615ea8517aaf39f69005d22d4b53011217b1011279ff5d87",
               "secret_hash" : "0543d68b6784de33975950a2e92871851de78769",
               "started_at" : 1708806474,
               "taker" : "4915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5",
               "taker_amount" : "323.817172835195199137472",
               "taker_coin" : "KMD",
               "taker_coin_htlc_pubkey" : "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732",
               "taker_coin_start_block" : 3820036,
               "taker_payment_confirmations" : 4,
               "taker_payment_requires_nota" : false,
               "taker_payment_spend_trade_fee" : {
                  "amount" : "0.00001",
                  "coin" : "KMD",
                  "paid_from_trading_vol" : true
               },
               "uuid" : "e9249da7-03b0-4364-b8be-38f19cd63563"
            },
            "type" : "Started"
         },
         "timestamp" : 1708806474660
      },
      {
         "event" : {
            "data" : {
               "maker_coin_htlc_pubkey" : "024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5",
               "maker_coin_swap_contract_addr" : null,
               "taker_coin_htlc_pubkey" : "024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5",
               "taker_coin_swap_contract_addr" : null,
               "taker_payment_locktime" : 1708814280,
               "taker_pubkey" : "000000000000000000000000000000000000000000000000000000000000000000"
            },
            "type" : "Negotiated"
         },
         "timestamp" : 1708806490665
      },
      {
         "event" : {
            "data" : null,
            "type" : "MakerPaymentInstructionsReceived"
         },
         "timestamp" : 1708806493674
      },
      {
         "event" : {
            "data" : {
               "tx_hash" : "27be4e954de5606066ba090338a0c2dc2a933650ab0bbaa495a957f206a04563",
               "tx_hex" : "0400008085202f890142a6b74e4737f61550774ad1093c63b55a6fde8a907b3c8b9bbfe5aa620c9255020000006b483045022100bf0206a20c4398dcd58a19e16bab35ff51eb46603022b1798eab5cf46b3866af02205356f97d31a66445d25b7439d8d456f345195a7555c8919f8403f8cc8ca084890121024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5ffffffff03133ead01000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88acb1148f0000000000016a8e9203a4000000001976a914adc49d0c05b7de22bc753a6410333d91a876ad8188ac5e49da65000000000000000000000000000000"
            },
            "type" : "TakerFeeValidated"
         },
         "timestamp" : 1708806493675
      },
      {
         "event" : {
            "data" : {
               "tx_hash" : "96c3e5dd0e446d2ef59b89957ae7d0e9fc2e14d479a23b85ce73e0664daf2e5e",
               "tx_hex" : "0100000007fdbfcc26ce7b50496818b17ac0a66476355f461c818c3a1cafb76f934d4366b5020000006b483045022100f9713795a91eeaa3e31c970d1292fae48bea212b9f2f36f2f9f982ec65e68f6f022039ecdf3fe8ef02d98d4a5669bf570f52db473c2da9cd6aa6de024bc02288794f01210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff4d3aa44cdd7ff87420ca05a30076f588a2523cba9a74638814f27a5542a1b986000000006a47304402204d0a9ccfe89bc9b9326d7ee071d0ff0c65e05da123d236c3fdb84b6f2e7ee0f402204ace8153ff06e38a6186e302fcccf36f3c48b0c85ff2299be3d42a4fd553a91301210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff725300db71c4b41c4b6bee38182bdc9960aee1235c77ea965a2154b1fb61218f000000006b48304502210082dca734dbce1e68b97bd22f5f30099e33d87ea09ec9ecedf296df5470e9f77f02207c999146f0709025ddab260cef0affc2a2a9de2f1729e9376d3d5fd04af7e2c401210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff01c23ff34a05418ac501f628d989dd6e0cd9f553569f28220877a80659bb1e50000000006b483045022100bf3583b43b21bfd8aac95c622f6aac6e759cdfe1256ed1faaae0c016e81b6a76022076ef0cef42b61db66baffbf665373875ebf03b84c44234496afcb0adf3a7e0e001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff435a2a43a023a82062ff5fe7b0557d92db7f5f449d0504e9b7c80e6c348c34b4000000006a473044022053798632dd1d4891f64b3375091e79a3adc50a7595e9482cc6950bd078ce932b022057e35a9b693d540945b5b2986111087613579e1bc7218626de6ae968ede0c77801210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff09c01eb314103dd9e37a21704063b543301ad1a1e5598903062872ac24062467000000006a47304402200f8ef1e46ab2ede9b5d58b2a80dffdd2871ee0adceead81829cc80f45879bacf02201894dc6e6c0fe738f9dc03bf225a720a4c17e65beb31bea03fc90feac4b8b2ba01210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff0d28c131051cad1e2f9fb37190b1912a4596e4d1eb7d414a4c15e66d41a2b80c000000006b48304502210090a1269034479a5bd13478d0bdba088bb41864f2abe8dac0a59f3f53060bf29002202dbf6fa9e73962971daed7e6590681d8ff2100593ce219e3a260ce8be1bd165201210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff0324f1bc231b00000017a9144b48c21ea75ebff3a744671f77b22ec125c105fe870000000000000000166a140543d68b6784de33975950a2e92871851de78769b68806b8050000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac5d51da65"
            },
            "type" : "MakerPaymentSent"
         },
         "timestamp" : 1708806494761
      },
      {
         "event" : {
            "data" : {
               "error" : "maker_swap:922] !wait for maker payment confirmations: rpc_clients:158] Waited too long until 1708809594 for transaction 96c3e5dd0e446d2ef59b89957ae7d0e9fc2e14d479a23b85ce73e0664daf2e5e to be confirmed 2 times"
            },
            "type" : "MakerPaymentWaitConfirmFailed"
         },
         "timestamp" : 1708809609462
      },
      {
         "event" : {
            "data" : {
               "wait_until" : 1708825774
            },
            "type" : "MakerPaymentWaitRefundStarted"
         },
         "timestamp" : 1708809609465
      },
      {
         "event" : {
            "type" : "MakerPaymentRefundStarted"
         },
         "timestamp" : 1708809609468
      },
      {
         "event" : {
            "data" : {
               "error" : "maker_swap:1244] !maker_coin.send_maker_refunds_payment: mm2src/coins/utxo/utxo_common.rs:2125] rpc_clients:2228] ResponseParseError(JsonRpcError { client_info: \"coin: DOGE\", request: JsonRpcRequest { jsonrpc: \"2.0\", id: \"200431\", method: \"blockchain.transaction.broadcast\", params: [String(\"01000000015e2eaf4d66e073ce853ba279d4142efce9d0e77a95899bf52e6d440edde5c39600000000b647304402203b34f0cbaa681bb7a1506cc6524845994a9143b808b7ca0c1a6090debd901651022009f591ef1fdd11be51ab16bd70608f678a1a38b18bff4ff90e5808a552b40ce001514c6b63043a8eda65b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a9140543d68b6784de33975950a2e92871851de787698821024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5ac68feffffff01846abb231b0000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac878eda65\")] }, error: Response(electrum3.cipig.net:10060, Object({\"code\": Number(1), \"message\": String(\"the transaction was rejected by network rules.\\n\\nMissing inputs\\n[01000000015e2eaf4d66e073ce853ba279d4142efce9d0e77a95899bf52e6d440edde5c39600000000b647304402203b34f0cbaa681bb7a1506cc6524845994a9143b808b7ca0c1a6090debd901651022009f591ef1fdd11be51ab16bd70608f678a1a38b18bff4ff90e5808a552b40ce001514c6b63043a8eda65b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a9140543d68b6784de33975950a2e92871851de787698821024915d8e96068383c02211627c0cfba9c51d834b6d588cff0dc76531372e4acb5ac68feffffff01846abb231b0000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac878eda65]\")})) })"
            },
            "type" : "MakerPaymentRefundFailed"
         },
         "timestamp" : 1708822415047
      },
      {
         "event" : {
            "type" : "Finished"
         },
         "timestamp" : 1708822415053
      }
   ],
   "gui" : "mpm",
   "maker_amount" : "1165.637020528194720045664515132669711351161032376322105600331621768099068144366543616458032172860479",
   "maker_coin" : "DOGE",
   "maker_coin_usd_price" : null,
   "mm_version" : "2.0.0-beta_b0fd99e",
   "my_order_uuid" : "92d8c292-316f-453c-9932-ff4562890a5b",
   "success_events" : [
      "Started",
      "Negotiated",
      "MakerPaymentInstructionsReceived",
      "TakerFeeValidated",
      "MakerPaymentSent",
      "TakerPaymentReceived",
      "TakerPaymentWaitConfirmStarted",
      "TakerPaymentValidatedAndConfirmed",
      "TakerPaymentSpent",
      "TakerPaymentSpendConfirmStarted",
      "TakerPaymentSpendConfirmed",
      "Finished"
   ],
   "taker_amount" : "323.817172835195199137472",
   "taker_coin" : "KMD",
   "taker_coin_usd_price" : null,
   "type" : "Maker",
   "uuid" : "e9249da7-03b0-4364-b8be-38f19cd63563"
}

reason is that the to-be-refunded makerpayment never made it on to the blockchain, this tx does not exist on the explorer https://dogechain.info/chain/Dogecoin

            "data" : {
               "tx_hash" : "96c3e5dd0e446d2ef59b89957ae7d0e9fc2e14d479a23b85ce73e0664daf2e5e",
            },
            "type" : "MakerPaymentSent"

or does mm2 not retry this kind of failed swaps?
i do this manually because i simply look for all swaps that had MakerPaymentRefundFailed event in them, no matter of other events... maybe mm2 does not see this swap as refundable

@shamardy
Copy link
Collaborator Author

shamardy commented Jun 4, 2024

wonder what will happen to those? will mm2 retry those indefinitely?

Yep, mm2 will retry those indefinitely, thanks for noticing this. We can't skip the refund stage in case the transaction is actually on chain but the wait for confirmation took too long (problems in block production for certain chains), I think I should add a step to check if the transaction is on chain before retrying to refund forever, this should solve most problems.

@cipig
Copy link

cipig commented Jun 4, 2024

Yep, mm2 will retry those indefinitely, thanks for noticing this. We can't skip the refund stage in case the transaction is actually on chain but the wait for confirmation took too long

The tx from the swap i posted didn't even made it to the chain. The maker payment tx does not exist on chain. mm2 still tried to refund it later.

@shamardy
Copy link
Collaborator Author

shamardy commented Jun 4, 2024

The tx from the swap i posted didn't even made it to the chain. The maker payment tx does not exist on chain. mm2 still tried to refund it later.

I understand, but this error https://github.com/KomodoPlatform/komodo-defi-framework/blob/df6ab98b3b2ee84918bfc0bf1bc03d1e1f219985/mm2src/coins/utxo/rpc_clients.rs#L197-L205 should have been returned from wait for confirmation instead of the error returned here

{
"error" : "maker_swap:922] !wait for maker payment confirmations: rpc_clients:158] Waited too long until 1708809594 for transaction 96c3e5dd0e446d2ef59b89957ae7d0e9fc2e14d479a23b85ce73e0664daf2e5e to be confirmed 2 times"
}

Which makes me think that this transaction made it but was deleted from the mempool due some reason or confirmed then got deleted due to a chain reorganization, that's why we have to try to refund transactions either way and never assume that it never made it.

@mariocynicys
Copy link
Collaborator

Which makes me think that this transaction made it but was deleted from the mempool due some reason or confirmed then got deleted due to a chain reorganization, that's why we have to try to refund transactions either way and never assume that it never made it.

I think this error was returned just due to how wait_until and check_every played with each other. Maybe the swap was slow?

@shamardy
Copy link
Collaborator Author

shamardy commented Jun 4, 2024

I think this error was returned just due to how wait_until and check_every played with each other. Maybe the swap was slow?

@cipig said the transaction never made it to the chain and couldn't be refunded.

@cipig
Copy link

cipig commented Jun 4, 2024

@cipig said the transaction never made it to the chain and couldn't be refunded.

yes, makerpayment can't be found on explorer... could be that it initially made it to mempool, but was never mined and got removed later (DOGE has problems with mempool anyway because it's getting spammed by thousands of transactions)
i have more of such swaps, all with DOGE... so it's actually a corner case
question is what happens to mm2 or the electrums if mm2 retries such swaps forever every 60s or so

@shamardy
Copy link
Collaborator Author

shamardy commented Jun 4, 2024

question is what happens to mm2 or the electrums if mm2 retries such swaps forever every 60s or so

It will not retry it since I will add a step to check if the transaction is on chain before starting the retry loop.

… for all coins and then checked before retrying refunds
@cipig
Copy link

cipig commented Jun 5, 2024

It will not retry it since I will add a step to check if the transaction is on chain before starting the retry loop.

perfect

here is another failed swap that could stay in the loop forever:

{
   "error_events" : [
      "StartFailed",
      "NegotiateFailed",
      "TakerFeeValidateFailed",
      "MakerPaymentTransactionFailed",
      "MakerPaymentDataSendFailed",
      "MakerPaymentWaitConfirmFailed",
      "TakerPaymentValidateFailed",
      "TakerPaymentWaitConfirmFailed",
      "TakerPaymentSpendFailed",
      "TakerPaymentSpendConfirmFailed",
      "MakerPaymentWaitRefundStarted",
      "MakerPaymentRefundStarted",
      "MakerPaymentRefunded",
      "MakerPaymentRefundFailed",
      "MakerPaymentRefundFinished"
   ],
   "events" : [
      {
         "event" : {
            "data" : {
               "lock_duration" : 7800,
               "maker_amount" : "0.0002568089416639703460769386988502794439934376432980952473520564639287085505224530759048155253399939987",
               "maker_coin" : "DGB-segwit",
               "maker_coin_htlc_pubkey" : "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8",
               "maker_coin_start_block" : 18814335,
               "maker_payment_confirmations" : 7,
               "maker_payment_lock" : 1708827082,
               "maker_payment_requires_nota" : false,
               "maker_payment_trade_fee" : {
                  "amount" : "0.001",
                  "coin" : "DGB-segwit",
                  "paid_from_trading_vol" : false
               },
               "my_persistent_pub" : "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8",
               "p2p_privkey" : null,
               "secret" : "5bd99432a30cfe9db96975a02ddb10c22f1330b41fb46334690304a392cb18fd",
               "secret_hash" : "61bf9ad69eb88b763eb341ca4841ffe3451cc306",
               "started_at" : 1708811482,
               "taker" : "7ceec8aee038dc861a09880e75b10ce3013fd0df6f1f81d4e188a90a38b2d1de",
               "taker_amount" : "11.23897505464010282776349614395886889460154241645244215938303341902313624678663239074550128534704370",
               "taker_coin" : "NENG",
               "taker_coin_htlc_pubkey" : "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8",
               "taker_coin_start_block" : 5096772,
               "taker_payment_confirmations" : 2,
               "taker_payment_requires_nota" : false,
               "taker_payment_spend_trade_fee" : {
                  "amount" : "0.002",
                  "coin" : "NENG",
                  "paid_from_trading_vol" : true
               },
               "uuid" : "3830cf5f-3ac8-4842-b225-6879c7660bc3"
            },
            "type" : "Started"
         },
         "timestamp" : 1708811482473
      },
      {
         "event" : {
            "data" : {
               "maker_coin_htlc_pubkey" : "037ceec8aee038dc861a09880e75b10ce3013fd0df6f1f81d4e188a90a38b2d1de",
               "maker_coin_swap_contract_addr" : null,
               "taker_coin_htlc_pubkey" : "037ceec8aee038dc861a09880e75b10ce3013fd0df6f1f81d4e188a90a38b2d1de",
               "taker_coin_swap_contract_addr" : null,
               "taker_payment_locktime" : 1708819283,
               "taker_pubkey" : "000000000000000000000000000000000000000000000000000000000000000000"
            },
            "type" : "Negotiated"
         },
         "timestamp" : 1708811498477
      },
      {
         "event" : {
            "data" : null,
            "type" : "MakerPaymentInstructionsReceived"
         },
         "timestamp" : 1708811500486
      },
      {
         "event" : {
            "data" : {
               "tx_hash" : "9234b9da15ceaf4dbf9d3266dbb808f9d3506306587b244fe7531a195ae804cf",
               "tx_hex" : "01000000029832d7877b445dd2f46033a04dcd33e7214a0f21e054fa87338d9d100abaddf4020000006b4830450221009bba7780c0f5b09f486917ff86c100bc450a42fc04b5687b475e3aaa661e4cef02206138941ecb3fee47ab45636a2e1033e81963ff088b3c3eeea690fbe29c67495a0121037ceec8aee038dc861a09880e75b10ce3013fd0df6f1f81d4e188a90a38b2d1deffffffff3969a4cc64db7814b986f40ebc1f288601a964c5964c49378305c356c029bd0a000000006b483045022100c6aa2eb37b19274529c59ea058b1a8b0768525caa559385681df09a4ec08872a02205d7dcc1cbff0d06c2408cb7560a95a4f43e1d75dd40941958e603c8add29ca500121037ceec8aee038dc861a09880e75b10ce3013fd0df6f1f81d4e188a90a38b2d1deffffffff0239121600000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ace25d0043000000001976a9140a2dd7cf74940c66ba616a3493efd6585d2680fe88aceb64da65"
            },
            "type" : "TakerFeeValidated"
         },
         "timestamp" : 1708811500487
      },
      {
         "event" : {
            "data" : {
               "tx_hash" : "064f6e00fbc6fffca53f52792efa3ea90f66af80b5cfe0ad9ddf70f9b1a077b5",
               "tx_hex" : "01000000000101ec5a02048cbe90dd058d4ac9d514584d2be88d70a81a297dc68b3af112f514990200000000ffffffff03506400000000000017a914553913cc1fc15c34d3098ee2afc51659038e1e27870000000000000000166a1461bf9ad69eb88b763eb341ca4841ffe3451cc306ce50460200000000160014c3f710deb7320b0efa6edb14e3ebeeb9155fa90d0247304402206ab19fe3fed493086abc28b62a269c64577060a4cf41cd9ab46e201f7f2cef65022016a0a1102b833d87355b34a8461334bbe7baab0abc87e5d2c1f60f5cd051f0e20121031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ec64da65"
            },
            "type" : "MakerPaymentSent"
         },
         "timestamp" : 1708811500496
      },
      {
         "event" : {
            "data" : {
               "error" : "lp_swap:405] Timeout (4771 > 4770)"
            },
            "type" : "TakerPaymentValidateFailed"
         },
         "timestamp" : 1708816406280
      },
      {
         "event" : {
            "data" : {
               "wait_until" : 1708830782
            },
            "type" : "MakerPaymentWaitRefundStarted"
         },
         "timestamp" : 1708816406281
      },
      {
         "event" : {
            "type" : "MakerPaymentRefundStarted"
         },
         "timestamp" : 1708816406282
      },
      {
         "event" : {
            "data" : {
               "error" : "maker_swap:1244] !maker_coin.send_maker_refunds_payment: utxo_common:2101] HTLC spend fee 100000 is greater than transaction output 25680"
            },
            "type" : "MakerPaymentRefundFailed"
         },
         "timestamp" : 1708827276292
      },
      {
         "event" : {
            "type" : "Finished"
         },
         "timestamp" : 1708827276293
      }
   ],
   "gui" : "mpm",
   "maker_amount" : "0.0002568089416639703460769386988502794439934376432980952473520564639287085505224530759048155253399939987",
   "maker_coin" : "DGB-segwit",
   "maker_coin_usd_price" : null,
   "mm_version" : "2.0.0-beta_b0fd99e",
   "my_order_uuid" : "f0e9e7d8-3143-4aa4-a8c4-8598af4307dc",
   "success_events" : [
      "Started",
      "Negotiated",
      "MakerPaymentInstructionsReceived",
      "TakerFeeValidated",
      "MakerPaymentSent",
      "TakerPaymentReceived",
      "TakerPaymentWaitConfirmStarted",
      "TakerPaymentValidatedAndConfirmed",
      "TakerPaymentSpent",
      "TakerPaymentSpendConfirmStarted",
      "TakerPaymentSpendConfirmed",
      "Finished"
   ],
   "taker_amount" : "11.23897505464010282776349614395886889460154241645244215938303341902313624678663239074550128534704370",
   "taker_coin" : "NENG",
   "taker_coin_usd_price" : null,
   "type" : "Maker",
   "uuid" : "3830cf5f-3ac8-4842-b225-6879c7660bc3"
}

i mentioned the problem here: #1567
related to too low volume

@shamardy
Copy link
Collaborator Author

shamardy commented Dec 5, 2024

Superseded by #2280
@mariocynicys please include the forever looping problems mentioned here in a checklist so that we can solve them in the other PR or in new ones.

"error" : "maker_swap:1244] !maker_coin.send_maker_refunds_payment: utxo_common:2101] HTLC spend fee 100000 is greater than transaction output 25680"

This can be an irrecoverable error as it makes no sense for the user to try to get the funds when they will pay more fees than what they will get. But the problem is for some chains such as BTC, there can be fee spikes and they can get the funds later. We will need to think of a solution.

@shamardy shamardy closed this Dec 5, 2024
@cipig
Copy link

cipig commented Dec 5, 2024

This can be an irrecoverable error as it makes no sense for the user to try to get the funds when they will pay more fees than what they will get. But the problem is for some chains such as BTC, there can be fee spikes and they can get the funds later. We will need to think of a solution.

The specific problem happens on any chain when you swap a too low volume. The solution is to set min_volume of orders tp 10x txfee instead of 10x dust, like it is now.

@shamardy
Copy link
Collaborator Author

shamardy commented Dec 5, 2024

The solution is to set min_volume of orders tp 10x txfee instead of 10x dust, like it is now.

Makes sense, but what about chains with dynamic fees?

@cipig
Copy link

cipig commented Dec 5, 2024

Makes sense, but what about chains with dynamic fees?

There aren't that many left and we could try to switch those to fixed fee too, that is better anyway if you eg want to swap all your balance. The only one left where it also makes sense is BTC, but which has a min_volume set to 0.00777 anyway, so not affected by the problem. There is also DOGE though, which we switched backed from fixed to dynamic because of network congestion from an attack. Anyway, is the txfee not queried anyway when you post an order? If so, then it can be used to determine min_volume.

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 this pull request may close these issues.

3 participants