mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-11 22:57:59 +01:00
In this commit, we fix an existing issue that could at times cause an inconsistent view between the set of total coins, and the set of segwit coins in the wallet of the node. This could be caused by initiating a funding flow, but then the funding negotiation breaking down somewhere along the lines. In this case, us or the other peer will disconnect. When we initiate funding flows, we lock coins exclusively, to ensure that concurrent funding flows don’t end up double spending the same coin. Before this commit, we wouldn’t ever unlock those coins. As a result, our view of available coins would be skewed. The walletbalance call would show all the coins, but when adding the —witness_only flag, some coins would be missing, or gone all together. This is because the former call actually scans the txstore and manually tallies the amount of available coins, while the latter looks at the sent of available outputs, which is filtered based on which coins are locked. To remedy this, we now ensure that when a peer disconnects, we wipe all existing reservations which will return any locked outputs to the set of available outputs for funding flows.
50 KiB
50 KiB