loop icon indicating copy to clipboard operation
loop copied to clipboard

[3/?] StaticAddr: Deposit tracking and timeout sweep

Open hieblmi opened this issue 1 year ago • 1 comments
trafficstars

It introduces tracking of deposits to a static address and monitoring of the CSV expiry. Instead of using RegisterConfirmationsNtfn to detect spends to a pkScript, we poll the lnd account of the imported static address taproot script and notify the main event loop of the manager about new deposits to a static address.

~Todo:~

~- state machine recovery~ ~- listening for timeout tx confirmations to be sure that the client claimed funds.~

hieblmi avatar Dec 20 '23 18:12 hieblmi

@bhandras: review reminder @sputn1ck: review reminder

lightninglabs-deploy avatar Mar 29 '24 16:03 lightninglabs-deploy

So far this looks good to me! Gonna try to do a test run in a bit

Thank you, for convenience, here are some steps I take to test this.

  • reduce the CSV value on the server to be able to timeout after 100 blocks or so.
  • create a static address on the client side loop --network=regtest s n
  • send coins to it reg_bob sendcoins --amt 9111123 --addr static_addr_here --min_confs 0
  • mine 3 blocks, otherwise the coins are not showing up in loop --network=regtest s list
  • check the deposit with loop --network=regtest s list
  • mine enough blocks to timeout the deposit...
  • restarting between any of these steps should recover

hieblmi avatar Apr 09 '24 07:04 hieblmi

Thanks for the review @bhandras, I plan to add some unit tests to increase test coverage.

hieblmi avatar Apr 19 '24 14:04 hieblmi