Add a `payment_metadata` field to `RecipientOnionFields`
[rust-lightning] / lightning / src / chain / onchaintx.rs
index 0ff0df59cf27c91ba39b77bfe5d346586e105e1a..f690d3664273b94e8ee9fe8d6d4c9f16d44ece0e 100644 (file)
@@ -12,6 +12,8 @@
 //! OnchainTxHandler objects are fully-part of ChannelMonitor and encapsulates all
 //! building, tracking, bumping and notifications functions.
 
+#[cfg(anchors)]
+use bitcoin::PackedLockTime;
 use bitcoin::blockdata::transaction::Transaction;
 use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
 use bitcoin::blockdata::script::Script;
@@ -201,6 +203,7 @@ pub(crate) enum ClaimEvent {
        BumpHTLC {
                target_feerate_sat_per_1000_weight: u32,
                htlcs: Vec<ExternalHTLCClaim>,
+               tx_lock_time: PackedLockTime,
        },
 }
 
@@ -544,6 +547,7 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
                                                        OnchainClaim::Event(ClaimEvent::BumpHTLC {
                                                                target_feerate_sat_per_1000_weight,
                                                                htlcs,
+                                                               tx_lock_time: PackedLockTime(cached_request.package_locktime(cur_height)),
                                                        }),
                                                ));
                                        } else {
@@ -558,7 +562,9 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
                        ) {
                                assert!(new_feerate != 0);
 
-                               let transaction = cached_request.finalize_malleable_package(self, output_value, self.destination_script.clone(), logger).unwrap();
+                               let transaction = cached_request.finalize_malleable_package(
+                                       cur_height, self, output_value, self.destination_script.clone(), logger
+                               ).unwrap();
                                log_trace!(logger, "...with timer {} and feerate {}", new_timer.unwrap(), new_feerate);
                                assert!(predicted_weight >= transaction.weight());
                                return Some((new_timer, new_feerate, OnchainClaim::Tx(transaction)));