Skip to content

Commit effb615

Browse files
committed
Update auto-generated bindings to LDK 0.2
1 parent 114d59d commit effb615

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+75146
-59973
lines changed

lightning-c-bindings/include/ldk_rust_types.h

Lines changed: 110 additions & 105 deletions
Large diffs are not rendered by default.

lightning-c-bindings/include/lightning.h

Lines changed: 31498 additions & 25558 deletions
Large diffs are not rendered by default.

lightning-c-bindings/include/lightningpp.hpp

Lines changed: 6936 additions & 6095 deletions
Large diffs are not rendered by default.

lightning-c-bindings/src/c_types/derived.rs

Lines changed: 14621 additions & 11280 deletions
Large diffs are not rendered by default.

lightning-c-bindings/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ pub mod lightning_persister;
2929
pub mod lightning_background_processor;
3030
pub mod lightning_invoice;
3131
pub mod lightning_rapid_gossip_sync;
32-
pub mod lightning_liquidity;

lightning-c-bindings/src/lightning/blinded_path/message.rs

Lines changed: 521 additions & 112 deletions
Large diffs are not rendered by default.

lightning-c-bindings/src/lightning/blinded_path/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use crate::c_types::*;
1717
#[cfg(feature="no-std")]
1818
use alloc::{vec::Vec, boxed::Box};
1919

