- &InputMaterial::LocalHTLC { .. } => {
- //TODO : Given that Local Commitment Transaction and HTLC-Timeout/HTLC-Success are counter-signed by peer, we can't
- // RBF them. Need a Lightning specs change and package relay modification :
- // https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-November/016518.html
+ &InputMaterial::LocalHTLC { ref preimage, ref amount } => {
+ let mut htlc_tx = None;
+ if let Some(ref mut local_commitment) = self.local_commitment {
+ if local_commitment.txid() == outp.txid {
+ self.key_storage.sign_htlc_transaction(local_commitment, outp.vout, *preimage, self.local_csv, &self.secp_ctx);
+ htlc_tx = local_commitment.htlc_with_valid_witness(outp.vout).clone();
+ }
+ }
+ if let Some(ref mut prev_local_commitment) = self.prev_local_commitment {
+ if prev_local_commitment.txid() == outp.txid {
+ self.key_storage.sign_htlc_transaction(prev_local_commitment, outp.vout, *preimage, self.local_csv, &self.secp_ctx);
+ htlc_tx = prev_local_commitment.htlc_with_valid_witness(outp.vout).clone();
+ }
+ }
+ if let Some(htlc_tx) = htlc_tx {
+ let feerate = (amount - htlc_tx.output[0].value) * 1000 / htlc_tx.get_weight() as u64;
+ // Timer set to $NEVER given we can't bump tx without anchor outputs
+ log_trace!(self, "Going to broadcast Local HTLC-{} claiming HTLC output {} from {}...", if preimage.is_some() { "Success" } else { "Timeout" }, outp.vout, outp.txid);
+ return Some((None, feerate, htlc_tx));
+ }