mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
df-feerates: mimic old behavior if there's no plugin handling
We delegate the decision about what to do about 'out of bound' feerates to the plugin (if one exists), however in the case that the plugin doesnt exist or doesnt want to figure it out, we default to using the 'best' as their intended feerate, and rejecting if it's out of bounds.
This commit is contained in:
committed by
Christian Decker
parent
5d388b3128
commit
85ecef2849
@@ -434,8 +434,29 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
|
|||||||
/* If there's no plugin, the funding_feerate_per_kw will be zero.
|
/* If there's no plugin, the funding_feerate_per_kw will be zero.
|
||||||
* In this case, we set the funding_feerate_per_kw to the default,
|
* In this case, we set the funding_feerate_per_kw to the default,
|
||||||
* the 'best' */
|
* the 'best' */
|
||||||
if (payload->funding_feerate_per_kw == 0)
|
if (payload->funding_feerate_per_kw == 0) {
|
||||||
payload->funding_feerate_per_kw = payload->funding_feerate_best;
|
u32 best_feerate
|
||||||
|
= payload->funding_feerate_per_kw
|
||||||
|
= payload->funding_feerate_best;
|
||||||
|
|
||||||
|
/* We use the old checks here now, against the base feerate */
|
||||||
|
if (best_feerate < payload->feerate_our_min) {
|
||||||
|
msg = towire_dualopend_fail(NULL, tal_fmt(tmpctx,
|
||||||
|
"feerate_per_kw %u below"
|
||||||
|
" minimum %u",
|
||||||
|
best_feerate,
|
||||||
|
payload->feerate_our_min));
|
||||||
|
return subd_send_msg(dualopend, take(msg));
|
||||||
|
}
|
||||||
|
if (best_feerate > payload->feerate_our_max) {
|
||||||
|
msg = towire_dualopend_fail(NULL, tal_fmt(tmpctx,
|
||||||
|
"feerate_per_kw %u above"
|
||||||
|
" maximum %u",
|
||||||
|
best_feerate,
|
||||||
|
payload->feerate_our_max));
|
||||||
|
return subd_send_msg(dualopend, take(msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If there's no plugin, the psbt will be NULL. We should pass an empty
|
/* If there's no plugin, the psbt will be NULL. We should pass an empty
|
||||||
* PSBT over, in this case */
|
* PSBT over, in this case */
|
||||||
@@ -443,6 +464,7 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
|
|||||||
payload->funding_feerate_per_kw,
|
payload->funding_feerate_per_kw,
|
||||||
payload->psbt,
|
payload->psbt,
|
||||||
payload->our_shutdown_scriptpubkey);
|
payload->our_shutdown_scriptpubkey);
|
||||||
|
|
||||||
subd_send_msg(dualopend, take(msg));
|
subd_send_msg(dualopend, take(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user