20-
pub mod payment;
2120
pub mod message;
21+
pub mod payment;
2222
mod utils {
2323

2424
use alloc::str::FromStr;
@@ -490,7 +490,7 @@ impl BlindedHop {
490490
/// The blinded node id of this hop in a blinded path.
491491
#[no_mangle]
492492
pub extern "C" fn BlindedHop_get_blinded_node_id(this_ptr: &BlindedHop) -> crate::c_types::PublicKey {
493-
let mut inner_val = &mut this_ptr.get_native_mut_ref().blinded_node_id;
493+
let mut inner_val = &mut BlindedHop::get_native_mut_ref(this_ptr).blinded_node_id;
494494
crate::c_types::PublicKey::from_rust(&inner_val)
495495
}
496496
/// The blinded node id of this hop in a blinded path.
@@ -503,7 +503,7 @@ pub extern "C" fn BlindedHop_set_blinded_node_id(this_ptr: &mut BlindedHop, mut
503503
/// Returns a copy of the field.
504504
#[no_mangle]
505505
pub extern "C" fn BlindedHop_get_encrypted_payload(this_ptr: &BlindedHop) -> crate::c_types::derived::CVec_u8Z {
506-
let mut inner_val = this_ptr.get_native_mut_ref().encrypted_payload.clone();
506+
let mut inner_val = BlindedHop::get_native_mut_ref(this_ptr).encrypted_payload.clone();
507507
let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); };
508508
local_inner_val.into()
509509
}
@@ -527,20 +527,20 @@ impl Clone for BlindedHop {
527527
fn clone(&self) -> Self {
528528
Self {
529529
inner: if <*mut nativeBlindedHop>::is_null(self.inner) { core::ptr::null_mut() } else {
530-
ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
530+
ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) },
531531
is_owned: true,
532532
}
533533
}
534534
}
535535
#[allow(unused)]
536536
/// Used only if an object of this type is returned as a trait impl by a method
537537
pub(crate) extern "C" fn BlindedHop_clone_void(this_ptr: *const c_void) -> *mut c_void {
538-
Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedHop)).clone() })) as *mut c_void
538+
Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedHop) }))) as *mut c_void
539539
}
540540
#[no_mangle]
541541
/// Creates a copy of the BlindedHop
542542
pub extern "C" fn BlindedHop_clone(orig: &BlindedHop) -> BlindedHop {
543-
orig.clone()
543+
Clone::clone(orig)
544544
}
545545
/// Get a string which allows debug introspection of a BlindedHop object
546546
pub extern "C" fn BlindedHop_debug_str_void(o: *const c_void) -> Str {

lightning-c-bindings/src/lightning/blinded_path/payment.rs

Lines changed: 413 additions & 56 deletions
Large diffs are not rendered by default.

lightning-c-bindings/src/lightning/chain/chaininterface.rs

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,20 @@ pub struct BroadcasterInterface {
3434
/// In some cases LDK may attempt to broadcast a transaction which double-spends another
3535
/// and this isn't a bug and can be safely ignored.
3636
///
37-
/// If more than one transaction is given, these transactions should be considered to be a
38-
/// package and broadcast together. Some of the transactions may or may not depend on each other,
39-
/// be sure to manage both cases correctly.
37+
/// If more than one transaction is given, these transactions MUST be a
38+
/// single child and its parents and be broadcast together as a package
39+
/// (see the [`submitpackage`](https://bitcoincore.org/en/doc/30.0.0/rpc/rawtransactions/submitpackage)
40+
/// Bitcoin Core RPC).
41+
///
42+
/// Implementations MUST NOT assume any topological order on the transactions.
4043
///
4144
/// Bitcoin transaction packages are defined in BIP 331 and here:
4245
/// <https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md>
4346
pub broadcast_transactions: extern "C" fn (this_arg: *const c_void, txs: crate::c_types::derived::CVec_TransactionZ),
47+
/// Called, if set, after this BroadcasterInterface has been cloned into a duplicate object.
48+
/// The new BroadcasterInterface is provided, and should be mutated as needed to perform a
49+
/// deep copy of the object pointed to by this_arg or avoid any double-freeing.
50+
pub cloned: Option<extern "C" fn (new_BroadcasterInterface: &mut BroadcasterInterface)>,
4451
/// Frees any resources associated with this object given its this_arg pointer.
4552
/// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4653
pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
@@ -52,9 +59,27 @@ pub(crate) fn BroadcasterInterface_clone_fields(orig: &BroadcasterInterface) ->
5259
BroadcasterInterface {
5360
this_arg: orig.this_arg,
5461
broadcast_transactions: Clone::clone(&orig.broadcast_transactions),
62+
cloned: Clone::clone(&orig.cloned),
5563
free: Clone::clone(&orig.free),
5664
}
5765
}
66+
#[no_mangle]
67+
/// Creates a copy of a BroadcasterInterface
68+
pub extern "C" fn BroadcasterInterface_clone(orig: &BroadcasterInterface) -> BroadcasterInterface {
69+
let mut res = BroadcasterInterface_clone_fields(orig);
70+
if let Some(f) = orig.cloned { (f)(&mut res) };
71+
res
72+
}
73+
impl Clone for BroadcasterInterface {
74+
fn clone(&self) -> Self {
75+
BroadcasterInterface_clone(self)
76+
}
77+
}
78+
impl Clone for BroadcasterInterfaceRef {
79+
fn clone(&self) -> Self {
80+
Self(BroadcasterInterface_clone(&self.0))
81+
}
82+
}
5883

5984
use lightning::chain::chaininterface::BroadcasterInterface as rustBroadcasterInterface;
6085
impl rustBroadcasterInterface for BroadcasterInterface {
@@ -101,11 +126,14 @@ impl Drop for BroadcasterInterface {
101126
#[must_use]
102127
#[repr(C)]
103128
pub enum ConfirmationTarget {
104-
/// The most aggressive (i.e. highest) feerate estimate available.
129+
/// The most aggressive feerate estimate which we think is reasonable.
105130
///
106131
/// This is used to sanity-check our counterparty's feerates and should be as conservative as
107132
/// possible to ensure that we don't confuse a peer using a very conservative estimator for one
108-
/// trying to burn channel balance to dust.
133+
/// trying to burn channel balance to dust. To ensure that this is never lower than an honest
134+
/// counterparty's feerate estimate you may wish to use a value which is higher than your
135+
/// maximum feerate estimate, for example by adding a constant few-hundred or few-thousand
136+
/// sats-per-kW.
109137
MaximumFeeEstimate,
110138
/// We have some funds available on chain which we need to spend prior to some expiry time at
111139
/// which point our counterparty may be able to steal them.
@@ -408,7 +436,7 @@ impl Drop for FeeEstimator {
408436
/// Minimum relay fee as required by bitcoin network mempool policy.
409437
410438
#[no_mangle]
411-
pub static MIN_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = lightning::chain::chaininterface::MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
439+
pub static INCREMENTAL_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = lightning::chain::chaininterface::INCREMENTAL_RELAY_FEE_SAT_PER_1000_WEIGHT;
412440
/// Minimum feerate that takes a sane approach to bitcoind weight-to-vbytes rounding.
413441
/// See the following Core Lightning commit for an explanation:
414442
/// <https://github.com/ElementsProject/lightning/commit/2e687b9b352c9092b5e8bd4a688916ac50b44af0>

0 commit comments

Comments
 (0)