Commit Graph

10 Commits

Author SHA1 Message Date
trueptolemy 2d1a153975 plugins: Return `command_param_failed()` if `param()` fail 2019-09-19 01:07:11 +00:00
trueptolemy bdbfbf7e55 fundchannel: Remove the link of `lightningd/json.h` 2019-09-17 21:05:51 +02:00
lisa neigut a35677fa0f fundchannel: use plugin; delete interior impl
Switch over to using the fundchannel plugin.
2019-09-11 23:56:27 +00:00
lisa neigut 548672ea0a fundchannel: populate max_funding from chainparams
Since we pull the chainparams out to get the funding_addr placeholder,
we can also get the max_funding now!
2019-09-11 23:56:27 +00:00
lisa neigut 42ef64941a fundchannel: have address work with any network
`txprepare` verifies that you're sending to an address on the
right network, so this builds a placeholder address for the
right network.
2019-09-11 23:56:27 +00:00
lisa neigut 7d069239aa fundchannel: only cap to 'max' if keyword 'all' passed in
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
2019-09-11 23:56:27 +00:00
lisa neigut d9843c1957 fundchannel: handle 'all' for satoshi 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.
2019-09-11 23:56:27 +00:00
lisa neigut f155c61bdf fundchannel: cancel the fundchannel request if error
If txprepare hits an error, we need to cancel the pending request
with our peer.
2019-09-11 23:56:27 +00:00
lisa neigut 03a30c0981 fundchannel: wire in utxos
Allows a user to specify the utxo's they like to allow for a command.
2019-09-11 23:56:27 +00:00
lisa neigut f433f637ea plugins: add fundchannel plugin, as 'fc'
New plugin which mimics the functionality of the embedded 'fundchannel'.
2019-09-11 23:56:27 +00:00