@@ -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
5984use lightning:: chain:: chaininterface:: BroadcasterInterface as rustBroadcasterInterface;
6085impl rustBroadcasterInterface for BroadcasterInterface {
@@ -101,11 +126,14 @@ impl Drop for BroadcasterInterface {
101126#[ must_use]
102127#[ repr( C ) ]
103128pub 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