You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix panic when calling batch_funding_transaction_generated early
If a user calls `batch_funding_transaction_generated` before a
channel is ready to fund its possible to hit an `unwrap` when the
transaction-scanning logic attempts to fetch the channel's expected
output `scriptPubKey`.
While users shouldn't be doing this, we should also avoid the
panic, so here check the channel state first.
Found by the `full_stack_target` fuzzer.
let open_msg = get_event_msg!(nodes[0],MessageSendEvent::SendOpenChannel, node_b_id);
2527
+
2528
+
let tx = Transaction{
2529
+
version:Version(2),
2530
+
lock_time:LockTime::ZERO,
2531
+
input:vec![],
2532
+
output:vec![],
2533
+
};
2534
+
let pending_chan = [(&open_msg.common_fields.temporary_channel_id,&node_b_id)];
2535
+
let res = nodes[0].node.batch_funding_transaction_generated(&pending_chan, tx);
2536
+
ifletErr(APIError::APIMisuseError{ err }) = res {
2537
+
assert_eq!(err,"Channel f7fee84016d554015f5166c0a0df6479942ef55fd70713883b0493493a38e13a with counterparty 0355f8d2238a322d16b602bd0ceaad5b01019fb055971eaadcc9b29226a4da6c23 is not an unfunded, outbound channel ready to fund");
2538
+
}else{
2539
+
panic!("Unexpected result {res:?}");
2540
+
}
2541
+
get_err_msg(&nodes[0],&node_b_id);
2542
+
let reason = ClosureReason::ProcessingError{
2543
+
err:"Error in transaction funding: Misuse error: Channel f7fee84016d554015f5166c0a0df6479942ef55fd70713883b0493493a38e13a with counterparty 0355f8d2238a322d16b602bd0ceaad5b01019fb055971eaadcc9b29226a4da6c23 is not an unfunded, outbound channel ready to fund".to_owned(),
0 commit comments