mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
wallet: provide better comments on wallet_first_blocknum.
ZmnSCPxj queried the unilateral close case, so make that clearer. Christian raise concerns about existing channels, so make it clear what we're doing there too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ef9c6cb8c3
commit
37373f2c16
1 changed files with 8 additions and 2 deletions
|
@ -677,8 +677,7 @@ static bool wallet_ever_used(struct wallet *w)
|
||||||
if (db_get_intvar(w->db, "bip32_max_index", 0) != 0)
|
if (db_get_intvar(w->db, "bip32_max_index", 0) != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Or we could have had a channel terminate unilaterally,
|
/* Or if they do a unilateral close, the output to us provides a UTXO. */
|
||||||
* providing a UTXO. */
|
|
||||||
stmt = db_query(__func__, w->db,
|
stmt = db_query(__func__, w->db,
|
||||||
"SELECT COUNT(*) FROM outputs WHERE commitment_point IS NOT NULL;");
|
"SELECT COUNT(*) FROM outputs WHERE commitment_point IS NOT NULL;");
|
||||||
sqlite3_step(stmt);
|
sqlite3_step(stmt);
|
||||||
|
@ -688,6 +687,13 @@ static bool wallet_ever_used(struct wallet *w)
|
||||||
return channel_utxos;
|
return channel_utxos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We want the earlier of either:
|
||||||
|
* 1. The first channel we're still watching (it might have closed),
|
||||||
|
* 2. The last block we scanned for UTXO (might have new incoming payments)
|
||||||
|
*
|
||||||
|
* chaintopology actually subtracts another 100 blocks to make sure we
|
||||||
|
* catch chain forks.
|
||||||
|
*/
|
||||||
u32 wallet_first_blocknum(struct wallet *w, u32 first_possible)
|
u32 wallet_first_blocknum(struct wallet *w, u32 first_possible)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
Loading…
Add table
Reference in a new issue