Add ability to open channel with all on-chain funds#788
Add ability to open channel with all on-chain funds#788benthecarman wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
Uses the same fee estimation logic that `send_all_to_address` uses which can be hack but it works today. Tests generated with claude.
|
👋 Thanks for assigning @tnull as a reviewer! |
|
🔔 1st Reminder Hey @tnull! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @tnull! This PR has been waiting for your review. |
| // Use a dummy P2WSH script (34 bytes) to match the size of a real funding output. | ||
| let dummy_p2wsh_script = ScriptBuf::new().to_p2wsh(); | ||
|
|
||
| let tmp_tx = if cur_anchor_reserve_sats > DUST_LIMIT_SATS { |
There was a problem hiding this comment.
Can we DRY this up by pulling the 'spend all but reserves' part into a helper method in a prefactor commit? Basically this get_max_funding_amount should already be ~that helper method, no? We'd just need to reuse it in send_all?
| #[tokio::test(flavor = "multi_thread", worker_threads = 1)] | ||
| async fn open_channel_with_all_with_anchors() { | ||
| let (bitcoind, electrsd) = setup_bitcoind_and_electrsd(); | ||
| let chain_source = TestChainSource::Esplora(&electrsd); |
There was a problem hiding this comment.
Given that this will likely land after #769, we should probably use random_chain_source here and below.
Part of #777
Uses the same fee estimation logic that
send_all_to_addressuses which can be hack but it works today.Tests generated with claude.