projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2fa45ae
)
Add public helper to build anchor input witnesses
author
Wilmer Paulino
<wilmer.paulino@gmail.com>
Tue, 11 Oct 2022 18:46:24 +0000
(14:46 -0400)
committer
Wilmer Paulino
<wilmer.paulino@gmail.com>
Tue, 18 Oct 2022 19:23:29 +0000
(12:23 -0700)
lightning/src/ln/chan_utils.rs
patch
|
blob
|
history
diff --git
a/lightning/src/ln/chan_utils.rs
b/lightning/src/ln/chan_utils.rs
index 13b632e7b4685f04ae2aef9800a68347dea286d0..15bc0d0e23e08079751972f32d751a76dc4706d7 100644
(file)
--- a/
lightning/src/ln/chan_utils.rs
+++ b/
lightning/src/ln/chan_utils.rs
@@
-736,6
+736,14
@@
pub(crate) fn get_anchor_output<'a>(commitment_tx: &'a Transaction, funding_pubk
.map(|(idx, txout)| (idx as u32, txout))
}
.map(|(idx, txout)| (idx as u32, txout))
}
+/// Returns the witness required to satisfy and spend an anchor input.
+pub fn build_anchor_input_witness(funding_key: &PublicKey, funding_sig: &Signature) -> Witness {
+ let anchor_redeem_script = chan_utils::get_anchor_redeemscript(funding_key);
+ let mut funding_sig = funding_sig.serialize_der().to_vec();
+ funding_sig.push(EcdsaSighashType::All as u8);
+ Witness::from_vec(vec![funding_sig, anchor_redeem_script.to_bytes()])
+}
+
/// Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
/// The fields are organized by holder/counterparty.
///
/// Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
/// The fields are organized by holder/counterparty.
///