chaintopology: add notify_feerate_change() callback.
We'll use this to tell peers to change feerate. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
d44088db83
commit
ccf86a138a
|
@ -303,10 +303,14 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||
const u32 *satoshi_per_kw,
|
||||
struct chain_topology *topo)
|
||||
{
|
||||
u32 old_feerates[NUM_FEERATES];
|
||||
bool changed = false;
|
||||
|
||||
for (size_t i = 0; i < NUM_FEERATES; i++) {
|
||||
log_debug(topo->log, "%s feerate %u (was %u)",
|
||||
feerate_name(i),
|
||||
satoshi_per_kw[i], topo->feerate[i]);
|
||||
old_feerates[i] = topo->feerate[i];
|
||||
topo->feerate[i] = satoshi_per_kw[i];
|
||||
}
|
||||
|
||||
|
@ -320,7 +324,12 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||
topo->feerate[j] = topo->feerate[i];
|
||||
}
|
||||
}
|
||||
if (topo->feerate[i] != old_feerates[i])
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
notify_feerate_change(bitcoind->ld);
|
||||
}
|
||||
|
||||
/* B is the new chain (linked by ->next); update topology */
|
||||
|
|
|
@ -164,6 +164,7 @@ void setup_topology(struct chain_topology *topology,
|
|||
struct txlocator *locate_tx(const void *ctx, const struct chain_topology *topo, const struct sha256_double *txid);
|
||||
|
||||
void notify_new_block(struct lightningd *ld, unsigned int height);
|
||||
void notify_feerate_change(struct lightningd *ld);
|
||||
|
||||
#if DEVELOPER
|
||||
void json_dev_broadcast(struct command *cmd,
|
||||
|
|
|
@ -1522,3 +1522,8 @@ void notify_new_block(struct lightningd *ld, u32 height)
|
|||
/* Iteration while removing is safe, but can skip entries! */
|
||||
} while (removed);
|
||||
}
|
||||
|
||||
void notify_feerate_change(struct lightningd *ld)
|
||||
{
|
||||
/* FIXME: Do something! */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue