From: Matt Corallo Date: Mon, 4 Jan 2021 19:15:36 +0000 (-0500) Subject: [bindings] Don't export new functions with unexportable types X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=0eb5a74fef075a2e864e36e8a47e668c0386bddd;p=rust-lightning [bindings] Don't export new functions with unexportable types `CommitmentTransaction::new_with_auxiliary_htlc_data()` includes a unbounded generic parameter which we can't concretize and it's of limited immediate use for users in any case. We should eventually add a non-generic version which uses `()` for the generic but that can come later. `CommitmentTransaction::htlcs()` returns a reference to a Vec, which we cannot currently map. It should, however, be exposed to users, so in the future we'll need to have a duplication function which returns Vec of references or a cloned Vec. --- diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 8037de64e..2ccee7b2d 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -889,6 +889,8 @@ impl CommitmentTransaction { /// This auxiliary data is not stored in this object. /// /// Only include HTLCs that are above the dust limit for the channel. + /// + /// (C-not exported) due to the generic though we likely should expose a version without pub fn new_with_auxiliary_htlc_data(commitment_number: u64, to_broadcaster_value_sat: u64, to_countersignatory_value_sat: u64, keys: TxCreationKeys, feerate_per_kw: u32, htlcs_with_aux: &mut Vec<(HTLCOutputInCommitment, T)>, channel_parameters: &DirectedChannelTransactionParameters) -> CommitmentTransaction { // Sort outputs and populate output indices while keeping track of the auxiliary data let (outputs, htlcs) = Self::internal_build_outputs(&keys, to_broadcaster_value_sat, to_countersignatory_value_sat, htlcs_with_aux, channel_parameters).unwrap(); @@ -1056,6 +1058,9 @@ impl CommitmentTransaction { /// The non-dust HTLCs (direction, amt, height expiration, hash, transaction output index) /// which were included in this commitment transaction in output order. /// The transaction index is always populated. + /// + /// (C-not exported) as we cannot currently convert Vec references to/from C, though we should + /// expose a less effecient version which creates a Vec of references in the future. pub fn htlcs(&self) -> &Vec { &self.htlcs }