niftynei
e0a2d47903
df-rbf: reconnection tests (init_rbf + ack_rbf)
2021-03-06 15:03:56 +10:30
niftynei
73ac0fb6ce
df-tests: happy path rbf test
...
I can has RBF?
2021-03-06 15:03:56 +10:30
niftynei
07153bff6a
df: cleanup error handling on lightningd side
...
Make existing methods understand how unsaved channels work, re-work
errors so that we handle everything appropriately
2021-03-06 15:03:56 +10:30
niftynei
ad0f92aef1
df-rbf: update rejection criteria for tx_sigs
...
since we might be in the middle of an RBF, update our checks to be more
robust
2021-03-06 15:03:56 +10:30
niftynei
dfdf9259d7
listpeers: include feerate info for RBF-candidate channels
...
Changelog-Added: JSON-RPC: `listpeers` now includes 'last_feerate', 'next_feerate', 'initial_feerate' and 'next_fee_step' for channels in state DUALOPEND_AWAITING_LOCKIN
fixup! listpeers: include feerate info for RBF-candidate channels
2021-03-06 15:03:56 +10:30
niftynei
6c76dd338e
channel: move inflight + feerate methods to channel.c
...
Need these more accessible for next patch, which moves the next_feerate
info into listpeers
2021-03-06 15:03:56 +10:30
niftynei
a23277af57
listpeers: include info on channels that are in-process
...
Channels that we're in negotiation for, but don't have a commitment
transaction saved for yet.
2021-03-06 15:03:56 +10:30
niftynei
c519c84ef8
df: handle funding_locked + tx_signatures messages out of order
...
If we're doing an RBF, it's possible that the peer will send us a
funding_locked, shutdown, or tx_signatures message. (We get tx_sigs out
of order on a reconnect)
This lets us gracefully handle a shutdown or funding_locked
sent at any time (after first funding tx) as well.
2021-03-06 15:03:56 +10:30
niftynei
6825a6715e
df: move methods around so we can call them elsewhere
...
Will reuse these elsewhere soon
2021-03-06 15:03:56 +10:30
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
Rusty Russell
4deb9311ce
Makefile: fix parallel build error on clean tree.
...
Caused by missing common/iso4217.c from common/Makefile:
```
In file included from ./common/iso4217.h:4,
from common/iso4217.c:3:
./wire/wire.h:7:10: fatal error: secp256k1_recovery.h: No such file or directory
7 | #include <secp256k1_recovery.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:265: common/iso4217.o] Error 1
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-03 16:36:22 -06:00
Rusty Russell
7c2ecd8241
wire/Makefile: make sure we regen exp files if patches change.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-03-03 16:36:22 -06:00
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
fe688ab718
df: revert channel state in dualopend
...
Now that RBF's are possible, we revert the channel's state
after a failure to the previous channel info.
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
b30489310b
df-rbf: break out opener commitment codepath, use for rbf
2021-03-03 12:28:22 +10:30
niftynei
63b060066b
df-rbf: opener setup for "interactive" protocol portion
...
If we're the opener, there's a bit of extra setup we need to do before
calling "run_tx_interactive", namely adding the funding_output to the
PSBT
2021-03-03 12:28:22 +10:30
niftynei
e67d5d7559
df: move out logic for adding funding output to PSBT
2021-03-03 12:28:22 +10:30