LNSwap / lnstxbridge

GNU Affero General Public License v3.0
17 stars 12 forks source link

check for expired swaps and cancel invoices #8

Closed pseudozach closed 3 years ago

pseudozach commented 3 years ago

Currently stacks-blockchain-api doesn't have a way to subscribe to blocks so we periodically check blockheight but now stacksnursery has no access to this information and can't check for expired swaps.

This leads to hold invoices not being canceled, which leads to channel force closures.

Requested this feature: https://github.com/blockstack/stacks-blockchain-api/issues/815

Need to apply a workaround meanwhile to avoid remote force closed channels, work ongoing with this commit: https://github.com/pseudozach/lnstxbridge/commit/768159e070ff2695293cb7589ee61644f075a9da

"channel_point": "00fb018580b0abf1ec0e94efa6450a4192cd0870ec1520fdc73c15bc08a78b78:1", "chan_id": "772749966163968001", "chain_hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", "closing_tx_hash": "bac8bbb1ce41cacae2f6a78b7be8a5317305fe49b9327d46f763b3ad3f95b3d7", "remote_pubkey": "02a90e3f7e3782bdd9b2da75dd6036122d589e5fc8ce0171ef9695b88f1f3b3320", "capacity": "3125131", "close_height": 703753, "settled_balance": "525528", "time_locked_balance": "0", "close_type": "REMOTE_FORCE_CLOSE", "open_initiator": "INITIATOR_REMOTE", "close_initiator": "INITIATOR_REMOTE", "resolutions": [ { "resolution_type": "INCOMING_HTLC", "outcome": "TIMEOUT", "outpoint": { "txid_bytes": "d7b3953fadb363f7467d32b949fe057331a5e87b8ba7f6e2caca41ceb1bbc8ba", "txid_str": "bac8bbb1ce41cacae2f6a78b7be8a5317305fe49b9327d46f763b3ad3f95b3d7", "output_index": 0 }, "amount_sat": "9116", "sweep_txid": "" }, { "resolution_type": "COMMIT", "outcome": "CLAIMED", "outpoint": { "txid_bytes": "d7b3953fadb363f7467d32b949fe057331a5e87b8ba7f6e2caca41ceb1bbc8ba", "txid_str": "bac8bbb1ce41cacae2f6a78b7be8a5317305fe49b9327d46f763b3ad3f95b3d7", "output_index": 1 }, "amount_sat": "525528", "sweep_txid": "1667fbb2595bc57972337b35185737cb8ec094e8dfaa34b2765de3a9a7eb6d9d" } ] },

pseudozach commented 3 years ago

fixed with https://github.com/pseudozach/lnstxbridge/commit/e06a059d53f55fccf5cdb72319cd4498e1919f30