Skip to content

Commit e6f1526

Browse files
committed
f Rename unknown BOLT11 config flag
Use a name that reflects both possible user actions for unknown BOLT11 payments: either claim them with a preimage or fail them back. Co-Authored-By: HAL 9000
1 parent 31eb068 commit e6f1526

7 files changed

Lines changed: 23 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
versions need to drain pending events before the upgrade.
1515
- Applications using the BOLT 11 manual-claiming receive APIs
1616
(`receive_*_for_hash`) now need to set
17-
`Config::manually_claim_unknown_bolt11_payments` to `true`. Otherwise
17+
`Config::manually_handle_unknown_bolt11_payments` to `true`. Otherwise
1818
matching inbound HTLCs will be failed back instead of emitting
1919
`Event::PaymentClaimable`.
2020

src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub(crate) const LIQUIDITY_DISCOVERY_RETRY_MAX_DELAY: Duration = Duration::from_
155155
/// | `route_parameters` | None |
156156
/// | `tor_config` | None |
157157
/// | `hrn_config` | HumanReadableNamesConfig::default() |
158-
/// | `manually_claim_unknown_bolt11_payments` | false |
158+
/// | `manually_handle_unknown_bolt11_payments` | false |
159159
///
160160
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
161161
/// respective default values.
@@ -230,7 +230,7 @@ pub struct Config {
230230
/// failed, or times out.
231231
///
232232
/// [`Event::PaymentClaimable`]: crate::Event::PaymentClaimable
233-
pub manually_claim_unknown_bolt11_payments: bool,
233+
pub manually_handle_unknown_bolt11_payments: bool,
234234
}
235235

236236
impl Default for Config {
@@ -247,7 +247,7 @@ impl Default for Config {
247247
route_parameters: None,
248248
node_alias: None,
249249
hrn_config: HumanReadableNamesConfig::default(),
250-
manually_claim_unknown_bolt11_payments: false,
250+
manually_handle_unknown_bolt11_payments: false,
251251
}
252252
}
253253
}

