breez / breez-sdk-liquid

MIT License
20 stars 5 forks source link

Failure to verify confirmed server transaction prevents claim #547

Open dangeross opened 1 day ago

dangeross commented 1 day ago

During an incoming chain swap and we receive a transaction.server.confirmed status, if we fail to verify that the transaction is confirmed then the swap stalls (until the SDK is next started)

[2024-11-06 14:58:55.369 INFO breez_sdk_liquid::swapper::boltz::status_stream:119] Received text msg: "{\"event\":\"update\",\"channel\":\"swap.update\",\"args\":[{\"id\":\"GHMXTonc4H2Y\",\"status\":\"transaction.server.mempool\",\"transaction\":{\"id\":\"4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1\",\"hex\":\"...\",\"eta\":2}}],\"timestamp\":\"1730901535425\"}"
[2024-11-06 14:58:55.376 INFO breez_sdk_liquid::chain_swap:258] Handling incoming Chain Swap transition to "transaction.server.mempool" for swap GHMXTonc4H2Y
[2024-11-06 14:58:55.379 INFO boltz_client::swaps::liquid:367] Taproot creation and verification success!
[2024-11-06 14:58:55.380 INFO breez_sdk_liquid::chain::liquid:184] Fetching script history for d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302
[2024-11-06 14:58:55.380 INFO breez_sdk_liquid::chain::liquid:279] liquid chain service get_with_retry for url https://lq1.breez.technology/liquid/api/scripthash/d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302/txs
[2024-11-06 14:58:55.381 DEBUG reqwest::connect:429] starting new connection: https://lq1.breez.technology/
[2024-11-06 14:58:55.729 INFO breez_sdk_liquid::chain::liquid:193] Script history for d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302 is empty, retrying in 1 second... (1 of 30)
[2024-11-06 14:58:56.731 INFO breez_sdk_liquid::chain::liquid:279] liquid chain service get_with_retry for url https://lq1.breez.technology/liquid/api/scripthash/d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302/txs
[2024-11-06 14:58:56.731 DEBUG reqwest::connect:429] starting new connection: https://lq1.breez.technology/
[2024-11-06 14:58:57.020 INFO breez_sdk_liquid::chain::liquid:193] Script history for d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302 is empty, retrying in 1 second... (2 of 30)
[2024-11-06 14:58:58.022 INFO breez_sdk_liquid::chain::liquid:279] liquid chain service get_with_retry for url https://lq1.breez.technology/liquid/api/scripthash/d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302/txs
[2024-11-06 14:58:58.022 DEBUG reqwest::connect:429] starting new connection: https://lq1.breez.technology/
[2024-11-06 14:58:58.308 INFO breez_sdk_liquid::chain::liquid:193] Script history for d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302 is empty, retrying in 1 second... (3 of 30)
[2024-11-06 14:58:58.511 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:143] Received ping
[2024-11-06 14:58:58.519 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:101] Sent keep-alive ping
[2024-11-06 14:58:58.699 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:144] Received pong
[2024-11-06 14:58:59.312 INFO breez_sdk_liquid::chain::liquid:279] liquid chain service get_with_retry for url https://lq1.breez.technology/liquid/api/scripthash/d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302/txs
[2024-11-06 14:58:59.312 DEBUG reqwest::connect:429] starting new connection: https://lq1.breez.technology/
[2024-11-06 14:58:59.615 INFO breez_sdk_liquid::chain::liquid:250] Liquid transaction found, verifying transaction content...
[2024-11-06 14:58:59.632 INFO breez_sdk_liquid::chain_swap:298] Server lockup mempool transaction was verified for incoming Chain Swap GHMXTonc4H2Y
[2024-11-06 14:58:59.632 INFO breez_sdk_liquid::chain_swap:664] Transitioning Chain swap GHMXTonc4H2Y to Pending (server_lockup_tx_id = Some("4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1"), user_lockup_tx_id = None, claim_tx_id = None), refund_tx_id = None)
[2024-11-06 14:58:59.634 INFO breez_sdk_liquid::sdk:344] Successfully handled Chain Swap GHMXTonc4H2Y update
[2024-11-06 14:59:03.350 INFO breez_sdk_liquid::sdk:2165] Synchronized with mempool and onchain data (t = 1269 ms)
[2024-11-06 14:59:03.350 INFO breez_liquid_cli:46] Received event: Synced
[2024-11-06 14:59:13.511 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:143] Received ping
[2024-11-06 14:59:13.518 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:101] Sent keep-alive ping
[2024-11-06 14:59:13.693 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:144] Received pong
[2024-11-06 14:59:28.510 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:143] Received ping
[2024-11-06 14:59:28.518 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:101] Sent keep-alive ping
[2024-11-06 14:59:28.690 DEBUG breez_sdk_liquid::swapper::boltz::status_stream:144] Received pong
[2024-11-06 14:59:34.768 INFO breez_sdk_liquid::sdk:2165] Synchronized with mempool and onchain data (t = 1415 ms)
[2024-11-06 14:59:34.768 INFO breez_liquid_cli:46] Received event: Synced
[2024-11-06 14:59:35.416 INFO breez_sdk_liquid::swapper::boltz::status_stream:119] Received text msg: "{\"event\":\"update\",\"channel\":\"swap.update\",\"args\":[{\"id\":\"GHMXTonc4H2Y\",\"status\":\"transaction.server.confirmed\",\"transaction\":{\"id\":\"4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1\",\"hex\":\"...\"}}],\"timestamp\":\"1730901575478\"}"
[2024-11-06 14:59:35.424 INFO breez_sdk_liquid::chain_swap:258] Handling incoming Chain Swap transition to "transaction.server.confirmed" for swap GHMXTonc4H2Y
[2024-11-06 14:59:35.425 INFO boltz_client::swaps::bitcoin:361] Taproot creation and verification success!
[2024-11-06 14:59:35.427 INFO breez_sdk_liquid::chain::bitcoin:163] Fetching script history for 1d063ee83172f7afd8eba05a7326cdc9d78f4a6271bb2bcfcf174e243cdf8e6c
[2024-11-06 14:59:35.427 WARN electrum_client::client:260] call 'script_get_history' failed with unexpected end of file, retry: 1/1
[2024-11-06 14:59:37.498 INFO electrum_client::client:260] Succesfully created new client
[2024-11-06 14:59:37.687 INFO boltz_client::swaps::liquid:367] Taproot creation and verification success!
[2024-11-06 14:59:37.687 INFO breez_sdk_liquid::chain::liquid:184] Fetching script history for d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302
[2024-11-06 14:59:37.687 INFO breez_sdk_liquid::chain::liquid:279] liquid chain service get_with_retry for url https://lq1.breez.technology/liquid/api/scripthash/d57271c00986481f9edfdbe3e9aaa06abe4d7196cda964c6d2847f122be6d302/txs
[2024-11-06 14:59:37.688 DEBUG reqwest::connect:429] starting new connection: https://lq1.breez.technology/
[2024-11-06 14:59:37.984 INFO breez_sdk_liquid::chain::liquid:250] Liquid transaction found, verifying transaction content...
[2024-11-06 14:59:37.987 WARN breez_sdk_liquid::chain_swap:332] Server lockup transaction for incoming Chain Swap GHMXTonc4H2Y could not be verified. txid: 4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1, err: Liquid transaction was not confirmed, txid=4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1 waiting for confirmation
[2024-11-06 14:59:37.987 ERROR breez_sdk_liquid::sdk:345] Failed to handle Chain Swap GHMXTonc4H2Y update: Could not verify server lockup transaction 4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1: Liquid transaction was not confirmed, txid=4f99a6d156af49054c40cc5c62d98cacc6c21df95c7e339d0680e60fcc31fbd1 waiting for confirmation
dangeross commented 1 day ago

