} LDKAccess;
/**
- * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
- * from the chain.
+ * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
+ * chain.
*
- * Useful when needing to replay chain data upon startup or as new chain events occur.
+ * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
+ * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
+ * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
+ * when needed.
*/
typedef struct LDKListen {
/**
void (*free)(void *this_arg);
} LDKListen;
+/**
+ * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
+ * unconfirmed during a chain reorganization.
+ *
+ * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
+ * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
+ * related to registered transactions and outputs. Upon notification, it would pass along the
+ * matching transactions using this interface.
+ *
+ * # Use
+ *
+ * The intended use is as follows:
+ * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
+ * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
+ * that has been reorganized out of the chain.
+ * - Call [`best_block_updated`] whenever a new chain tip becomes available.
+ *
+ * # Order
+ *
+ * Clients must call these methods in chain order. Specifically:
+ * - Transactions confirmed in a block must be given before transactions confirmed in a later
+ * block.
+ * - Dependent transactions within the same block must be given in topological order, possibly in
+ * separate calls.
+ * - Unconfirmed transactions must be given after the original confirmations and before any
+ * reconfirmation.
+ *
+ * See individual method documentation for further details.
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ * [`best_block_updated`]: Self::best_block_updated
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ */
+typedef struct LDKConfirm {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Processes transactions confirmed in a block with a given header and height.
+ *
+ * Should be called for any transactions registered by [`Filter::register_tx`] or any
+ * transactions spending an output registered by [`Filter::register_output`]. Such transactions
+ * appearing in the same block do not need to be included in the same call; instead, multiple
+ * calls with additional transactions may be made so long as they are made in [chain order].
+ *
+ * May be called before or after [`best_block_updated`] for the corresponding block. However,
+ * in the event of a chain reorganization, it must not be called with a `header` that is no
+ * longer in the chain as of the last call to [`best_block_updated`].
+ *
+ * [chain order]: Self#order
+ * [`best_block_updated`]: Self::best_block_updated
+ */
+ void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
+ /**
+ * Processes a transaction that is no longer confirmed as result of a chain reorganization.
+ *
+ * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
+ * reorganized out of the best chain. Once called, the given transaction should not be returned
+ * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
+ *
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ */
+ void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
+ /**
+ * Processes an update to the best header connected at the given height.
+ *
+ * Should be called when a new header is available but may be skipped for intermediary blocks
+ * if they become available at the same time.
+ */
+ void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+ /**
+ * Returns transactions that should be monitored for reorganization out of the chain.
+ *
+ * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
+ * confirmations to be safe from a chain reorganization. Should not include any transactions
+ * passed to [`transaction_unconfirmed`] unless later reconfirmed.
+ *
+ * May be called to determine the subset of transactions that must still be monitored for
+ * reorganization. Will be idempotent between calls but may change as a result of calls to the
+ * other interface methods. Thus, this is useful to determine which transactions may need to be
+ * given to [`transaction_unconfirmed`].
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ */
+ struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKConfirm;
+
/**
*/
void Listen_free(struct LDKListen this_ptr);
+/**
+ * Calls the free function if one is set
+ */
+void Confirm_free(struct LDKConfirm this_ptr);
+
/**
* Calls the free function if one is set
*/
*/
void ChainMonitor_free(struct LDKChainMonitor this_obj);
-/**
- * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
- * of a channel and reacting accordingly based on transactions in the connected block. See
- * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
- * be returned by [`chain::Watch::release_pending_monitor_events`].
- *
- * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
- * calls must not exclude any transactions matching the new outputs nor any in-block
- * descendants of such transactions. It is not necessary to re-fetch the block to obtain
- * updated `txdata`.
- */
-void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
-
-/**
- * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
- * of a channel and reacting accordingly to newly confirmed transactions. For details, see
- * [`ChannelMonitor::transactions_confirmed`].
- *
- * Used instead of [`block_connected`] by clients that are notified of transactions rather than
- * blocks. May be called before or after [`update_best_block`] for transactions in the
- * corresponding block. See [`update_best_block`] for further calling expectations.
- *
- * [`block_connected`]: Self::block_connected
- * [`update_best_block`]: Self::update_best_block
- */
-void ChainMonitor_transactions_confirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
-
-/**
- * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
- * of a channel and reacting accordingly based on the new chain tip. For details, see
- * [`ChannelMonitor::update_best_block`].
- *
- * Used instead of [`block_connected`] by clients that are notified of transactions rather than
- * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
- * block.
- *
- * Must be called after new blocks become available for the most recent block. Intermediary
- * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
- * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
- * for any affected transactions.
- *
- * [`block_connected`]: Self::block_connected
- * [`transactions_confirmed`]: Self::transactions_confirmed
- * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
- */
-void ChainMonitor_update_best_block(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
-
-/**
- * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
- * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
- * details.
- */
-void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
-
-/**
- * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
- * of a channel based on transactions unconfirmed as a result of a chain reorganization. See
- * [`ChannelMonitor::transaction_unconfirmed`] for details.
- *
- * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
- * than blocks. May be called before or after [`update_best_block`] for transactions in the
- * corresponding block. See [`update_best_block`] for further calling expectations.
- *
- * [`block_disconnected`]: Self::block_disconnected
- * [`update_best_block`]: Self::update_best_block
- */
-void ChainMonitor_transaction_unconfirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
-
-/**
- * Returns the set of txids that should be monitored for re-organization out of the chain.
- */
-MUST_USE_RES struct LDKCVec_TxidZ ChainMonitor_get_relevant_txids(const struct LDKChainMonitor *NONNULL_PTR this_arg);
-
/**
* Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
*
* outputs to watch. See [`block_connected`] for details.
*
* Used instead of [`block_connected`] by clients that are notified of transactions rather than
- * blocks. May be called before or after [`update_best_block`] for transactions in the
- * corresponding block. See [`update_best_block`] for further calling expectations.
+ * blocks. See [`chain::Confirm`] for calling expectations.
*
* [`block_connected`]: Self::block_connected
- * [`update_best_block`]: Self::update_best_block
*/
MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
* Processes a transaction that was reorganized out of the chain.
*
* Used instead of [`block_disconnected`] by clients that are notified of transactions rather
- * than blocks. May be called before or after [`update_best_block`] for transactions in the
- * corresponding block. See [`update_best_block`] for further calling expectations.
+ * than blocks. See [`chain::Confirm`] for calling expectations.
*
* [`block_disconnected`]: Self::block_disconnected
- * [`update_best_block`]: Self::update_best_block
*/
void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
* [`block_connected`] for details.
*
* Used instead of [`block_connected`] by clients that are notified of transactions rather than
- * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
- * block.
- *
- * Must be called after new blocks become available for the most recent block. Intermediary
- * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
- * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
- * for any affected transactions.
+ * blocks. See [`chain::Confirm`] for calling expectations.
*
* [`block_connected`]: Self::block_connected
- * [`transactions_confirmed`]: Self::transactions_confirmed
- * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
*/
-MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_update_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
/**
* Returns the set of txids that should be monitored for re-organization out of the chain.
struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Updates channel state to take note of transactions which were confirmed in the given block
- * at the given height.
- *
- * Note that you must still call (or have called) [`update_best_block`] with the block
- * information which is included here.
- *
- * This method may be called before or after [`update_best_block`] for a given block's
- * transaction data and may be called multiple times with additional transaction data for a
- * given block.
- *
- * This method may be called for a previous block after an [`update_best_block`] call has
- * been made for a later block, however it must *not* be called with transaction data from a
- * block which is no longer in the best chain (ie where [`update_best_block`] has already
- * been informed about a blockchain reorganization which no longer includes the block which
- * corresponds to `header`).
- *
- * [`update_best_block`]: `Self::update_best_block`
- */
-void ChannelManager_transactions_confirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKCVec_C2Tuple_usizeTransactionZZ txdata);
-
-/**
- * Updates channel state with the current best blockchain tip. You should attempt to call this
- * quickly after a new block becomes available, however if multiple new blocks become
- * available at the same time, only a single `update_best_block()` call needs to be made.
- *
- * This method should also be called immediately after any block disconnections, once at the
- * reorganization fork point, and once with the new chain tip. Calling this method at the
- * blockchain reorganization fork point ensures we learn when a funding transaction which was
- * previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
- * accept payments which cannot be enforced on-chain.
- *
- * In both the block-connection and block-disconnection case, this method may be called either
- * once per block connected or disconnected, or simply at the fork point and new tip(s),
- * skipping any intermediary blocks.
- */
-void ChannelManager_update_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
-
-/**
- * Gets the set of txids which should be monitored for their confirmation state.
- *
- * If you're providing information about reorganizations via [`transaction_unconfirmed`], this
- * is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
- *
- * This may be useful to poll to determine the set of transactions which must be registered
- * with an Electrum server or for which an Electrum server needs to be polled to determine
- * transaction confirmation state.
- *
- * This may update after any [`transactions_confirmed`] or [`block_connected`] call.
- *
- * Note that this is NOT the set of transactions which must be included in calls to
- * [`transactions_confirmed`] if they are confirmed, but a small subset of it.
- *
- * [`transactions_confirmed`]: Self::transactions_confirmed
- * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
- * [`block_connected`]: chain::Listen::block_connected
- */
-MUST_USE_RES struct LDKCVec_TxidZ ChannelManager_get_relevant_txids(const struct LDKChannelManager *NONNULL_PTR this_arg);
-
-/**
- * Marks a transaction as having been reorganized out of the blockchain.
- *
- * If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
- * of the blockchain, this function should be called to indicate that the transaction should
- * be considered reorganized out.
- *
- * Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
- * though this may be called repeatedly for a given transaction without issue.
- *
- * Note that if the transaction is confirmed on the main chain in a different block (indicated
- * via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
- * be very wary of race-conditions wherein the final state of a transaction indicated via
- * these APIs is not the same as its state on the blockchain.
- *
- * [`transactions_confirmed`]: Self::transactions_confirmed
- * [`get_relevant_txids`]: Self::get_relevant_txids
+ * Constructs a new Confirm which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
*/
-void ChannelManager_transaction_unconfirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
+struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
* Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
const LDKListen* operator &() const { return &self; }
const LDKListen* operator ->() const { return &self; }
};
+class Confirm {
+private:
+ LDKConfirm self;
+public:
+ Confirm(const Confirm&) = delete;
+ Confirm(Confirm&& o) : self(o.self) { memset(&o, 0, sizeof(Confirm)); }
+ Confirm(LDKConfirm&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKConfirm)); }
+ operator LDKConfirm() && { LDKConfirm res = self; memset(&self, 0, sizeof(LDKConfirm)); return res; }
+ ~Confirm() { Confirm_free(self); }
+ Confirm& operator=(Confirm&& o) { Confirm_free(self); self = o.self; memset(&o, 0, sizeof(Confirm)); return *this; }
+ LDKConfirm* operator &() { return &self; }
+ LDKConfirm* operator ->() { return &self; }
+ const LDKConfirm* operator &() const { return &self; }
+ const LDKConfirm* operator ->() const { return &self; }
+};
class Watch {
private:
LDKWatch self;
use lightning::chain::chaininterface::BroadcasterInterface as rustBroadcasterInterface;
impl rustBroadcasterInterface for BroadcasterInterface {
fn broadcast_transaction(&self, tx: &bitcoin::blockdata::transaction::Transaction) {
- let mut local_tx = ::bitcoin::consensus::encode::serialize(tx);
- (self.broadcast_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_tx))
+ (self.broadcast_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(tx))
}
}
ret
}
}
-/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
-/// of a channel and reacting accordingly based on transactions in the connected block. See
-/// [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
-/// be returned by [`chain::Watch::release_pending_monitor_events`].
-///
-/// Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
-/// calls must not exclude any transactions matching the new outputs nor any in-block
-/// descendants of such transactions. It is not necessary to re-fetch the block to obtain
-/// updated `txdata`.
-#[no_mangle]
-pub extern "C" fn ChainMonitor_block_connected(this_arg: &ChainMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
- let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
- unsafe { &*this_arg.inner }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
-}
-
-/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
-/// of a channel and reacting accordingly to newly confirmed transactions. For details, see
-/// [`ChannelMonitor::transactions_confirmed`].
-///
-/// Used instead of [`block_connected`] by clients that are notified of transactions rather than
-/// blocks. May be called before or after [`update_best_block`] for transactions in the
-/// corresponding block. See [`update_best_block`] for further calling expectations.
-///
-/// [`block_connected`]: Self::block_connected
-/// [`update_best_block`]: Self::update_best_block
-#[no_mangle]
-pub extern "C" fn ChainMonitor_transactions_confirmed(this_arg: &ChainMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
- let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
- unsafe { &*this_arg.inner }.transactions_confirmed(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
-}
-
-/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
-/// of a channel and reacting accordingly based on the new chain tip. For details, see
-/// [`ChannelMonitor::update_best_block`].
-///
-/// Used instead of [`block_connected`] by clients that are notified of transactions rather than
-/// blocks. May be called before or after [`transactions_confirmed`] for the corresponding
-/// block.
-///
-/// Must be called after new blocks become available for the most recent block. Intermediary
-/// blocks, however, may be safely skipped. In the event of a chain re-organization, this only
-/// needs to be called for the most recent block assuming `transaction_unconfirmed` is called
-/// for any affected transactions.
-///
-/// [`block_connected`]: Self::block_connected
-/// [`transactions_confirmed`]: Self::transactions_confirmed
-/// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
-#[no_mangle]
-pub extern "C" fn ChainMonitor_update_best_block(this_arg: &ChainMonitor, header: *const [u8; 80], mut height: u32) {
- unsafe { &*this_arg.inner }.update_best_block(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
-}
-
-/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
-/// of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
-/// details.
-#[no_mangle]
-pub extern "C" fn ChainMonitor_block_disconnected(this_arg: &ChainMonitor, header: *const [u8; 80], mut disconnected_height: u32) {
- unsafe { &*this_arg.inner }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), disconnected_height)
-}
-
-/// Dispatches to per-channel monitors, which are responsible for updating their on-chain view
-/// of a channel based on transactions unconfirmed as a result of a chain reorganization. See
-/// [`ChannelMonitor::transaction_unconfirmed`] for details.
-///
-/// Used instead of [`block_disconnected`] by clients that are notified of transactions rather
-/// than blocks. May be called before or after [`update_best_block`] for transactions in the
-/// corresponding block. See [`update_best_block`] for further calling expectations.
-///
-/// [`block_disconnected`]: Self::block_disconnected
-/// [`update_best_block`]: Self::update_best_block
-#[no_mangle]
-pub extern "C" fn ChainMonitor_transaction_unconfirmed(this_arg: &ChainMonitor, txid: *const [u8; 32]) {
- unsafe { &*this_arg.inner }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
-}
-
-/// Returns the set of txids that should be monitored for re-organization out of the chain.
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ChainMonitor_get_relevant_txids(this_arg: &ChainMonitor) -> crate::c_types::derived::CVec_TxidZ {
- let mut ret = unsafe { &*this_arg.inner }.get_relevant_txids();
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); };
- local_ret.into()
-}
-
/// Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
///
/// When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
#[no_mangle]
pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUpdate) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_id;
- (*inner_val)
+ *inner_val
}
/// The sequence number of this update. Updates *must* be replayed in-order according to this
/// sequence number (and updates may panic if they are not). The update_id values are strictly
#[no_mangle]
pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ {
let mut ret = unsafe { &*this_arg.inner }.get_latest_holder_commitment_txn(logger);
- let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let mut local_ret_0 = ::bitcoin::consensus::encode::serialize(&item); crate::c_types::Transaction::from_vec(local_ret_0) }); };
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::Transaction::from_bitcoin(&item) }); };
local_ret.into()
}
/// outputs to watch. See [`block_connected`] for details.
///
/// Used instead of [`block_connected`] by clients that are notified of transactions rather than
-/// blocks. May be called before or after [`update_best_block`] for transactions in the
-/// corresponding block. See [`update_best_block`] for further calling expectations.
+/// blocks. See [`chain::Confirm`] for calling expectations.
///
/// [`block_connected`]: Self::block_connected
-/// [`update_best_block`]: Self::update_best_block
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
/// Processes a transaction that was reorganized out of the chain.
///
/// Used instead of [`block_disconnected`] by clients that are notified of transactions rather
-/// than blocks. May be called before or after [`update_best_block`] for transactions in the
-/// corresponding block. See [`update_best_block`] for further calling expectations.
+/// than blocks. See [`chain::Confirm`] for calling expectations.
///
/// [`block_disconnected`]: Self::block_disconnected
-/// [`update_best_block`]: Self::update_best_block
#[no_mangle]
pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &ChannelMonitor, txid: *const [u8; 32], mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) {
unsafe { &*this_arg.inner }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap(), broadcaster, fee_estimator, logger)
/// [`block_connected`] for details.
///
/// Used instead of [`block_connected`] by clients that are notified of transactions rather than
-/// blocks. May be called before or after [`transactions_confirmed`] for the corresponding
-/// block.
-///
-/// Must be called after new blocks become available for the most recent block. Intermediary
-/// blocks, however, may be safely skipped. In the event of a chain re-organization, this only
-/// needs to be called for the most recent block assuming `transaction_unconfirmed` is called
-/// for any affected transactions.
+/// blocks. See [`chain::Confirm`] for calling expectations.
///
/// [`block_connected`]: Self::block_connected
-/// [`transactions_confirmed`]: Self::transactions_confirmed
-/// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
#[must_use]
#[no_mangle]
-pub extern "C" fn ChannelMonitor_update_best_block(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
- let mut ret = unsafe { &*this_arg.inner }.update_best_block(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger);
+pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ {
+ let mut ret = unsafe { &*this_arg.inner }.best_block_updated(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger);
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); };
local_ret.into()
}
#[no_mangle]
pub extern "C" fn DelayedPaymentOutputDescriptor_get_outpoint(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.outpoint;
- crate::lightning::chain::transaction::OutPoint { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::chain::transaction::OutPoint { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The outpoint which is spendable
#[no_mangle]
#[no_mangle]
pub extern "C" fn DelayedPaymentOutputDescriptor_get_per_commitment_point(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Per commitment point to derive delayed_payment_key by key holder
#[no_mangle]
#[no_mangle]
pub extern "C" fn DelayedPaymentOutputDescriptor_get_to_self_delay(this_ptr: &DelayedPaymentOutputDescriptor) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
- (*inner_val)
+ *inner_val
}
/// The nSequence value which must be set in the spending input to satisfy the OP_CSV in
/// the witness_script.
#[no_mangle]
pub extern "C" fn DelayedPaymentOutputDescriptor_get_revocation_pubkey(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_pubkey;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The revocation point specific to the commitment transaction which was broadcast. Used to
/// derive the witnessScript for this output.
#[no_mangle]
pub extern "C" fn DelayedPaymentOutputDescriptor_get_channel_keys_id(this_ptr: &DelayedPaymentOutputDescriptor) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_keys_id;
- &(*inner_val)
+ inner_val
}
/// Arbitrary identification information returned by a call to
/// `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
#[no_mangle]
pub extern "C" fn DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr: &DelayedPaymentOutputDescriptor) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_value_satoshis;
- (*inner_val)
+ *inner_val
}
/// The value of the channel which this output originated from, possibly indirectly.
#[no_mangle]
#[no_mangle]
pub extern "C" fn StaticPaymentOutputDescriptor_get_outpoint(this_ptr: &StaticPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.outpoint;
- crate::lightning::chain::transaction::OutPoint { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::chain::transaction::OutPoint { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The outpoint which is spendable
#[no_mangle]
#[no_mangle]
pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_keys_id(this_ptr: &StaticPaymentOutputDescriptor) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_keys_id;
- &(*inner_val)
+ inner_val
}
/// Arbitrary identification information returned by a call to
/// `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
#[no_mangle]
pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr: &StaticPaymentOutputDescriptor) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_value_satoshis;
- (*inner_val)
+ *inner_val
}
/// The value of the channel which this transactions spends.
#[no_mangle]
local_ret
}
fn sign_justice_transaction(&self, justice_tx: &bitcoin::blockdata::transaction::Transaction, input: usize, amount: u64, per_commitment_key: &bitcoin::secp256k1::key::SecretKey, htlc: &Option<lightning::ln::chan_utils::HTLCOutputInCommitment>, _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
- let mut local_justice_tx = ::bitcoin::consensus::encode::serialize(justice_tx);
let mut local_htlc = &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (if htlc.is_none() { std::ptr::null() } else { { (htlc.as_ref().unwrap()) } } as *const _) as *mut _ }, is_owned: false };
- let mut ret = (self.sign_justice_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_justice_tx), input, amount, per_commitment_key.as_ref(), local_htlc);
+ let mut ret = (self.sign_justice_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), local_htlc);
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
fn sign_counterparty_htlc_transaction(&self, htlc_tx: &bitcoin::blockdata::transaction::Transaction, input: usize, amount: u64, per_commitment_point: &bitcoin::secp256k1::key::PublicKey, htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
- let mut local_htlc_tx = ::bitcoin::consensus::encode::serialize(htlc_tx);
- let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (htlc as *const _) as *mut _ }, is_owned: false });
+ let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (htlc as *const _) as *mut _ }, is_owned: false });
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
fn sign_closing_transaction(&self, closing_tx: &bitcoin::blockdata::transaction::Transaction, _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
- let mut local_closing_tx = ::bitcoin::consensus::encode::serialize(closing_tx);
- let mut ret = (self.sign_closing_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_closing_tx));
+ let mut ret = (self.sign_closing_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(closing_tx));
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
local_ret
}
fn sign_justice_transaction(&self, justice_tx: &bitcoin::blockdata::transaction::Transaction, input: usize, amount: u64, per_commitment_key: &bitcoin::secp256k1::key::SecretKey, htlc: &Option<lightning::ln::chan_utils::HTLCOutputInCommitment>, _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
- let mut local_justice_tx = ::bitcoin::consensus::encode::serialize(justice_tx);
let mut local_htlc = &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (if htlc.is_none() { std::ptr::null() } else { { (htlc.as_ref().unwrap()) } } as *const _) as *mut _ }, is_owned: false };
- let mut ret = (self.BaseSign.sign_justice_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_justice_tx), input, amount, per_commitment_key.as_ref(), local_htlc);
+ let mut ret = (self.BaseSign.sign_justice_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), local_htlc);
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
fn sign_counterparty_htlc_transaction(&self, htlc_tx: &bitcoin::blockdata::transaction::Transaction, input: usize, amount: u64, per_commitment_point: &bitcoin::secp256k1::key::PublicKey, htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
- let mut local_htlc_tx = ::bitcoin::consensus::encode::serialize(htlc_tx);
- let mut ret = (self.BaseSign.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (htlc as *const _) as *mut _ }, is_owned: false });
+ let mut ret = (self.BaseSign.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { (htlc as *const _) as *mut _ }, is_owned: false });
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
fn sign_closing_transaction(&self, closing_tx: &bitcoin::blockdata::transaction::Transaction, _secp_ctx: &bitcoin::secp256k1::Secp256k1<bitcoin::secp256k1::All>) -> Result<bitcoin::secp256k1::Signature, ()> {
- let mut local_closing_tx = ::bitcoin::consensus::encode::serialize(closing_tx);
- let mut ret = (self.BaseSign.sign_closing_transaction)(self.this_arg, crate::c_types::Transaction::from_vec(local_closing_tx));
+ let mut ret = (self.BaseSign.sign_closing_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(closing_tx));
let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })};
local_ret
}
#[no_mangle]
pub extern "C" fn InMemorySigner_get_funding_key(this_ptr: &InMemorySigner) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_key;
- (*inner_val).as_ref()
+ inner_val.as_ref()
}
/// Private key of anchor tx
#[no_mangle]
#[no_mangle]
pub extern "C" fn InMemorySigner_get_revocation_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_base_key;
- (*inner_val).as_ref()
+ inner_val.as_ref()
}
/// Holder secret key for blinded revocation pubkey
#[no_mangle]
#[no_mangle]
pub extern "C" fn InMemorySigner_get_payment_key(this_ptr: &InMemorySigner) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_key;
- (*inner_val).as_ref()
+ inner_val.as_ref()
}
/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions
#[no_mangle]
#[no_mangle]
pub extern "C" fn InMemorySigner_get_delayed_payment_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_base_key;
- (*inner_val).as_ref()
+ inner_val.as_ref()
}
/// Holder secret key used in HTLC tx
#[no_mangle]
#[no_mangle]
pub extern "C" fn InMemorySigner_get_htlc_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_base_key;
- (*inner_val).as_ref()
+ inner_val.as_ref()
}
/// Holder htlc secret key used in commitment tx htlc outputs
#[no_mangle]
#[no_mangle]
pub extern "C" fn InMemorySigner_get_commitment_seed(this_ptr: &InMemorySigner) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commitment_seed;
- &(*inner_val)
+ inner_val
}
/// Commitment seed
#[no_mangle]
let mut local_descriptors = Vec::new(); for mut item in descriptors.into_rust().drain(..) { local_descriptors.push( { item.into_native() }); };
let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_rust() }); };
let mut ret = unsafe { &*this_arg.inner }.spend_spendable_outputs(&local_descriptors.iter().collect::<Vec<_>>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::SECP256K1);
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = ::bitcoin::consensus::encode::serialize(&o); crate::c_types::Transaction::from_vec(local_ret_0) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { 0u8 /*e*/ }).into() };
local_ret
}
}
}
}
-/// The `Listen` trait is used to be notified of when blocks have been connected or disconnected
-/// from the chain.
+/// The `Listen` trait is used to notify when blocks have been connected or disconnected from the
+/// chain.
///
-/// Useful when needing to replay chain data upon startup or as new chain events occur.
+/// Useful when needing to replay chain data upon startup or as new chain events occur. Clients
+/// sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
+/// Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
+/// when needed.
#[repr(C)]
pub struct Listen {
/// An opaque pointer which is passed to your function implementations as an argument.
}
}
}
+/// The `Confirm` trait is used to notify when transactions have been confirmed on chain or
+/// unconfirmed during a chain reorganization.
+///
+/// Clients sourcing chain data using a transaction-oriented API should prefer this interface over
+/// [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
+/// related to registered transactions and outputs. Upon notification, it would pass along the
+/// matching transactions using this interface.
+///
+/// # Use
+///
+/// The intended use is as follows:
+/// - Call [`transactions_confirmed`] to process any on-chain activity of interest.
+/// - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
+/// that has been reorganized out of the chain.
+/// - Call [`best_block_updated`] whenever a new chain tip becomes available.
+///
+/// # Order
+///
+/// Clients must call these methods in chain order. Specifically:
+/// - Transactions confirmed in a block must be given before transactions confirmed in a later
+/// block.
+/// - Dependent transactions within the same block must be given in topological order, possibly in
+/// separate calls.
+/// - Unconfirmed transactions must be given after the original confirmations and before any
+/// reconfirmation.
+///
+/// See individual method documentation for further details.
+///
+/// [`transactions_confirmed`]: Self::transactions_confirmed
+/// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+/// [`best_block_updated`]: Self::best_block_updated
+/// [`get_relevant_txids`]: Self::get_relevant_txids
+#[repr(C)]
+pub struct Confirm {
+ /// An opaque pointer which is passed to your function implementations as an argument.
+ /// This has no meaning in the LDK, and can be NULL or any other value.
+ pub this_arg: *mut c_void,
+ /// Processes transactions confirmed in a block with a given header and height.
+ ///
+ /// Should be called for any transactions registered by [`Filter::register_tx`] or any
+ /// transactions spending an output registered by [`Filter::register_output`]. Such transactions
+ /// appearing in the same block do not need to be included in the same call; instead, multiple
+ /// calls with additional transactions may be made so long as they are made in [chain order].
+ ///
+ /// May be called before or after [`best_block_updated`] for the corresponding block. However,
+ /// in the event of a chain reorganization, it must not be called with a `header` that is no
+ /// longer in the chain as of the last call to [`best_block_updated`].
+ ///
+ /// [chain order]: Self#order
+ /// [`best_block_updated`]: Self::best_block_updated
+ pub transactions_confirmed: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, height: u32),
+ /// Processes a transaction that is no longer confirmed as result of a chain reorganization.
+ ///
+ /// Should be called for any transaction returned by [`get_relevant_txids`] if it has been
+ /// reorganized out of the best chain. Once called, the given transaction should not be returned
+ /// by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
+ ///
+ /// [`get_relevant_txids`]: Self::get_relevant_txids
+ /// [`transactions_confirmed`]: Self::transactions_confirmed
+ pub transaction_unconfirmed: extern "C" fn (this_arg: *const c_void, txid: *const [u8; 32]),
+ /// Processes an update to the best header connected at the given height.
+ ///
+ /// Should be called when a new header is available but may be skipped for intermediary blocks
+ /// if they become available at the same time.
+ pub best_block_updated: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], height: u32),
+ /// Returns transactions that should be monitored for reorganization out of the chain.
+ ///
+ /// Should include any transactions passed to [`transactions_confirmed`] that have insufficient
+ /// confirmations to be safe from a chain reorganization. Should not include any transactions
+ /// passed to [`transaction_unconfirmed`] unless later reconfirmed.
+ ///
+ /// May be called to determine the subset of transactions that must still be monitored for
+ /// reorganization. Will be idempotent between calls but may change as a result of calls to the
+ /// other interface methods. Thus, this is useful to determine which transactions may need to be
+ /// given to [`transaction_unconfirmed`].
+ ///
+ /// [`transactions_confirmed`]: Self::transactions_confirmed
+ /// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ #[must_use]
+ pub get_relevant_txids: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_TxidZ,
+ /// Frees any resources associated with this object given its this_arg pointer.
+ /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
+}
+
+use lightning::chain::Confirm as rustConfirm;
+impl rustConfirm for Confirm {
+ fn transactions_confirmed(&self, header: &bitcoin::blockdata::block::BlockHeader, txdata: &lightning::chain::transaction::TransactionData, height: u32) {
+ let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s };
+ let mut local_txdata = Vec::new(); for item in txdata.iter() { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = *item; let mut local_txdata_0 = (orig_txdata_0_0, crate::c_types::Transaction::from_bitcoin(&orig_txdata_0_1)).into(); local_txdata_0 }); };
+ (self.transactions_confirmed)(self.this_arg, &local_header, local_txdata.into(), height)
+ }
+ fn transaction_unconfirmed(&self, txid: &bitcoin::hash_types::Txid) {
+ (self.transaction_unconfirmed)(self.this_arg, txid.as_inner())
+ }
+ fn best_block_updated(&self, header: &bitcoin::blockdata::block::BlockHeader, height: u32) {
+ let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s };
+ (self.best_block_updated)(self.this_arg, &local_header, height)
+ }
+ fn get_relevant_txids(&self) -> Vec<bitcoin::hash_types::Txid> {
+ let mut ret = (self.get_relevant_txids)(self.this_arg);
+ let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { ::bitcoin::hash_types::Txid::from_slice(&item.data[..]).unwrap() }); };
+ local_ret
+ }
+}
+
+// We're essentially a pointer already, or at least a set of pointers, so allow us to be used
+// directly as a Deref trait in higher-level structs:
+impl std::ops::Deref for Confirm {
+ type Target = Self;
+ fn deref(&self) -> &Self {
+ self
+ }
+}
+/// Calls the free function if one is set
+#[no_mangle]
+pub extern "C" fn Confirm_free(this_ptr: Confirm) { }
+impl Drop for Confirm {
+ fn drop(&mut self) {
+ if let Some(f) = self.free {
+ f(self.this_arg);
+ }
+ }
+}
/// The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
/// blocks are connected and disconnected.
///
#[no_mangle]
pub extern "C" fn WatchedOutput_get_outpoint(this_ptr: &WatchedOutput) -> crate::lightning::chain::transaction::OutPoint {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.outpoint;
- crate::lightning::chain::transaction::OutPoint { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::chain::transaction::OutPoint { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Outpoint identifying the transaction output.
#[no_mangle]
#[no_mangle]
pub extern "C" fn WatchedOutput_get_script_pubkey(this_ptr: &WatchedOutput) -> crate::c_types::u8slice {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.script_pubkey;
- crate::c_types::u8slice::from_slice(&(*inner_val)[..])
+ crate::c_types::u8slice::from_slice(&inner_val[..])
}
/// Spending condition of the transaction output.
#[no_mangle]
#[no_mangle]
pub extern "C" fn OutPoint_get_txid(this_ptr: &OutPoint) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.txid;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The referenced transaction's txid.
#[no_mangle]
#[no_mangle]
pub extern "C" fn OutPoint_get_index(this_ptr: &OutPoint) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.index;
- (*inner_val)
+ *inner_val
}
/// The index of the referenced output in its transaction's vout.
#[no_mangle]
#[no_mangle]
pub extern "C" fn TxCreationKeys_get_per_commitment_point(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The broadcaster's per-commitment public key which was used to derive the other keys.
#[no_mangle]
#[no_mangle]
pub extern "C" fn TxCreationKeys_get_revocation_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_key;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The revocation key which is used to allow the broadcaster of the commitment
/// transaction to provide their counterparty the ability to punish them if they broadcast
#[no_mangle]
pub extern "C" fn TxCreationKeys_get_broadcaster_htlc_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.broadcaster_htlc_key;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Broadcaster's HTLC Key
#[no_mangle]
#[no_mangle]
pub extern "C" fn TxCreationKeys_get_countersignatory_htlc_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.countersignatory_htlc_key;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Countersignatory's HTLC Key
#[no_mangle]
#[no_mangle]
pub extern "C" fn TxCreationKeys_get_broadcaster_delayed_payment_key(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.broadcaster_delayed_payment_key;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelPublicKeys_get_funding_pubkey(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The public key which is used to sign all commitment transactions, as it appears in the
/// on-chain channel lock-in 2-of-2 multisig output.
#[no_mangle]
pub extern "C" fn ChannelPublicKeys_get_revocation_basepoint(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The base point which is used (with derive_public_revocation_key) to derive per-commitment
/// revocation keys. This is combined with the per-commitment-secret generated by the
#[no_mangle]
pub extern "C" fn ChannelPublicKeys_get_payment_point(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
/// spendable primary channel balance on the broadcaster's commitment transaction. This key is
#[no_mangle]
pub extern "C" fn ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The base point which is used (with derive_public_key) to derive a per-commitment payment
/// public key which receives non-HTLC-encumbered funds which are only available for spending
#[no_mangle]
pub extern "C" fn ChannelPublicKeys_get_htlc_basepoint(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The base point which is used (with derive_public_key) to derive a per-commitment public key
/// which is used to encumber HTLC-in-flight outputs.
#[no_mangle]
pub extern "C" fn HTLCOutputInCommitment_get_offered(this_ptr: &HTLCOutputInCommitment) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.offered;
- (*inner_val)
+ *inner_val
}
/// Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
/// Note that this is not the same as whether it is ountbound *from us*. To determine that you
#[no_mangle]
pub extern "C" fn HTLCOutputInCommitment_get_amount_msat(this_ptr: &HTLCOutputInCommitment) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.amount_msat;
- (*inner_val)
+ *inner_val
}
/// The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
/// this divided by 1000.
#[no_mangle]
pub extern "C" fn HTLCOutputInCommitment_get_cltv_expiry(this_ptr: &HTLCOutputInCommitment) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry;
- (*inner_val)
+ *inner_val
}
/// The CLTV lock-time at which this HTLC expires.
#[no_mangle]
#[no_mangle]
pub extern "C" fn HTLCOutputInCommitment_get_payment_hash(this_ptr: &HTLCOutputInCommitment) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_hash;
- &(*inner_val).0
+ &inner_val.0
}
/// The hash of the preimage which unlocks this HTLC.
#[no_mangle]
#[no_mangle]
pub extern "C" fn build_htlc_transaction(prev_hash: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction {
let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*prev_hash }[..]).unwrap(), feerate_per_kw, contest_delay, unsafe { &*htlc.inner }, &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust());
- let mut local_ret = ::bitcoin::consensus::encode::serialize(&ret);
- crate::c_types::Transaction::from_vec(local_ret)
+ crate::c_types::Transaction::from_bitcoin(&ret)
}
#[no_mangle]
pub extern "C" fn ChannelTransactionParameters_get_holder_pubkeys(this_ptr: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.holder_pubkeys;
- crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Holder public keys
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelTransactionParameters_get_holder_selected_contest_delay(this_ptr: &ChannelTransactionParameters) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.holder_selected_contest_delay;
- (*inner_val)
+ *inner_val
}
/// The contest delay selected by the holder, which applies to counterparty-broadcast transactions
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelTransactionParameters_get_is_outbound_from_holder(this_ptr: &ChannelTransactionParameters) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_outbound_from_holder;
- (*inner_val)
+ *inner_val
}
/// Whether the holder is the initiator of this channel.
/// This is an input to the commitment number obscure factor computation.
#[no_mangle]
pub extern "C" fn CounterpartyChannelTransactionParameters_get_pubkeys(this_ptr: &CounterpartyChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.pubkeys;
- crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Counter-party public keys
#[no_mangle]
#[no_mangle]
pub extern "C" fn CounterpartyChannelTransactionParameters_get_selected_contest_delay(this_ptr: &CounterpartyChannelTransactionParameters) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.selected_contest_delay;
- (*inner_val)
+ *inner_val
}
/// The contest delay selected by the counterparty, which applies to holder-broadcast transactions
#[no_mangle]
#[no_mangle]
pub extern "C" fn HolderCommitmentTransaction_get_counterparty_sig(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.counterparty_sig;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// Our counterparty's signature for the transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn BuiltCommitmentTransaction_get_transaction(this_ptr: &BuiltCommitmentTransaction) -> crate::c_types::Transaction {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.transaction;
- let mut local_inner_val = ::bitcoin::consensus::encode::serialize(inner_val);
- crate::c_types::Transaction::from_vec(local_inner_val)
+ crate::c_types::Transaction::from_bitcoin(inner_val)
}
/// The commitment transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn BuiltCommitmentTransaction_get_txid(this_ptr: &BuiltCommitmentTransaction) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.txid;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The txid for the commitment transaction.
///
#[no_mangle]
pub extern "C" fn ChainParameters_get_network(this_ptr: &ChainParameters) -> crate::bitcoin::network::Network {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.network;
- crate::bitcoin::network::Network::from_bitcoin((*inner_val))
+ crate::bitcoin::network::Network::from_bitcoin(inner_val)
}
/// The network for determining the `chain_hash` in Lightning messages.
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChainParameters_get_best_block(this_ptr: &ChainParameters) -> crate::lightning::ln::channelmanager::BestBlock {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.best_block;
- crate::lightning::ln::channelmanager::BestBlock { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::channelmanager::BestBlock { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The hash and height of the latest block successfully connected.
///
#[no_mangle]
pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
/// thereafter this is the txid of the funding transaction xor the funding transaction output).
#[no_mangle]
pub extern "C" fn ChannelDetails_get_remote_network_id(this_ptr: &ChannelDetails) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.remote_network_id;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The node_id of our counterparty
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelDetails_get_counterparty_features(this_ptr: &ChannelDetails) -> crate::lightning::ln::features::InitFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.counterparty_features;
- crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The Features the channel counterparty provided upon last connection.
/// Useful for routing as it is the most up-to-date copy of the counterparty's features and
#[no_mangle]
pub extern "C" fn ChannelDetails_get_channel_value_satoshis(this_ptr: &ChannelDetails) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_value_satoshis;
- (*inner_val)
+ *inner_val
}
/// The value, in satoshis, of this channel as appears in the funding output
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelDetails_get_user_id(this_ptr: &ChannelDetails) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.user_id;
- (*inner_val)
+ *inner_val
}
/// The user_id passed in to create_channel, or 0 if the channel was inbound.
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.outbound_capacity_msat;
- (*inner_val)
+ *inner_val
}
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
/// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
#[no_mangle]
pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.inbound_capacity_msat;
- (*inner_val)
+ *inner_val
}
/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
/// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
#[no_mangle]
pub extern "C" fn ChannelDetails_get_is_live(this_ptr: &ChannelDetails) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.is_live;
- (*inner_val)
+ *inner_val
}
/// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
/// the peer is connected, and (c) no monitor update failure is pending resolution.
<nativeChannelManager as lightning::chain::Listen<>>::block_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
}
-/// Updates channel state to take note of transactions which were confirmed in the given block
-/// at the given height.
-///
-/// Note that you must still call (or have called) [`update_best_block`] with the block
-/// information which is included here.
-///
-/// This method may be called before or after [`update_best_block`] for a given block's
-/// transaction data and may be called multiple times with additional transaction data for a
-/// given block.
-///
-/// This method may be called for a previous block after an [`update_best_block`] call has
-/// been made for a later block, however it must *not* be called with transaction data from a
-/// block which is no longer in the best chain (ie where [`update_best_block`] has already
-/// been informed about a blockchain reorganization which no longer includes the block which
-/// corresponds to `header`).
-///
-/// [`update_best_block`]: `Self::update_best_block`
-#[no_mangle]
-pub extern "C" fn ChannelManager_transactions_confirmed(this_arg: &ChannelManager, header: *const [u8; 80], mut height: u32, mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ) {
- let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
- unsafe { &*this_arg.inner }.transactions_confirmed(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..])
+impl From<nativeChannelManager> for crate::lightning::chain::Confirm {
+ fn from(obj: nativeChannelManager) -> Self {
+ let mut rust_obj = ChannelManager { inner: Box::into_raw(Box::new(obj)), is_owned: true };
+ let mut ret = ChannelManager_as_Confirm(&rust_obj);
+ // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn
+ rust_obj.inner = std::ptr::null_mut();
+ ret.free = Some(ChannelManager_free_void);
+ ret
+ }
}
-
-/// Updates channel state with the current best blockchain tip. You should attempt to call this
-/// quickly after a new block becomes available, however if multiple new blocks become
-/// available at the same time, only a single `update_best_block()` call needs to be made.
-///
-/// This method should also be called immediately after any block disconnections, once at the
-/// reorganization fork point, and once with the new chain tip. Calling this method at the
-/// blockchain reorganization fork point ensures we learn when a funding transaction which was
-/// previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
-/// accept payments which cannot be enforced on-chain.
-///
-/// In both the block-connection and block-disconnection case, this method may be called either
-/// once per block connected or disconnected, or simply at the fork point and new tip(s),
-/// skipping any intermediary blocks.
+/// Constructs a new Confirm which calls the relevant methods on this_arg.
+/// This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
#[no_mangle]
-pub extern "C" fn ChannelManager_update_best_block(this_arg: &ChannelManager, header: *const [u8; 80], mut height: u32) {
- unsafe { &*this_arg.inner }.update_best_block(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
+pub extern "C" fn ChannelManager_as_Confirm(this_arg: &ChannelManager) -> crate::lightning::chain::Confirm {
+ crate::lightning::chain::Confirm {
+ this_arg: unsafe { (*this_arg).inner as *mut c_void },
+ free: None,
+ transactions_confirmed: ChannelManager_Confirm_transactions_confirmed,
+ transaction_unconfirmed: ChannelManager_Confirm_transaction_unconfirmed,
+ best_block_updated: ChannelManager_Confirm_best_block_updated,
+ get_relevant_txids: ChannelManager_Confirm_get_relevant_txids,
+ }
}
-/// Gets the set of txids which should be monitored for their confirmation state.
-///
-/// If you're providing information about reorganizations via [`transaction_unconfirmed`], this
-/// is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
-///
-/// This may be useful to poll to determine the set of transactions which must be registered
-/// with an Electrum server or for which an Electrum server needs to be polled to determine
-/// transaction confirmation state.
-///
-/// This may update after any [`transactions_confirmed`] or [`block_connected`] call.
-///
-/// Note that this is NOT the set of transactions which must be included in calls to
-/// [`transactions_confirmed`] if they are confirmed, but a small subset of it.
-///
-/// [`transactions_confirmed`]: Self::transactions_confirmed
-/// [`transaction_unconfirmed`]: Self::transaction_unconfirmed
-/// [`block_connected`]: chain::Listen::block_connected
+extern "C" fn ChannelManager_Confirm_transactions_confirmed(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) {
+ let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); };
+ <nativeChannelManager as lightning::chain::Confirm<>>::transactions_confirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::<Vec<_>>()[..], height)
+}
+extern "C" fn ChannelManager_Confirm_best_block_updated(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) {
+ <nativeChannelManager as lightning::chain::Confirm<>>::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
+}
#[must_use]
-#[no_mangle]
-pub extern "C" fn ChannelManager_get_relevant_txids(this_arg: &ChannelManager) -> crate::c_types::derived::CVec_TxidZ {
- let mut ret = unsafe { &*this_arg.inner }.get_relevant_txids();
+extern "C" fn ChannelManager_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_TxidZ {
+ let mut ret = <nativeChannelManager as lightning::chain::Confirm<>>::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, );
let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); };
local_ret.into()
}
-
-/// Marks a transaction as having been reorganized out of the blockchain.
-///
-/// If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
-/// of the blockchain, this function should be called to indicate that the transaction should
-/// be considered reorganized out.
-///
-/// Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
-/// though this may be called repeatedly for a given transaction without issue.
-///
-/// Note that if the transaction is confirmed on the main chain in a different block (indicated
-/// via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
-/// be very wary of race-conditions wherein the final state of a transaction indicated via
-/// these APIs is not the same as its state on the blockchain.
-///
-/// [`transactions_confirmed`]: Self::transactions_confirmed
-/// [`get_relevant_txids`]: Self::get_relevant_txids
-#[no_mangle]
-pub extern "C" fn ChannelManager_transaction_unconfirmed(this_arg: &ChannelManager, txid: *const [u8; 32]) {
- unsafe { &*this_arg.inner }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
+extern "C" fn ChannelManager_Confirm_transaction_unconfirmed(this_arg: *const c_void, txid: *const [u8; 32]) {
+ <nativeChannelManager as lightning::chain::Confirm<>>::transaction_unconfirmed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap())
}
/// Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
#[no_mangle]
pub extern "C" fn ChannelManagerReadArgs_get_keys_manager(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::keysinterface::KeysInterface {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.keys_manager;
- &(*inner_val)
+ inner_val
}
/// The keys provider which will give us relevant keys. Some keys will be loaded during
/// deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
#[no_mangle]
pub extern "C" fn ChannelManagerReadArgs_get_fee_estimator(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::chaininterface::FeeEstimator {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_estimator;
- &(*inner_val)
+ inner_val
}
/// The fee_estimator for use in the ChannelManager in the future.
///
#[no_mangle]
pub extern "C" fn ChannelManagerReadArgs_get_chain_monitor(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::Watch {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_monitor;
- &(*inner_val)
+ inner_val
}
/// The chain::Watch for use in the ChannelManager in the future.
///
#[no_mangle]
pub extern "C" fn ChannelManagerReadArgs_get_tx_broadcaster(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::chaininterface::BroadcasterInterface {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.tx_broadcaster;
- &(*inner_val)
+ inner_val
}
/// The BroadcasterInterface which will be used in the ChannelManager in the future and may be
/// used to broadcast the latest local commitment transactions of channels which must be
#[no_mangle]
pub extern "C" fn ChannelManagerReadArgs_get_logger(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::util::logger::Logger {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.logger;
- &(*inner_val)
+ inner_val
}
/// The Logger for use in the ChannelManager and which may be used to log information during
/// deserialization.
#[no_mangle]
pub extern "C" fn ChannelManagerReadArgs_get_default_config(this_ptr: &ChannelManagerReadArgs) -> crate::lightning::util::config::UserConfig {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.default_config;
- crate::lightning::util::config::UserConfig { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::util::config::UserConfig { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Default settings used for new channels. Any existing channels will continue to use the
/// runtime settings which were stored when the ChannelManager was serialized.
#[no_mangle]
pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::lightning::ln::features::InitFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
- crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The relevant features which the sender supports
#[no_mangle]
#[no_mangle]
pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID involved in the error
#[no_mangle]
#[no_mangle]
pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.data;
- (*inner_val).as_str().into()
+ inner_val.as_str().into()
}
/// A possibly human-readable error description.
/// The string should be sanitized before it is used (e.g. emitted to logs
#[no_mangle]
pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.ponglen;
- (*inner_val)
+ *inner_val
}
/// The desired response length
#[no_mangle]
#[no_mangle]
pub extern "C" fn Ping_get_byteslen(this_ptr: &Ping) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
- (*inner_val)
+ *inner_val
}
/// The ping packet size.
/// This field is not sent on the wire. byteslen zeros are sent.
#[no_mangle]
pub extern "C" fn Pong_get_byteslen(this_ptr: &Pong) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
- (*inner_val)
+ *inner_val
}
/// The pong packet size.
/// This field is not sent on the wire. byteslen zeros are sent.
#[no_mangle]
pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_temporary_channel_id(this_ptr: &OpenChannel) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
- &(*inner_val)
+ inner_val
}
/// A temporary channel ID, until the funding outpoint is announced
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_funding_satoshis(this_ptr: &OpenChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_satoshis;
- (*inner_val)
+ *inner_val
}
/// The channel value
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_push_msat(this_ptr: &OpenChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.push_msat;
- (*inner_val)
+ *inner_val
}
/// The amount to push to the counterparty as part of the open, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_dust_limit_satoshis(this_ptr: &OpenChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
- (*inner_val)
+ *inner_val
}
/// The threshold below which outputs on transactions broadcast by sender will be omitted
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr: &OpenChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
- (*inner_val)
+ *inner_val
}
/// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_channel_reserve_satoshis(this_ptr: &OpenChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
- (*inner_val)
+ *inner_val
}
/// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_htlc_minimum_msat(this_ptr: &OpenChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
- (*inner_val)
+ *inner_val
}
/// The minimum HTLC size incoming to sender, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_feerate_per_kw(this_ptr: &OpenChannel) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
- (*inner_val)
+ *inner_val
}
/// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_to_self_delay(this_ptr: &OpenChannel) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
- (*inner_val)
+ *inner_val
}
/// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_max_accepted_htlcs(this_ptr: &OpenChannel) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
- (*inner_val)
+ *inner_val
}
/// The maximum number of inbound HTLCs towards sender
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_funding_pubkey(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The sender's key controlling the funding transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_revocation_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Used to derive a revocation key for transactions broadcast by counterparty
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_payment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// A payment key to sender for transactions broadcast by counterparty
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_delayed_payment_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Used to derive a payment key to sender for transactions broadcast by sender
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_htlc_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Used to derive an HTLC payment key to sender
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_first_per_commitment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The first to-be-broadcast-by-sender transaction's per commitment point
#[no_mangle]
#[no_mangle]
pub extern "C" fn OpenChannel_get_channel_flags(this_ptr: &OpenChannel) -> u8 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_flags;
- (*inner_val)
+ *inner_val
}
/// Channel flags
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
- &(*inner_val)
+ inner_val
}
/// A temporary channel ID, until the funding outpoint is announced
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_dust_limit_satoshis(this_ptr: &AcceptChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
- (*inner_val)
+ *inner_val
}
/// The threshold below which outputs on transactions broadcast by sender will be omitted
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr: &AcceptChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
- (*inner_val)
+ *inner_val
}
/// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
- (*inner_val)
+ *inner_val
}
/// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_htlc_minimum_msat(this_ptr: &AcceptChannel) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
- (*inner_val)
+ *inner_val
}
/// The minimum HTLC size incoming to sender, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_minimum_depth(this_ptr: &AcceptChannel) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
- (*inner_val)
+ *inner_val
}
/// Minimum depth of the funding transaction before the channel is considered open
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_to_self_delay(this_ptr: &AcceptChannel) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
- (*inner_val)
+ *inner_val
}
/// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_max_accepted_htlcs(this_ptr: &AcceptChannel) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
- (*inner_val)
+ *inner_val
}
/// The maximum number of inbound HTLCs towards sender
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_funding_pubkey(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The sender's key controlling the funding transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_revocation_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Used to derive a revocation key for transactions broadcast by counterparty
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_payment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// A payment key to sender for transactions broadcast by counterparty
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_delayed_payment_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Used to derive a payment key to sender for transactions broadcast by sender
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_htlc_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
#[no_mangle]
#[no_mangle]
pub extern "C" fn AcceptChannel_get_first_per_commitment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The first to-be-broadcast-by-sender transaction's per commitment point
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
- &(*inner_val)
+ inner_val
}
/// A temporary channel ID, until the funding is established
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_txid;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The funding transaction ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_output_index;
- (*inner_val)
+ *inner_val
}
/// The specific output index funding this channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// The signature of the channel initiator (funder) on the funding transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// The signature of the channel acceptor (fundee) on the funding transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn FundingLocked_get_next_per_commitment_point(this_ptr: &FundingLocked) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The per-commitment point of the second commitment transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn Shutdown_get_scriptpubkey(this_ptr: &Shutdown) -> crate::c_types::u8slice {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.scriptpubkey;
- crate::c_types::u8slice::from_slice(&(*inner_val)[..])
+ crate::c_types::u8slice::from_slice(&inner_val[..])
}
/// The destination of this peer's funds on closing.
/// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
#[no_mangle]
pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn ClosingSigned_get_fee_satoshis(this_ptr: &ClosingSigned) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_satoshis;
- (*inner_val)
+ *inner_val
}
/// The proposed total fee for the closing transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// A signature on the closing transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
- (*inner_val)
+ *inner_val
}
/// The HTLC ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.amount_msat;
- (*inner_val)
+ *inner_val
}
/// The HTLC value in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_hash;
- &(*inner_val).0
+ &inner_val.0
}
/// The payment hash, the pre-image of which controls HTLC redemption
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry;
- (*inner_val)
+ *inner_val
}
/// The expiry height of the HTLC
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
- (*inner_val)
+ *inner_val
}
/// The HTLC ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_preimage;
- &(*inner_val).0
+ &inner_val.0
}
/// The pre-image of the payment hash, allowing HTLC redemption
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
- (*inner_val)
+ *inner_val
}
/// The HTLC ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
- (*inner_val)
+ *inner_val
}
/// The HTLC ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.failure_code;
- (*inner_val)
+ *inner_val
}
/// The failure code
#[no_mangle]
#[no_mangle]
pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// A signature on the commitment transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_secret;
- &(*inner_val)
+ inner_val
}
/// The secret corresponding to the per-commitment point
#[no_mangle]
#[no_mangle]
pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The next sender-broadcast commitment transaction's per-commitment point
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
- (*inner_val)
+ *inner_val
}
/// Fee rate per 1000-weight of the transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn DataLossProtect_get_your_last_per_commitment_secret(this_ptr: &DataLossProtect) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret;
- &(*inner_val)
+ inner_val
}
/// Proof that the sender knows the per-commitment secret of a specific commitment transaction
/// belonging to the recipient
#[no_mangle]
pub extern "C" fn DataLossProtect_get_my_current_per_commitment_point(this_ptr: &DataLossProtect) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The sender's per-commitment point for their current commitment transaction
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_local_commitment_number;
- (*inner_val)
+ *inner_val
}
/// The next commitment number for the sender
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_remote_commitment_number;
- (*inner_val)
+ *inner_val
}
/// The next commitment number for the recipient
#[no_mangle]
#[no_mangle]
pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
- &(*inner_val)
+ inner_val
}
/// The channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
- (*inner_val)
+ *inner_val
}
/// The short channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// A signature by the node key
#[no_mangle]
#[no_mangle]
pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// A signature by the funding key
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::ln::features::NodeFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
- crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The advertised features
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
- (*inner_val)
+ *inner_val
}
/// A strictly monotonic announcement counter, with gaps allowed
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The node_id this announcement originated from (don't rebroadcast the node_announcement back
/// to this node).
#[no_mangle]
pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.rgb;
- &(*inner_val)
+ inner_val
}
/// An RGB color for UI purposes
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.alias;
- &(*inner_val)
+ inner_val
}
/// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
/// of uniqueness.
#[no_mangle]
pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// The signature by the node key
#[no_mangle]
#[no_mangle]
pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::lightning::ln::msgs::UnsignedNodeAnnouncement {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
- crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The actual content of the announcement
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::ln::features::ChannelFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
- crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The advertised channel features
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
- (*inner_val)
+ *inner_val
}
/// The short channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_1;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// One of the two node_ids which are endpoints of this channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_2;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The other of the two node_ids which are endpoints of this channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_1;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The funding key for the first node
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_2;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The funding key for the second node
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_1;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// Authentication of the announcement by the first public node
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_2;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// Authentication of the announcement by the second public node
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_1;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// Proof of funding UTXO ownership by the first public node
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_2;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// Proof of funding UTXO ownership by the second public node
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::lightning::ln::msgs::UnsignedChannelAnnouncement {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
- crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The actual announcement
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain where the channel is to be opened
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
- (*inner_val)
+ *inner_val
}
/// The short channel ID
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
- (*inner_val)
+ *inner_val
}
/// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_flags(this_ptr: &UnsignedChannelUpdate) -> u8 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.flags;
- (*inner_val)
+ *inner_val
}
/// Channel flags
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
- (*inner_val)
+ *inner_val
}
/// The number of blocks such that if:
/// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
- (*inner_val)
+ *inner_val
}
/// The minimum HTLC size incoming to sender, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_base_msat;
- (*inner_val)
+ *inner_val
}
/// The base HTLC fee charged by sender, in milli-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
- (*inner_val)
+ *inner_val
}
/// The amount to fee multiplier, in micro-satoshi
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
- crate::c_types::Signature::from_rust(&(*inner_val))
+ crate::c_types::Signature::from_rust(&inner_val)
}
/// A signature of the channel update
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::lightning::ln::msgs::UnsignedChannelUpdate {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
- crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The actual channel update
#[no_mangle]
#[no_mangle]
pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain being queried
#[no_mangle]
#[no_mangle]
pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
- (*inner_val)
+ *inner_val
}
/// The height of the first block for the channel UTXOs being queried
#[no_mangle]
#[no_mangle]
pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
- (*inner_val)
+ *inner_val
}
/// The number of blocks to include in the query results
#[no_mangle]
#[no_mangle]
pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain being queried
#[no_mangle]
#[no_mangle]
pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
- (*inner_val)
+ *inner_val
}
/// The height of the first block in the range of the reply
#[no_mangle]
#[no_mangle]
pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
- (*inner_val)
+ *inner_val
}
/// The number of blocks included in the range of the reply
#[no_mangle]
#[no_mangle]
pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.sync_complete;
- (*inner_val)
+ *inner_val
}
/// True when this is the final reply for a query
#[no_mangle]
#[no_mangle]
pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain being queried
#[no_mangle]
#[no_mangle]
pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain that was queried
#[no_mangle]
#[no_mangle]
pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.full_information;
- (*inner_val)
+ *inner_val
}
/// Indicates if the query recipient maintains up-to-date channel
/// information for the chain_hash
#[no_mangle]
pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
- (*inner_val).as_inner()
+ inner_val.as_inner()
}
/// The genesis hash of the blockchain for channel and node information
#[no_mangle]
#[no_mangle]
pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_timestamp;
- (*inner_val)
+ *inner_val
}
/// The starting unix timestamp
#[no_mangle]
#[no_mangle]
pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp_range;
- (*inner_val)
+ *inner_val
}
/// The range of information in seconds
#[no_mangle]
#[no_mangle]
pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.err;
- (*inner_val).as_str().into()
+ inner_val.as_str().into()
}
/// A human-readable message describing the error
#[no_mangle]
#[no_mangle]
pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::lightning::ln::msgs::ErrorAction {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.action;
- crate::lightning::ln::msgs::ErrorAction::from_native(&(*inner_val))
+ crate::lightning::ln::msgs::ErrorAction::from_native(inner_val)
}
/// The action which should be taken against the offending peer.
#[no_mangle]
#[no_mangle]
pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::CommitmentSigned {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commitment_signed;
- crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Finally, the commitment_signed message which should be sent
#[no_mangle]
local_ret
}
fn handle_htlc_fail_channel_update(&self, update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
- (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::lightning::ln::msgs::HTLCFailChannelUpdate::from_native(&update))
+ (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::lightning::ln::msgs::HTLCFailChannelUpdate::from_native(update))
}
fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
let mut ret = (self.get_next_channel_announcements)(self.this_arg, starting_point, batch_amount);
#[no_mangle]
pub extern "C" fn MessageHandler_get_chan_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::ChannelMessageHandler {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chan_handler;
- &(*inner_val)
+ inner_val
}
/// A message handler which handles messages specific to channels. Usually this is just a
/// ChannelManager object or a ErroringMessageHandler.
#[no_mangle]
pub extern "C" fn MessageHandler_get_route_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::RoutingMessageHandler {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.route_handler;
- &(*inner_val)
+ inner_val
}
/// A message handler which handles messages updating our knowledge of the network channel
/// graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
#[no_mangle]
pub extern "C" fn PeerHandleError_get_no_connection_possible(this_ptr: &PeerHandleError) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.no_connection_possible;
- (*inner_val)
+ *inner_val
}
/// Used to indicate that we probably can't make any future connections to this peer, implying
/// we should go ahead and force-close any channels we have with it.
#[no_mangle]
pub extern "C" fn DirectionalChannelInfo_get_last_update(this_ptr: &DirectionalChannelInfo) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.last_update;
- (*inner_val)
+ *inner_val
}
/// When the last update to the channel direction was issued.
/// Value is opaque, as set in the announcement.
#[no_mangle]
pub extern "C" fn DirectionalChannelInfo_get_enabled(this_ptr: &DirectionalChannelInfo) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.enabled;
- (*inner_val)
+ *inner_val
}
/// Whether the channel can be currently used for payments (in this one direction).
#[no_mangle]
#[no_mangle]
pub extern "C" fn DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr: &DirectionalChannelInfo) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
- (*inner_val)
+ *inner_val
}
/// The difference in CLTV values that you must have when routing through this channel.
#[no_mangle]
#[no_mangle]
pub extern "C" fn DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr: &DirectionalChannelInfo) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
- (*inner_val)
+ *inner_val
}
/// The minimum value, which must be relayed to the next hop via the channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn DirectionalChannelInfo_get_fees(this_ptr: &DirectionalChannelInfo) -> crate::lightning::routing::network_graph::RoutingFees {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fees;
- crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Fees charged when the channel is used for routing
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::lightning::ln::features::ChannelFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
- crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Protocol features of a channel communicated during its announcement
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelInfo_get_node_one(this_ptr: &ChannelInfo) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_one;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Source node of the first direction of a channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelInfo_get_node_two(this_ptr: &ChannelInfo) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_two;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// Source node of the second direction of a channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn RoutingFees_get_base_msat(this_ptr: &RoutingFees) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.base_msat;
- (*inner_val)
+ *inner_val
}
/// Flat routing fee in satoshis
#[no_mangle]
#[no_mangle]
pub extern "C" fn RoutingFees_get_proportional_millionths(this_ptr: &RoutingFees) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.proportional_millionths;
- (*inner_val)
+ *inner_val
}
/// Liquidity-based routing fee in millionths of a routed amount.
/// In other words, 10000 is 1%.
#[no_mangle]
pub extern "C" fn NodeAnnouncementInfo_get_features(this_ptr: &NodeAnnouncementInfo) -> crate::lightning::ln::features::NodeFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
- crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Protocol features the node announced support for
#[no_mangle]
#[no_mangle]
pub extern "C" fn NodeAnnouncementInfo_get_last_update(this_ptr: &NodeAnnouncementInfo) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.last_update;
- (*inner_val)
+ *inner_val
}
/// When the last known update to the node state was issued.
/// Value is opaque, as set in the announcement.
#[no_mangle]
pub extern "C" fn NodeAnnouncementInfo_get_rgb(this_ptr: &NodeAnnouncementInfo) -> *const [u8; 3] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.rgb;
- &(*inner_val)
+ inner_val
}
/// Color assigned to the node
#[no_mangle]
#[no_mangle]
pub extern "C" fn NodeAnnouncementInfo_get_alias(this_ptr: &NodeAnnouncementInfo) -> *const [u8; 32] {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.alias;
- &(*inner_val)
+ inner_val
}
/// Moniker assigned to the node.
/// May be invalid or malicious (eg control chars),
#[no_mangle]
pub extern "C" fn RouteHop_get_pubkey(this_ptr: &RouteHop) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.pubkey;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The node_id of the node at this hop.
#[no_mangle]
#[no_mangle]
pub extern "C" fn RouteHop_get_node_features(this_ptr: &RouteHop) -> crate::lightning::ln::features::NodeFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_features;
- crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The node_announcement features of the node at this hop. For the last hop, these may be
/// amended to match the features present in the invoice this node generated.
#[no_mangle]
pub extern "C" fn RouteHop_get_short_channel_id(this_ptr: &RouteHop) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
- (*inner_val)
+ *inner_val
}
/// The channel that should be used from the previous hop to reach this node.
#[no_mangle]
#[no_mangle]
pub extern "C" fn RouteHop_get_channel_features(this_ptr: &RouteHop) -> crate::lightning::ln::features::ChannelFeatures {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_features;
- crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The channel_announcement features of the channel that should be used from the previous hop
/// to reach this node.
#[no_mangle]
pub extern "C" fn RouteHop_get_fee_msat(this_ptr: &RouteHop) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_msat;
- (*inner_val)
+ *inner_val
}
/// The fee taken on this hop (for paying for the use of the *next* channel in the path).
/// For the last hop, this should be the full value of the payment (might be more than
#[no_mangle]
pub extern "C" fn RouteHop_get_cltv_expiry_delta(this_ptr: &RouteHop) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
- (*inner_val)
+ *inner_val
}
/// The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
/// expected at the destination, in excess of the current block height.
#[no_mangle]
pub extern "C" fn RouteHintHop_get_src_node_id(this_ptr: &RouteHintHop) -> crate::c_types::PublicKey {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.src_node_id;
- crate::c_types::PublicKey::from_rust(&(*inner_val))
+ crate::c_types::PublicKey::from_rust(&inner_val)
}
/// The node_id of the non-target end of the route
#[no_mangle]
#[no_mangle]
pub extern "C" fn RouteHintHop_get_short_channel_id(this_ptr: &RouteHintHop) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
- (*inner_val)
+ *inner_val
}
/// The short_channel_id of this channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn RouteHintHop_get_fees(this_ptr: &RouteHintHop) -> crate::lightning::routing::network_graph::RoutingFees {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fees;
- crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::routing::network_graph::RoutingFees { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// The fees which must be paid to use this channel
#[no_mangle]
#[no_mangle]
pub extern "C" fn RouteHintHop_get_cltv_expiry_delta(this_ptr: &RouteHintHop) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
- (*inner_val)
+ *inner_val
}
/// The difference in CLTV values between this node and the next node.
#[no_mangle]
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_get_minimum_depth(this_ptr: &ChannelHandshakeConfig) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
- (*inner_val)
+ *inner_val
}
/// Confirmations we will wait for before considering the channel locked in.
/// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_get_our_to_self_delay(this_ptr: &ChannelHandshakeConfig) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.our_to_self_delay;
- (*inner_val)
+ *inner_val
}
/// Set to the number of blocks we require our counterparty to wait to claim their money (ie
/// the number of blocks we have to punish our counterparty if they broadcast a revoked
#[no_mangle]
pub extern "C" fn ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr: &ChannelHandshakeConfig) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.our_htlc_minimum_msat;
- (*inner_val)
+ *inner_val
}
/// Set to the smallest value HTLC we will accept to process.
///
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_funding_satoshis;
- (*inner_val)
+ *inner_val
}
/// Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
/// only applies to inbound channels.
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr: &ChannelHandshakeLimits) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_minimum_msat;
- (*inner_val)
+ *inner_val
}
/// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
/// you to limit the maximum minimum-size they can require.
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr: &ChannelHandshakeLimits) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_max_htlc_value_in_flight_msat;
- (*inner_val)
+ *inner_val
}
/// The remote node sets a limit on the maximum value of pending HTLCs to them at any given
/// time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_channel_reserve_satoshis;
- (*inner_val)
+ *inner_val
}
/// The remote node will require we keep a certain amount in direct payment to ourselves at all
/// time, ensuring that we are able to be punished if we broadcast an old state. This allows to
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr: &ChannelHandshakeLimits) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_max_accepted_htlcs;
- (*inner_val)
+ *inner_val
}
/// The remote node sets a limit on the maximum number of pending HTLCs to them at any given
/// time. This allows you to set a minimum such value.
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_min_dust_limit_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.min_dust_limit_satoshis;
- (*inner_val)
+ *inner_val
}
/// Outputs below a certain value will not be added to on-chain transactions. The dust value is
/// required to always be higher than this value so this only applies to HTLC outputs (and
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_max_dust_limit_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_dust_limit_satoshis;
- (*inner_val)
+ *inner_val
}
/// Maximum allowed threshold above which outputs will not be generated in their commitment
/// transactions.
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_max_minimum_depth(this_ptr: &ChannelHandshakeLimits) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_minimum_depth;
- (*inner_val)
+ *inner_val
}
/// Before a channel is usable the funding transaction will need to be confirmed by at least a
/// certain number of blocks, specified by the node which is not the funder (as the funder can
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr: &ChannelHandshakeLimits) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.force_announced_channel_preference;
- (*inner_val)
+ *inner_val
}
/// Set to force the incoming channel to match our announced channel preference in
/// ChannelConfig.
#[no_mangle]
pub extern "C" fn ChannelHandshakeLimits_get_their_to_self_delay(this_ptr: &ChannelHandshakeLimits) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.their_to_self_delay;
- (*inner_val)
+ *inner_val
}
/// Set to the amount of time we're willing to wait to claim money back to us.
///
#[no_mangle]
pub extern "C" fn ChannelConfig_get_fee_proportional_millionths(this_ptr: &ChannelConfig) -> u32 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
- (*inner_val)
+ *inner_val
}
/// Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
/// This may be allowed to change at runtime in a later update, however doing so must result in
#[no_mangle]
pub extern "C" fn ChannelConfig_get_cltv_expiry_delta(this_ptr: &ChannelConfig) -> u16 {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
- (*inner_val)
+ *inner_val
}
/// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
/// the channel this config applies to.
#[no_mangle]
pub extern "C" fn ChannelConfig_get_announced_channel(this_ptr: &ChannelConfig) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.announced_channel;
- (*inner_val)
+ *inner_val
}
/// Set to announce the channel publicly and notify all nodes that they can route via this
/// channel.
#[no_mangle]
pub extern "C" fn ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr: &ChannelConfig) -> bool {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commit_upfront_shutdown_pubkey;
- (*inner_val)
+ *inner_val
}
/// When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
/// supports it, they will then enforce the mutual-close output to us matches what we provided
#[no_mangle]
pub extern "C" fn UserConfig_get_own_channel_config(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeConfig {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.own_channel_config;
- crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Channel config that we propose to our counterparty.
#[no_mangle]
#[no_mangle]
pub extern "C" fn UserConfig_get_peer_channel_config_limits(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeLimits {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.peer_channel_config_limits;
- crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Limits applied to our counterparty's proposed channel config settings.
#[no_mangle]
#[no_mangle]
pub extern "C" fn UserConfig_get_channel_options(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelConfig {
let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_options;
- crate::lightning::util::config::ChannelConfig { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
+ crate::lightning::util::config::ChannelConfig { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
}
/// Channel config which affects behavior during channel lifetime.
#[no_mangle]