niftynei
1acc1aa27e
rbf: clean up channel on error
...
Make sure we clean up unsaved channels appropriately on failure.
We forget the peer/channel if it's unsaved!
2021-03-06 15:03:56 +10:30
niftynei
ff069ff924
rbf: consolidate failure paths, use "warnings"
...
We move over to the new "warning" paradigm, instead of using
an "rbf_fail" message.
Every failure is either a warning or an error; on warnings we
hang up and reconnect later, effectively resetting the state.
2021-03-06 15:03:56 +10:30
niftynei
4fb95a9350
df-rbf: separate first-time channel save from update (RBF)
...
We can't "first save" a channel twice; instead we split in two and just
update the underlying channel on subsequent passes (RBFs)
2021-03-06 15:03:56 +10:30
niftynei
f22fed3fd5
df-rbf: only permit the channel initiator to init RBF
...
We're *mostly* set up for both sides doing RBF, except that it reverses
the callback flow (using the plugin vs RPC calls) and we're not
currently smart enough to flip between them gracefully
2021-03-06 15:03:56 +10:30
niftynei
a0cb7bd9b4
df: update reserve calculation
...
We can use the funding amount to derive the reserve requirement.
2021-03-06 15:03:56 +10:30
niftynei
2719ff8c3b
df-rbf: handle rbf failures in lightningd
2021-03-06 15:03:56 +10:30
niftynei
d47358848f
df-rbf: init an rbf for real, using openchannel_bumpfee
...
Reorg a bit of the RBF code so we use the same codepaths for we-init vs
they-init starts.
2021-03-06 15:03:56 +10:30
Rusty Russell
4dcd4ca155
listpeers: add latest feerate and actual last fee amount.
...
Users have no idea what they would pay for unilateral closes.
At least this gives them a clue!
Reported-by: @az0re on IRC.
Changelog-Added: JSON-RPC: `listpeers` now shows latest feerate and unilaral close fee.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-05 13:12:41 +10:30
niftynei
063948d51a
df-feerates: send back original + last known feerates
...
For calculating the next RBF attempt's feerate, we need some historical
information about the feerate used for this channel
2021-03-03 16:19:04 -06:00
niftynei
cf170c3909
df: allow for RBF_INIT in sigs states
2021-03-03 16:19:04 -06:00
niftynei
02d99acca1
dualopen: check that peer is connected for json calls
...
Before we start trying to talk to the peer, check that they're
connected.
2021-03-03 16:19:04 -06:00
niftynei
d8221aae76
df: update channel_id when opening; closing; disconnecting
...
We were missing the channel_id for accepter opens; it's also a good idea
to reset it to 0xFF when we disconnect totally
2021-03-03 16:19:04 -06:00
niftynei
474233f1b7
memleak,df: patchup memleak code for v2 channels
...
Takes 'unsaved' channels into account for memleak cleanups, instead of
solely relying on `uncommitted_channels`
2021-03-03 16:19:04 -06:00
niftynei
6407ad334f
df, channel: if a channel reconnects, but it's "unsaved" still
...
Go ahead and start dualopend, but as a fresh instance.
2021-03-03 16:19:04 -06:00
niftynei
779067d74c
df: check inflights when deciding whether or not to allow command
...
We were missing the inflight state checks before allowing to proceed
with a command.
2021-03-03 16:19:04 -06:00
niftynei
da81d4bced
channel: skip unsaved channels
...
Now that "peer->channels" contains `unsaved` channels, skip overthem
where appropriate
2021-03-03 16:19:04 -06:00
niftynei
b9f867b1dd
connectd: check for re-connected unsaved channels
2021-03-03 16:19:04 -06:00
niftynei
4c9a4250bf
subd: remove "swap" methods
...
only needed for moving the subd->channel from an uncommitted_channel to
a channel; we removed uncommitted_channel from dual_open so it's no
longer necessary
2021-03-03 16:19:04 -06:00
niftynei
de3599e98a
subd: remove ctype (channel_type)
...
We only needed the type check for dual_open, since it was the only
subdaemon path that used two 'types' in the subd->channel field.
2021-03-03 16:19:04 -06:00
niftynei
1e9a900918
df: start of RPC for bumping the fee!
...
Doesn't call into dualopend yet
2021-03-03 16:19:04 -06:00
niftynei
d49db8ad41
df: do the right thing, now that we have a cancellation routine
...
removes a fixme
2021-03-03 16:19:04 -06:00
niftynei
3da2ae4d30
df: move to inflights for sigs/openchannel_signed parts of flow
...
We create an inflight once we get the commitment tx for a channel
instead of once we get the funding transaction signatures
2021-03-03 16:19:04 -06:00
niftynei
8b0e88dfb3
df: move initialization over to unsaved channel
...
uncommitted_channel -> channel (but unsaved)
2021-03-03 16:19:04 -06:00
niftynei
0951e2c941
df: get rid of unnecessary struct commit_rcvd
2021-03-03 16:19:04 -06:00
niftynei
95e81ce82c
df: helper to find the last (most recent) inflight for a channel
2021-03-03 16:19:04 -06:00
niftynei
628f9df320
df: consolidate callbacks for opener/accepter, move to open_attempt
2021-03-03 16:19:04 -06:00
niftynei
bfb862564e
df: method for disconnecting an *unsaved* channel
...
Since we're moving over to "unsaved channels" instead of
"uncommitted_channel" struct, we need a new utility to disconnect this
channe
2021-03-03 16:19:04 -06:00
niftynei
538fd670ce
df: add helper for creating an "unsaved" channel
...
Channel that's not saved to database yet
2021-03-03 16:19:04 -06:00
niftynei
1786fcbbdc
df: migrate from "uncommitted_channel" to "open_attempt"
...
We're going to move over to "unsaved channels" instead of using a
separate "uncommitted_channel" struct. This means a peer might have a
channel that's not saved to the database yet in its channel list
2021-03-03 16:19:04 -06:00
niftynei
6474779e38
df-rbf: hook for rbf_init attempt, called "rbf_channel"
...
When we get an RBF request, we ask the/a plugin what they'd like to do
about it. This pipes the request through to the plugin
2021-03-03 16:19:04 -06:00
niftynei
50b8655cbe
channel: remove 'uncommitted_channel' from channel lookup
...
We're going to be removing "uncommitted_channel" from v2 open stat
2021-03-03 12:28:22 +10:30
niftynei
4baa10ef68
channel: remove psbt
and remote_tx_sigs
...
We just added this, but we've migrated them to the "inflight" struct
instead, as they actually pertain to an single inflight open attempt
2021-03-03 12:28:22 +10:30
niftynei
e15de71375
channel: only delete saved channels from database
...
There will be 'unsaved' channels now, with a dbid of 0
2021-03-03 12:28:22 +10:30
niftynei
99123ddbe4
dual-funding, rbf: reject RBFs that will fail the total-fee rule
...
RBFs must have a total fee greater than the last successful RBF attempt
2021-03-03 12:28:22 +10:30
lisa neigut
0d8351155e
df-rbf: validate that the candidate funding transaction is valid
...
We need to make sure that there's at least one input that's represented
in every single RBF-attempt for this channel, to prevent "parallel"
subsequent RBFs from succeeding/opening (the multi-channel backdoor?!)
2021-03-03 12:28:22 +10:30
niftynei
22078262f0
df-reinit: pass back channel_flags
...
We should also restore the channel_flags field on reinit; we use them if
we do an RBF after a reconnection
2021-03-03 12:28:22 +10:30
niftynei
a489f92ee8
df-rbf: start of handling an incoming RBF attempt from peer
...
A peer init's an RBF, we start handling it
2021-03-03 12:28:22 +10:30
niftynei
067f1f2eb7
df-rbf: add method to fail an RBF
...
this is a bit different than straight up failing a channel. we want to
signal that the RBF attempt failed, only
2021-03-03 12:28:22 +10:30
niftynei
e18af6aaa3
rbf: check all inflights for matching transaction data
...
Even though, technically, we only need to check for v1 open data, go
ahead and extend this check to encompass the inflights
2021-03-03 12:28:22 +10:30
niftynei
b8b910e4c4
df-rbf: update channel data on depth reached
...
When the funding tx reaches depth, update the channel's data to the
"correct" funding transaction info from inflights (if necessary).
This will be necessary if:
- the transaction has been successfully RBF'd and
- the lesser fee transaction is the one successfully mined, OR
- the channel is in the process of being RBF'd
2021-03-03 12:28:22 +10:30
niftynei
36f3b13279
inflight: add a 'channel-inflight' concept, in-progress channel stuffs
...
"inflights" are all potential channel funding transactions that we
currently have commitment transactions for.
2021-03-03 12:28:22 +10:30
niftynei
1e4ff724a5
nit: make comments 80 chars
2021-03-03 12:28:22 +10:30
Karol Hosiawa
8a8f81175d
Added in_channel,out_channel,state params to listforwards
2021-03-03 09:19:20 +10:30
Michael Schmoock
afaaeb3c7d
plugins: make rpc_command hook chainable
...
Changelog-Changed: The `rpc_command` hook is now chainable.
2021-03-03 09:18:53 +10:30
Rusty Russell
d0946b75bc
common: support opt_shutdown_anysegwit checks (EXPERIMENTAL_FEATURES).
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-02 14:42:34 +10:30
Rusty Russell
66dda32da2
common/shutdown_scriptpubkey: extract shutdown scriptpubkey test.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-02 14:42:34 +10:30
Christian Decker
ebb1b19c65
plugin: Fix the custommsg hook not to include the internal prefix
...
We were always prefixing the `message` field with the internal type
prefix 0x0407, followed by the length prefix. Neither is needed since
the type being constant is of no interest to the plugin and the length
being implicit due to the JSON-encoding.
Reported-by: Ilya Evdokimov
Changelog-Fixed: plugin: The `custommsg` hook no longer includes the internal type prefix and length prefix in its `payload`
Changelog-Deprecated: plugin: The `message` field on the `custommsg` hook is deprecated in favor of the `payload` field, which skips the internal prefix.
2021-03-02 14:41:16 +10:30
Rusty Russell
959d1c9983
chaintopology: fix notification first time fee estimate works.
...
We probably want to notify everyone immediately, rather than
waiting for the first change.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-02 13:34:55 +10:30
Rusty Russell
171af7742a
plugin: log self-disable at debug level, other manifest fails at unusual.
...
This avoids spamming the logs. We also remove the duplicate debug
logs on self-disable (plugin_kill logs it for us).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-01 12:16:42 +01:00
Rusty Russell
a9aad0da98
plugin: add log-level to plugin_kill, make it take format string.
...
We currently log every kill at INFO level, even if it's during shutdown.
Change those to debug, but lift those where we got a malformed response.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-01 12:16:42 +01:00