lightninglabs / pool

Lightning Pool: a non-custodial batched uniform clearing-price auction for Lightning Channel Leases (LCL). An LCL packages up inbound channel liquidity (ability to receive funds) as a fixed income asset with a maturity date expressed in blocks.
MIT License
256 stars 48 forks source link

[bug] Unable to recover accounts with a balance of less than 100k #281

Open dean-moreton opened 3 years ago

dean-moreton commented 3 years ago

I recently attempted to recover my pool account after having removed the Lightning Terminal app in Umbrel as part of troubleshooting connectivity. Upon running he accounts recover process it seemingly worked, but my account is now stuck in "PENDING_OPEN"

umbrel@hoz-umbrel:~$ sudo docker exec -it 412f /bin/bash
bash-5.1$ pool --tlscertpath=/data/.lit/tls.cert --rpcserver=localhost:8443 --macaroonpath=/data/.pool/mainnet/pool.macaroon accounts recover
{
        "num_recovered_accounts": 0
}
bash-5.1$ pool --tlscertpath=/data/.lit/tls.cert --rpcserver=localhost:8443 --macaroonpath=/data/.pool/mainnet/pool.macaroon accounts list
{
        "accounts": [
                {
                        "trader_key": "03802dacb679b5055fb9cc057bc26fd906a2cb9a62daf3aaa84cb848b13888f1d0",
                        "outpoint": "bc3b0115804c64ca7d01c6968a309f27ab49c698b293b8da81d71ae5a3b6985e:0",
                        "value": 7483,
                        "available_balance": 7483,
                        "expiration_height": 705794,
                        "state": "PENDING_OPEN",
                        "latest_txid": "bc3b0115804c64ca7d01c6968a309f27ab49c698b293b8da81d71ae5a3b6985e"
                }
        ]
}

Further troubleshooting of container in Umbrel showed the below log entry:

unable to resume account 03802dacb679b5055fb9cc057bc26fd906a2cb9a62daf3aaa84cb848b13888f1d0: rpc error: code = Unknown desc = minimum account value allowed is 0.001 BTC

refer to https://lightningcommunity.slack.com/archives/C01E0PRQ960/p1629110370057200 for more context

positiveblue commented 1 year ago

Let me add some context to the issue:

When we recover the account, if the account is in open/pending open in the server side, the client sets the account status to StateInitiated.

Then the flow calls the resumeAccount. The account will then goes throw StateInitialited -> PendingOpen -> Open. One of the steps in PendingOpen is an rpc call to InitAccount to the auctioneer, which will fail if the account does not have an amount of >100k sats.

P.S: I edited the title so it describes the problem better + it's easier to find.