UnstoppableSwap / core

Bitcoin–Monero Cross-chain Atomic Swap (+ GUI)
GNU General Public License v3.0
22 stars 6 forks source link

Swap which was cancelled over 85 blocks ago has not sent punish transaction #197

Closed darkness-su closed 2 days ago

darkness-su commented 2 days ago

Describe the bug I have a swap which was cancelled over 85 blocks ago but ASB has not sent punish transaction Trying to punish manually fails

| 937b599e-c2bf-422e-8312-4e25f3348c97 | btc is cancelled |

Lost/trapped Funds Yes (~6 XMR equivalent in BTC)

Debug logs

➜  mainnet git:(main) ✗ docker compose logs mainnet_asb_cheap | grep "937b599e-c2bf-422e-8312-4e25f3348c97"
mainnet_asb_cheap  | {"timestamp":"2024-11-19T22:21:38.827745907Z","level":"INFO","fields":{"message":"Resuming swap","swap_id":"937b599e-c2bf-422e-8312-4e25f3348c97"}}
mainnet_asb_cheap  | {"timestamp":"2024-11-19T22:21:38.828024055Z","level":"INFO","fields":{"message":"Advancing state","state":"btc is cancelled","rate":"NaN"},"span":{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-19T22:21:39.208208505Z","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"5428a8acadfd80f0f1c59e600f3537f8492b2a921583fcfaae2727bb96ea3ee8","status":"confirmed with 3 blocks"},"span":{"name":"BitcoinWalletSubscription"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},{"name":"BitcoinWalletSubscription"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-19T22:21:39.58734105Z","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"2cd10d915d03c68f49cd25d21b087a2c955d6da9d345816659f34cda31249902","status":"unseen"},"span":{"name":"BitcoinWalletSubscription"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},{"name":"BitcoinWalletSubscription"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:22:38.480258333Z","level":"INFO","fields":{"message":"Resuming swap","swap_id":"937b599e-c2bf-422e-8312-4e25f3348c97"}}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:22:38.480598955Z","level":"INFO","fields":{"message":"Advancing state","state":"btc is cancelled","rate":"NaN"},"span":{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:22:38.863006975Z","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"5428a8acadfd80f0f1c59e600f3537f8492b2a921583fcfaae2727bb96ea3ee8","status":"confirmed with 85 blocks"},"span":{"name":"BitcoinWalletSubscription"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},{"name":"BitcoinWalletSubscription"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:22:39.242092276Z","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"2cd10d915d03c68f49cd25d21b087a2c955d6da9d345816659f34cda31249902","status":"unseen"},"span":{"name":"BitcoinWalletSubscription"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},{"name":"BitcoinWalletSubscription"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:26:48.551723559Z","level":"INFO","fields":{"message":"Resuming swap","swap_id":"937b599e-c2bf-422e-8312-4e25f3348c97"}}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:26:48.551874983Z","level":"INFO","fields":{"message":"Advancing state","state":"btc is cancelled","rate":"NaN"},"span":{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:26:48.932129598Z","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"5428a8acadfd80f0f1c59e600f3537f8492b2a921583fcfaae2727bb96ea3ee8","status":"confirmed with 85 blocks"},"span":{"name":"BitcoinWalletSubscription"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},{"name":"BitcoinWalletSubscription"}]}
mainnet_asb_cheap  | {"timestamp":"2024-11-20T12:26:49.312704667Z","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"2cd10d915d03c68f49cd25d21b087a2c955d6da9d345816659f34cda31249902","status":"unseen"},"span":{"name":"BitcoinWalletSubscription"},"spans":[{"id":"937b599e-c2bf-422e-8312-4e25f3348c97","name":"swap"},{"name":"BitcoinWalletSubscription"}]}
➜  mainnet git:(main) ✗ docker compose run --rm mainnet_asb_cheap asb --config=/asb-data/config_mainnet.toml manual-recovery punish --swap-id 937b599e-c2bf-422e-8312-4e25f3348c97

[+] Creating 4/0
 ✔ Container mainnet_monerod            Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_bitcoind           Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_monero-wallet-rpc  Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_electrs            Running                                                                                                                                                               0.0s 
2024-11-20T12:26:16.594526318Z  INFO Initialized tracing. General logs will be written to swap-all.log, and verbose logs to tracing*.log level_filter=debug logs_dir=/asb-data/logs
2024-11-20T12:26:16.594631392Z DEBUG Reading in seed from /asb-data/seed.pem
2024-11-20T12:26:16.594667003Z DEBUG Using existing sqlite database.
2024-11-20T12:26:16.596929712Z DEBUG Opening Bitcoin wallet
2024-11-20T12:26:21.149513779Z  INFO Trying to manually punish swap swap_id=937b599e-c2bf-422e-8312-4e25f3348c97
2024-11-20T12:26:21.72984099Z DEBUG BitcoinWalletSubscription: Found relevant Bitcoin transaction txid=730e4106c2c2feaee461ac73dbc8de1a9ab63ac2b4390015b863a5aa7e1210c9 status=unseen
Error: Failed to broadcast Bitcoin punish transaction 730e4106c2c2feaee461ac73dbc8de1a9ab63ac2b4390015b863a5aa7e1210c9

Caused by:
    Electrum client error: Electrum server error: {"code":1,"message":"the transaction was rejected by network rules.\n\nnon-BIP68-final\n[02000000000101e83eea96bb2727aefafc8315922a2b49f837350f609ec5f1f080fdadaca82854000000000090000000015b110f000000000016001436698a2455866cf0faa22bfe98ae1d7ef332680d0347304402203783ceda7af772cd31913334f7eb5817e4554d08781b423d820658e5d89a95bc0220369af4a978b843eb9cb7e4fe4e7ed6ae5cc9f74a2bbe669bf36d4c286469a25101473044022040ab660408d97ad18aa723f76d267eb79919a3e16f01c0031d955b2e9f661455022032aa0f9b43da6db5606f9c5eb0649a9ae1857dfcdf0889019ecdf9875aa9e97701462102737afaef8baed9cbc0288c90a2a4e5ec949e0834a0d8a1c8c18f85113c6b6197ad210210f96338797fbab1de377de9362ec5cc4b972e8a8dcc7dc136a85527baf56531ac00000000]"}

The cancel transaction is definitely the one with 85 blocks because ID corresponds when I try manual cancel

➜  mainnet git:(main) ✗ docker compose run --rm mainnet_asb_cheap asb --config=/asb-data/config_mainnet.toml manual-recovery cancel --swap-id 937b599e-c2bf-422e-8312-4e25f3348c97

[+] Creating 4/0
 ✔ Container mainnet_bitcoind           Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_monerod            Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_electrs            Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_monero-wallet-rpc  Running                                                                                                                                                               0.0s 
2024-11-20T12:25:48.899122037Z  INFO Initialized tracing. General logs will be written to swap-all.log, and verbose logs to tracing*.log level_filter=debug logs_dir=/asb-data/logs
2024-11-20T12:25:48.899232196Z DEBUG Reading in seed from /asb-data/seed.pem
2024-11-20T12:25:48.899269495Z DEBUG Using existing sqlite database.
2024-11-20T12:25:48.901083972Z DEBUG Opening Bitcoin wallet
2024-11-20T12:25:54.023325025Z DEBUG BitcoinWalletSubscription: Found relevant Bitcoin transaction txid=5428a8acadfd80f0f1c59e600f3537f8492b2a921583fcfaae2727bb96ea3ee8 status=confirmed with 85 blocks
Error: Failed to broadcast Bitcoin cancel transaction 5428a8acadfd80f0f1c59e600f3537f8492b2a921583fcfaae2727bb96ea3ee8

Caused by:
    Electrum client error: Electrum server error: {"code":1,"message":"the transaction was rejected by network rules.\n\nTransaction already in block chain\n[02000000000101ae8b3da68f8f6090f5a8642a37d2dd5dcf63629a0c6f36aebd1f7ebb9ad1f33e00000000004800000001171c0f0000000000220020cda4f40e1f542e58deda1e176627ac31a7952bf07a3f4b131c228c110cd1a1b503473044022050d5e4c4009a824796a6f47763246d5e9042b802a390eed59bbed719c903b78a02204807326875a642f4b5806e323826b5a45261ac8a3e97fcd3b1efb68abfde7a6f01483045022100add60d75f9a5c1a5b40968b05e5bb9e54925577fe321ad80d61123ac14ae69ef02200be9c12283961e490ba1909a65ef22dd6d42cf37fe74aaad551494d32027048301462102737afaef8baed9cbc0288c90a2a4e5ec949e0834a0d8a1c8c18f85113c6b6197ad210210f96338797fbab1de377de9362ec5cc4b972e8a8dcc7dc136a85527baf56531ac00000000]"}

Attempting a refund gives:

➜  mainnet git:(main) ✗ docker compose stop mainnet_asb_cheap                                                                                                              
[+] Stopping 1/1
 ✔ Container mainnet_asb_cheap  Stopped                                                                                                                                                                      10.2s 
➜  mainnet git:(main) ✗ docker compose run --rm mainnet_asb_cheap asb --config=/asb-data/config_mainnet.toml manual-recovery refund --swap-id 937b599e-c2bf-422e-8312-4e25f3348c97

[+] Creating 4/0
 ✔ Container mainnet_monerod            Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_monero-wallet-rpc  Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_bitcoind           Running                                                                                                                                                               0.0s 
 ✔ Container mainnet_electrs            Running                                                                                                                                                               0.0s 
2024-11-20T15:27:57.816197487Z  INFO Initialized tracing. General logs will be written to swap-all.log, and verbose logs to tracing*.log level_filter=debug logs_dir=/asb-data/logs
2024-11-20T15:27:57.816327151Z DEBUG Reading in seed from /asb-data/seed.pem
2024-11-20T15:27:57.816376488Z DEBUG Using existing sqlite database.
2024-11-20T15:27:57.817753235Z DEBUG Opening Bitcoin wallet
2024-11-20T15:28:02.497963448Z DEBUG Opening Monero wallet
2024-11-20T15:28:03.318367567Z  INFO Trying to manually refund swap swap_id=937b599e-c2bf-422e-8312-4e25f3348c97
Error: Counterparty 12D3KooWFoWW4goyENhrDr99V6G8HFAEaNJCp2kzhhryfrst2wWk did not refund the BTC yet. You can try again later or try to punish.

Platform (please complete the following information):

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"