mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
moveonly: feerate_min and feerate_max belong in chaintopology.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -189,57 +189,6 @@ u8 *p2wpkh_for_keyidx(const tal_t *ctx, struct lightningd *ld, u64 keyidx)
|
||||
return scriptpubkey_p2wpkh(ctx, &shutdownkey);
|
||||
}
|
||||
|
||||
u32 feerate_min(struct lightningd *ld, bool *unknown)
|
||||
{
|
||||
u32 min;
|
||||
|
||||
if (unknown)
|
||||
*unknown = false;
|
||||
|
||||
/* We can't allow less than feerate_floor, since that won't relay */
|
||||
if (ld->config.ignore_fee_limits)
|
||||
min = 1;
|
||||
else {
|
||||
u32 feerate = try_get_feerate(ld->topology, FEERATE_SLOW);
|
||||
if (!feerate && unknown)
|
||||
*unknown = true;
|
||||
|
||||
/* Set this to half of slow rate (if unknown, will be floor) */
|
||||
min = feerate / 2;
|
||||
}
|
||||
|
||||
if (min < feerate_floor())
|
||||
return feerate_floor();
|
||||
return min;
|
||||
}
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* Given the variance in fees, and the fact that the transaction may be
|
||||
* spent in the future, it's a good idea for the fee payer to keep a good
|
||||
* margin (say 5x the expected fee requirement)
|
||||
*/
|
||||
u32 feerate_max(struct lightningd *ld, bool *unknown)
|
||||
{
|
||||
u32 feerate;
|
||||
|
||||
if (unknown)
|
||||
*unknown = false;
|
||||
|
||||
if (ld->config.ignore_fee_limits)
|
||||
return UINT_MAX;
|
||||
|
||||
/* If we don't know feerate, don't limit other side. */
|
||||
feerate = try_get_feerate(ld->topology, FEERATE_URGENT);
|
||||
if (!feerate) {
|
||||
if (unknown)
|
||||
*unknown = true;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
return feerate * ld->config.max_fee_multiplier;
|
||||
}
|
||||
|
||||
static void sign_last_tx(struct channel *channel)
|
||||
{
|
||||
struct lightningd *ld = channel->peer->ld;
|
||||
|
||||
Reference in New Issue
Block a user