Skip to content

Commit beee006

Browse files
committed
Document Channel::get_funding_redeemscript precondition
1 parent 6c07555 commit beee006

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ln/channel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,11 @@ impl Channel {
893893

894894
/// Gets the redeemscript for the funding transaction output (ie the funding transaction output
895895
/// pays to get_funding_redeemscript().to_v0_p2wsh()).
896+
/// Panics if called before accept_channel/new_from_req
896897
pub fn get_funding_redeemscript(&self) -> Script {
897898
let builder = Builder::new().push_opcode(opcodes::All::OP_PUSHNUM_2);
898899
let our_funding_key = PublicKey::from_secret_key(&self.secp_ctx, &self.local_keys.funding_key).serialize();
899-
let their_funding_key = self.their_funding_pubkey.unwrap().serialize();
900+
let their_funding_key = self.their_funding_pubkey.expect("get_funding_redeemscript only allowed after accept_channel").serialize();
900901
if our_funding_key[..] < their_funding_key[..] {
901902
builder.push_slice(&our_funding_key)
902903
.push_slice(&their_funding_key)

0 commit comments

Comments
 (0)