Skip to content

Commit 7fdc693

Browse files
committed
update
1 parent c228760 commit 7fdc693

File tree

7 files changed

+92
-289
lines changed

7 files changed

+92
-289
lines changed

bindings/ldk_node.udl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,13 @@ dictionary Config {
1313
u64 probing_liquidity_limit_multiplier;
1414
AnchorChannelsConfig? anchor_channels_config;
1515
SendingParameters? sending_parameters;
16-
RebroadcastPolicy rebroadcast_policy;
1716
};
1817

1918
dictionary AnchorChannelsConfig {
2019
sequence<PublicKey> trusted_peers_no_reserve;
2120
u64 per_channel_reserve_sats;
2221
};
2322

24-
dictionary RebroadcastPolicy {
25-
u64 min_rebroadcast_interval;
26-
u32 max_broadcast_attempts;
27-
f32 backoff_factor;
28-
};
29-
3023
dictionary BackgroundSyncConfig {
3124
u64 onchain_wallet_sync_interval_secs;
3225
u64 lightning_wallet_sync_interval_secs;
@@ -239,9 +232,9 @@ interface OnchainPayment {
239232
[Throws=NodeError]
240233
Txid send_all_to_address([ByRef]Address address, boolean retain_reserve, FeeRate? fee_rate);
241234
[Throws=NodeError]
242-
void rebroadcast_transaction(Txid txid);
235+
void rebroadcast_transaction(PaymentId payment_id);
243236
[Throws=NodeError]
244-
Txid bump_fee_rbf(Txid txid, u64 fee_bump_increment);
237+
Txid bump_fee_rbf(PaymentId payment_id);
245238
};
246239

247240
interface FeeRate {

src/config.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,6 @@ pub struct Config {
182182
/// **Note:** If unset, default parameters will be used, and you will be able to override the
183183
/// parameters on a per-payment basis in the corresponding method calls.
184184
pub sending_parameters: Option<SendingParameters>,
185-
/// Policy for controlling transaction rebroadcasting behavior.
186-
///
187-
/// This policy determines how and when unconfirmed transactions are rebroadcast to the network
188-
/// to improve confirmation reliability.
189-
///
190-
/// ### Default Behavior
191-
/// - Minimum interval: 300 seconds (5 minutes)
192-
/// - Maximum attempts: 24
193-
/// - Exponential backoff factor: 1.5 (50% increase each attempt)
194-
pub rebroadcast_policy: RebroadcastPolicy,
195185
}
196186

197187
impl Default for Config {
@@ -206,7 +196,6 @@ impl Default for Config {
206196
anchor_channels_config: Some(AnchorChannelsConfig::default()),
207197
sending_parameters: None,
208198
node_alias: None,
209-
rebroadcast_policy: RebroadcastPolicy::default(),
210199
}
211200
}
212201
}

src/ffi/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
pub use crate::config::{
1414
default_config, AnchorChannelsConfig, BackgroundSyncConfig, ElectrumSyncConfig,
15-
EsploraSyncConfig, MaxDustHTLCExposure, RebroadcastPolicy,
15+
EsploraSyncConfig, MaxDustHTLCExposure,
1616
};
1717
pub use crate::graph::{ChannelInfo, ChannelUpdateInfo, NodeAnnouncementInfo, NodeInfo};
1818
pub use crate::liquidity::{LSPS1OrderStatus, LSPS2ServiceConfig, OnchainPaymentInfo, PaymentInfo};

src/payment/onchain.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::types::{ChannelManager, Wallet};
1414
use crate::wallet::OnchainSendAmount;
1515

1616
use bitcoin::{Address, Txid};
17+
use lightning::ln::channelmanager::PaymentId;
1718

1819
use std::sync::{Arc, RwLock};
1920

@@ -128,8 +129,8 @@ impl OnchainPayment {
128129
/// automatic background job to handle it.
129130
///
130131
/// updating the attempt count and last broadcast time for the transaction in the payment store.
131-
pub fn rebroadcast_transaction(&self, txid: Txid) -> Result<(), Error> {
132-
self.wallet.rebroadcast_transaction(txid)?;
132+
pub fn rebroadcast_transaction(&self, payment_id: PaymentId) -> Result<(), Error> {
133+
self.wallet.rebroadcast_transaction(payment_id)?;
133134
Ok(())
134135
}
135136

@@ -139,12 +140,11 @@ impl OnchainPayment {
139140
/// specified increment to improve its chances of confirmation. The original transaction must
140141
/// be signaling RBF replaceability for this to succeed.
141142
///
142-
/// `fee_bump_increment` specifies the additional fee amount in satoshis to add to the
143-
/// transaction. The new transaction will have the same outputs as the original but with a
143+
/// The new transaction will have the same outputs as the original but with a
144144
/// higher fee, resulting in faster confirmation potential.
145145
///
146146
/// Returns the Txid of the new replacement transaction if successful.
147-
pub fn bump_fee_rbf(&self, txid: Txid, fee_bump_increment: u64) -> Result<Txid, Error> {
148-
self.wallet.bump_fee_rbf(txid, fee_bump_increment)
147+
pub fn bump_fee_rbf(&self, payment_id: PaymentId) -> Result<Txid, Error> {
148+
self.wallet.bump_fee_rbf(payment_id)
149149
}
150150
}

src/payment/store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ pub enum PaymentKind {
376376
/// Last broadcast attempt timestamp (UNIX seconds)
377377
last_broadcast_time: Option<u64>,
378378
/// Number of broadcast attempts
379-
broadcast_attempts: u32,
379+
broadcast_attempts: Option<u32>,
380380
},
381381
/// A [BOLT 11] payment.
382382
///
@@ -477,7 +477,7 @@ impl_writeable_tlv_based_enum!(PaymentKind,
477477
(2, status, required),
478478
(4, raw_tx, option),
479479
(10, last_broadcast_time, option),
480-
(12, broadcast_attempts, required),
480+
(12, broadcast_attempts, option),
481481
},
482482
(2, Bolt11) => {
483483
(0, hash, required),
@@ -570,7 +570,7 @@ pub(crate) struct PaymentDetailsUpdate {
570570
pub status: Option<PaymentStatus>,
571571
pub confirmation_status: Option<ConfirmationStatus>,
572572
pub last_broadcast_time: Option<Option<u64>>,
573-
pub broadcast_attempts: Option<u32>,
573+
pub broadcast_attempts: Option<Option<u32>>,
574574
}
575575

576576
impl PaymentDetailsUpdate {
@@ -607,7 +607,7 @@ impl From<&PaymentDetails> for PaymentDetailsUpdate {
607607
PaymentKind::Onchain { status, last_broadcast_time, broadcast_attempts, .. } => {
608608
(Some(status), last_broadcast_time, broadcast_attempts)
609609
},
610-
_ => (None, None, 0),
610+
_ => (None, None, None),
611611
};
612612

613613
let counterparty_skimmed_fee_msat = match value.kind {

0 commit comments

Comments
 (0)