mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
chaintopology: add log line when we remove stale block from topo->tip
Added comments
This commit is contained in:
committed by
Christian Decker
parent
b261c5ba0b
commit
eb3495c23d
@@ -609,7 +609,7 @@ static void add_tip(struct chain_topology *topo, struct block *b)
|
|||||||
/* Attach to tip; b is now the tip. */
|
/* Attach to tip; b is now the tip. */
|
||||||
assert(b->height == topo->tip->height + 1);
|
assert(b->height == topo->tip->height + 1);
|
||||||
b->prev = topo->tip;
|
b->prev = topo->tip;
|
||||||
topo->tip->next = b;
|
topo->tip->next = b; /* FIXME this doesn't seem to be used anywhere */
|
||||||
topo->tip = b;
|
topo->tip = b;
|
||||||
wallet_block_add(topo->ld->wallet, b);
|
wallet_block_add(topo->ld->wallet, b);
|
||||||
|
|
||||||
@@ -653,8 +653,13 @@ static void remove_tip(struct chain_topology *topo)
|
|||||||
struct bitcoin_txid *txs;
|
struct bitcoin_txid *txs;
|
||||||
size_t i, n;
|
size_t i, n;
|
||||||
|
|
||||||
|
log_debug(topo->log, "Removing stale block %u: %s",
|
||||||
|
topo->tip->height,
|
||||||
|
type_to_string(tmpctx, struct bitcoin_blkid, &b->blkid));
|
||||||
|
|
||||||
/* Move tip back one. */
|
/* Move tip back one. */
|
||||||
topo->tip = b->prev;
|
topo->tip = b->prev;
|
||||||
|
|
||||||
if (!topo->tip)
|
if (!topo->tip)
|
||||||
fatal("Initial block %u (%s) reorganized out!",
|
fatal("Initial block %u (%s) reorganized out!",
|
||||||
b->height,
|
b->height,
|
||||||
@@ -663,7 +668,7 @@ static void remove_tip(struct chain_topology *topo)
|
|||||||
txs = wallet_transactions_by_height(b, topo->ld->wallet, b->height);
|
txs = wallet_transactions_by_height(b, topo->ld->wallet, b->height);
|
||||||
n = tal_count(txs);
|
n = tal_count(txs);
|
||||||
|
|
||||||
/* Notify that txs are kicked out. */
|
/* Notify that txs are kicked out (their height will be set NULL in db) */
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
txwatch_fire(topo, &txs[i], 0);
|
txwatch_fire(topo, &txs[i], 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user