Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
fundchannel -- make into a plugin #3003
Easier to pass it back than dig it out of the address, since we have it. Needed for extracting fundchannel
Allow a user to select the utxo set that will be added to a transaction, via the `utxos` parameter. Optional. Format for utxos should be of the form ["txid:vout","..."]
When the peer sends back an error, we return null, but sending a NULL message back to lightningd causes a parsing error on their side. negotiation_failed already calls back the peer, all we need to do here is exit.
In some cases, the funding transaction is affordable only if we leave out the change amount.
Previously, we'd fail on 'all'. `fundchannel_start` needs an amount in order to start a funding transaction. The way that we approach this is to first call `txprepare` with a placeholder address and the 'all' amount; this will return the maximum amount available. We then clamp this to the max_funding (currently hardcoded, in the future we'd want to consult our/the peer's features) and then use the amount on the output in the prepared transaction as the funding amount. We then pass this amount to fundchannel_start, after we've started it successfully we cancel the held placeholder transaction and prepare a second transaction for the exact amount, using the funding address that fundchannel_start passed back.
in order to preserve current behavior, we cap at max if specified 'all'; otherwise we fail since the amount requested is larger than the channel max capacity
After switching to a plugin, we verify that we can fund a channel before we check to contact a peer. We'll need to have a funded wallet to pass the check in this test that verifies that 'fundchannel' cannot be called for a peer after fundchannel_start is.
`txprepare` verifies that you're sending to an address on the right network, so this builds a placeholder address for the right network.
Since we pull the chainparams out to get the funding_addr placeholder, we can also get the max_funding now!
This was referenced
Sep 14, 2019
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.