src/event.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub enum Event {
199199
/// This needs to be manually claimed by supplying the correct preimage to [`claim_for_hash`].
200200
///
201201
/// This event is only emitted for unknown payments if
202-
/// [`Config::manually_claim_unknown_bolt11_payments`] is enabled. Enabling it may let any
202+
/// [`Config::manually_handle_unknown_bolt11_payments`] is enabled. Enabling it may let any
203203
/// holder of a valid invoice generated by this node tie up inbound HTLC slots and grow the
204204
/// persisted event queue until the payment is claimed, failed, or times out.
205205
///
@@ -208,7 +208,7 @@ pub enum Event {
208208
///
209209
/// Note claiming will necessarily fail after the `claim_deadline` has been reached.
210210
///
211-
/// [`Config::manually_claim_unknown_bolt11_payments`]: crate::config::Config::manually_claim_unknown_bolt11_payments
211+
/// [`Config::manually_handle_unknown_bolt11_payments`]: crate::config::Config::manually_handle_unknown_bolt11_payments
212212
/// [`claim_for_hash`]: crate::payment::Bolt11Payment::claim_for_hash
213213
/// [`fail_for_hash`]: crate::payment::Bolt11Payment::fail_for_hash
214214
PaymentClaimable {
@@ -931,10 +931,10 @@ where
931931
..
932932
} = &purpose
933933
{
934-
if !self.config.manually_claim_unknown_bolt11_payments {
934+
if !self.config.manually_handle_unknown_bolt11_payments {
935935
log_info!(
936936
self.logger,
937-
"Refusing unknown BOLT11 payment with hash {} as manual claiming is disabled",
937+
"Refusing unknown BOLT11 payment with hash {} as manual handling is disabled",
938938
hex_utils::to_string(&payment_hash.0),
939939
);
940940
self.channel_manager.fail_htlc_backwards(&payment_hash);

src/payment/bolt11.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -602,19 +602,19 @@ impl Bolt11Payment {
602602
/// Returns a payable invoice that can be used to request a payment of the amount
603603
/// given for the given payment hash.
604604
///
605-
/// If [`Config::manually_claim_unknown_bolt11_payments`] is enabled, a
605+
/// If [`Config::manually_handle_unknown_bolt11_payments`] is enabled, a
606606
/// [`PaymentClaimable`] event will be emitted once the inbound payment arrives. Otherwise, the
607607
/// inbound payment will be failed back when it arrives.
608608
///
609609
/// **Warning:** it is the user's responsibility to never reuse the same payment hash. Reusing a
610610
/// payment hash is unsafe and can lead to loss of funds.
611611
///
612-
/// **Note:** if manual claiming is enabled, users *MUST* handle this event and claim the
612+
/// **Note:** if manual handling is enabled, users *MUST* handle this event and claim the
613613
/// payment manually via [`claim_for_hash`] as soon as they have obtained access to the
614614
/// preimage of the given payment hash. If they're unable to obtain the preimage, they *MUST*
615615
/// immediately fail the payment via [`fail_for_hash`].
616616
///
617-
/// [`Config::manually_claim_unknown_bolt11_payments`]: crate::config::Config::manually_claim_unknown_bolt11_payments
617+
/// [`Config::manually_handle_unknown_bolt11_payments`]: crate::config::Config::manually_handle_unknown_bolt11_payments
618618
/// [`PaymentClaimable`]: crate::Event::PaymentClaimable
619619
/// [`claim_for_hash`]: Self::claim_for_hash
620620
/// [`fail_for_hash`]: Self::fail_for_hash
@@ -643,19 +643,19 @@ impl Bolt11Payment {
643643
/// Returns a payable invoice that can be used to request a payment for the given payment hash
644644
/// and the amount to be determined by the user, also known as a "zero-amount" invoice.
645645
///
646-
/// If [`Config::manually_claim_unknown_bolt11_payments`] is enabled, a
646+
/// If [`Config::manually_handle_unknown_bolt11_payments`] is enabled, a
647647
/// [`PaymentClaimable`] event will be emitted once the inbound payment arrives. Otherwise, the
648648
/// inbound payment will be failed back when it arrives.
649649
///
650650
/// **Warning:** it is the user's responsibility to never reuse the same payment hash. Reusing a
651651
/// payment hash is unsafe and can lead to loss of funds.
652652
///
653-
/// **Note:** if manual claiming is enabled, users *MUST* handle this event and claim the
653+
/// **Note:** if manual handling is enabled, users *MUST* handle this event and claim the
654654
/// payment manually via [`claim_for_hash`] as soon as they have obtained access to the
655655
/// preimage of the given payment hash. If they're unable to obtain the preimage, they *MUST*
656656
/// immediately fail the payment via [`fail_for_hash`].
657657
///
658-
/// [`Config::manually_claim_unknown_bolt11_payments`]: crate::config::Config::manually_claim_unknown_bolt11_payments
658+
/// [`Config::manually_handle_unknown_bolt11_payments`]: crate::config::Config::manually_handle_unknown_bolt11_payments
659659
/// [`PaymentClaimable`]: crate::Event::PaymentClaimable
660660
/// [`claim_for_hash`]: Self::claim_for_hash
661661
/// [`fail_for_hash`]: Self::fail_for_hash
@@ -702,7 +702,7 @@ impl Bolt11Payment {
702702
/// If set, `max_total_lsp_fee_limit_msat` will limit how much fee we allow the LSP to take for opening the
703703
/// channel to us. We'll use its cheapest offer otherwise.
704704
///
705-
/// If [`Config::manually_claim_unknown_bolt11_payments`] is enabled, a
705+
/// If [`Config::manually_handle_unknown_bolt11_payments`] is enabled, a
706706
/// [`PaymentClaimable`] event will be emitted once the inbound payment arrives. Otherwise, the
707707
/// inbound payment will be failed back when it arrives. The check that
708708
/// [`counterparty_skimmed_fee_msat`] is within the limits is performed *before* emitting the
@@ -711,13 +711,13 @@ impl Bolt11Payment {
711711
/// **Warning:** it is the user's responsibility to never reuse the same payment hash. Reusing a
712712
/// payment hash is unsafe and can lead to loss of funds.
713713
///
714-
/// **Note:** if manual claiming is enabled, users *MUST* handle this event and claim the
714+
/// **Note:** if manual handling is enabled, users *MUST* handle this event and claim the
715715
/// payment manually via [`claim_for_hash`] as soon as they have obtained access to the
716716
/// preimage of the given payment hash. If they're unable to obtain the preimage, they *MUST*
717717
/// immediately fail the payment via [`fail_for_hash`].
718718
///
719719
/// [LSPS2]: https://github.com/BitcoinAndLightningLayerSpecs/lsp/blob/main/LSPS2/README.md
720-
/// [`Config::manually_claim_unknown_bolt11_payments`]: crate::config::Config::manually_claim_unknown_bolt11_payments
720+
/// [`Config::manually_handle_unknown_bolt11_payments`]: crate::config::Config::manually_handle_unknown_bolt11_payments
721721
/// [`PaymentClaimable`]: crate::Event::PaymentClaimable
722722
/// [`claim_for_hash`]: Self::claim_for_hash
723723
/// [`fail_for_hash`]: Self::fail_for_hash
@@ -775,7 +775,7 @@ impl Bolt11Payment {
775775
/// parts-per-million millisatoshis, we allow the LSP to take for opening the channel to us.
776776
/// We'll use its cheapest offer otherwise.
777777
///
778-
/// If [`Config::manually_claim_unknown_bolt11_payments`] is enabled, a
778+
/// If [`Config::manually_handle_unknown_bolt11_payments`] is enabled, a
779779
/// [`PaymentClaimable`] event will be emitted once the inbound payment arrives. Otherwise, the
780780
/// inbound payment will be failed back when it arrives. The check that
781781
/// [`counterparty_skimmed_fee_msat`] is within the limits is performed *before* emitting the
@@ -784,13 +784,13 @@ impl Bolt11Payment {
784784
/// **Warning:** it is the user's responsibility to never reuse the same payment hash. Reusing a
785785
/// payment hash is unsafe and can lead to loss of funds.
786786
///
787-
/// **Note:** if manual claiming is enabled, users *MUST* handle this event and claim the
787+
/// **Note:** if manual handling is enabled, users *MUST* handle this event and claim the
788788
/// payment manually via [`claim_for_hash`] as soon as they have obtained access to the
789789
/// preimage of the given payment hash. If they're unable to obtain the preimage, they *MUST*
790790
/// immediately fail the payment via [`fail_for_hash`].
791791
///
792792
/// [LSPS2]: https://github.com/BitcoinAndLightningLayerSpecs/lsp/blob/main/LSPS2/README.md
793-
/// [`Config::manually_claim_unknown_bolt11_payments`]: crate::config::Config::manually_claim_unknown_bolt11_payments
793+
/// [`Config::manually_handle_unknown_bolt11_payments`]: crate::config::Config::manually_handle_unknown_bolt11_payments
794794
/// [`PaymentClaimable`]: crate::Event::PaymentClaimable
795795
/// [`claim_for_hash`]: Self::claim_for_hash
796796
/// [`fail_for_hash`]: Self::fail_for_hash

tests/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ pub(crate) fn setup_two_nodes_with_store(
623623
println!("\n== Node B ==");
624624
let mut config_b = random_config();
625625
config_b.store_type = store_type;
626-
config_b.node_config.manually_claim_unknown_bolt11_payments = true;
626+
config_b.node_config.manually_handle_unknown_bolt11_payments = true;
627627

628628
if cfg!(hrn_tests) {
629629
config_b.node_config.hrn_config = HumanReadableNamesConfig {

tests/integration_tests_postgres.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async fn channel_full_cycle_with_postgres_store() {
3838

3939
println!("\n== Node B ==");
4040
let mut config_b = common::random_config();
41-
config_b.node_config.manually_claim_unknown_bolt11_payments = true;
41+
config_b.node_config.manually_handle_unknown_bolt11_payments = true;
4242
let mut builder_b = Builder::from_config(config_b.node_config);
4343
builder_b.set_chain_source_esplora(esplora_url.clone(), None);
4444
let node_b = builder_b

tests/integration_tests_vss.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async fn channel_full_cycle_with_vss_store() {
3636

3737
println!("\n== Node B ==");
3838
let mut config_b = common::random_config();
39-
config_b.node_config.manually_claim_unknown_bolt11_payments = true;
39+
config_b.node_config.manually_handle_unknown_bolt11_payments = true;
4040
let mut builder_b = Builder::from_config(config_b.node_config);
4141
builder_b.set_chain_source_esplora(esplora_url.clone(), None);
4242
let node_b = builder_b

0 commit comments

Comments
 (0)