Had this a second time today:

[2024-11-06 18:13:35.758 INFO breez_sdk_liquid::chain_swap:258] Handling incoming Chain Swap transition to "transaction.server.confirmed" for swap dutTQRc5etac
[2024-11-06 18:13:35.760 INFO boltz_client::swaps::bitcoin:361] Taproot creation and verification success!
[2024-11-06 18:13:35.760 INFO breez_sdk_liquid::chain::bitcoin:163] Fetching script history for 84ec1420659f7a74979d68ca2c97b0ac90550720ce1fd6ce50e113198cf38b52
[2024-11-06 18:13:35.901 INFO boltz_client::swaps::liquid:367] Taproot creation and verification success!
[2024-11-06 18:13:35.902 INFO breez_sdk_liquid::chain::liquid:184] Fetching script history for cfb4dab7437ee42a114b289d7b5821e8a5f878367c649bd6ee21707492c8b069
[2024-11-06 18:13:35.902 INFO breez_sdk_liquid::chain::liquid:279] liquid chain service get_with_retry for url https://lq1.breez.technology/liquid/api/scripthash/cfb4dab7437ee42a114b289d7b5821e8a5f878367c649bd6ee21707492c8b069/txs
[2024-11-06 18:13:35.903 DEBUG reqwest::connect:429] starting new connection: https://lq1.breez.technology/
[2024-11-06 18:13:36.383 INFO breez_sdk_liquid::chain::liquid:250] Liquid transaction found, verifying transaction content...
[2024-11-06 18:13:36.384 WARN breez_sdk_liquid::chain_swap:332] Server lockup transaction for incoming Chain Swap dutTQRc5etac could not be verified. txid: 64848ba431db2fc475b056ecf38d52eec5243a2d47647d3edafd9125a2fb2823, err: Liquid transaction was not confirmed, txid=64848ba431db2fc475b056ecf38d52eec5243a2d47647d3edafd9125a2fb2823 waiting for confirmation
[2024-11-06 18:13:36.384 ERROR breez_sdk_liquid::sdk:345] Failed to handle Chain Swap dutTQRc5etac update: Could not verify server lockup transaction 64848ba431db2fc475b056ecf38d52eec5243a2d47647d3edafd9125a2fb2823: Liquid transaction was not confirmed, txid=64848ba431db2fc475b056ecf38d52eec5243a2d47647d3edafd9125a2fb2823 waiting for confirmation