mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 00:24:19 +01:00
Don't report redundant feerates to subdaemons
This commit is contained in:
committed by
Christian Decker
parent
5b58eda748
commit
248d60d7bd
@@ -338,7 +338,7 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||||||
* 2 minutes. The following will do that in a polling interval
|
* 2 minutes. The following will do that in a polling interval
|
||||||
* independent manner. */
|
* independent manner. */
|
||||||
double alpha = 1 - pow(0.1,(double)topo->poll_seconds / 120);
|
double alpha = 1 - pow(0.1,(double)topo->poll_seconds / 120);
|
||||||
bool feerate_changed = false;
|
bool notify_feerate_changed = false;
|
||||||
|
|
||||||
for (size_t i = 0; i < NUM_FEERATES; i++) {
|
for (size_t i = 0; i < NUM_FEERATES; i++) {
|
||||||
u32 feerate = satoshi_per_kw[i];
|
u32 feerate = satoshi_per_kw[i];
|
||||||
@@ -352,7 +352,7 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||||||
|
|
||||||
/* Initial smoothed feerate is the polled feerate */
|
/* Initial smoothed feerate is the polled feerate */
|
||||||
if (!old_feerates[i]) {
|
if (!old_feerates[i]) {
|
||||||
feerate_changed = true;
|
notify_feerate_changed = true;
|
||||||
old_feerates[i] = feerate;
|
old_feerates[i] = feerate;
|
||||||
init_feerate_history(topo, i, feerate);
|
init_feerate_history(topo, i, feerate);
|
||||||
|
|
||||||
@@ -360,8 +360,6 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||||||
"Smoothed feerate estimate for %s initialized to polled estimate %u",
|
"Smoothed feerate estimate for %s initialized to polled estimate %u",
|
||||||
feerate_name(i), feerate);
|
feerate_name(i), feerate);
|
||||||
} else {
|
} else {
|
||||||
if (feerate != old_feerates[i])
|
|
||||||
feerate_changed = true;
|
|
||||||
add_feerate_history(topo, i, feerate);
|
add_feerate_history(topo, i, feerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,6 +388,10 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||||||
feerate, topo->feerate[i]);
|
feerate, topo->feerate[i]);
|
||||||
}
|
}
|
||||||
topo->feerate[i] = feerate;
|
topo->feerate[i] = feerate;
|
||||||
|
|
||||||
|
/* After adjustment, If any entry doesn't match prior reported, report all */
|
||||||
|
if (feerate != old_feerates[i])
|
||||||
|
notify_feerate_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topo->feerate_uninitialized) {
|
if (topo->feerate_uninitialized) {
|
||||||
@@ -399,7 +401,7 @@ static void update_feerates(struct bitcoind *bitcoind,
|
|||||||
maybe_completed_init(topo);
|
maybe_completed_init(topo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feerate_changed)
|
if (notify_feerate_changed)
|
||||||
notify_feerate_change(bitcoind->ld);
|
notify_feerate_change(bitcoind->ld);
|
||||||
|
|
||||||
next_updatefee_timer(topo);
|
next_updatefee_timer(topo);
|
||||||
|
|||||||
Reference in New Issue
Block a user