Commit graph

2427 commits

Author SHA1 Message Date
SomberNight
d955285808 lnrouter/channeldb: small import clean-up 2019-08-20 09:03:12 +02:00
SomberNight
47ee02569a lnpeer: send own outgoing channel updates to remote peer 2019-08-20 09:03:12 +02:00
SomberNight
f0588846d5 channeldb: also store "message_flags" field for channel updates
this is a breaking change for the db format.
As in comment in diff,
"It would make more sense to store the raw gossip messages in the db."
2019-08-20 09:03:12 +02:00
SomberNight
d229bb4e4d lnpeer: restore "temp save orphan channel updates" functionality
needed to handle race where remote might send chan_upd too soon
(before we save the short channel id for the channel after it reaches funding locked)
2019-08-20 09:03:12 +02:00
SomberNight
ba431495db lnworker: fix silent TypeError in _calc_routing_hints_for_invoice 2019-08-20 09:03:12 +02:00
SomberNight
02681c6664 tests: some regtest tests need to mine more blocks to expire CLTVs
as lnutil.MIN_FINAL_CLTV_EXPIRY_FOR_INVOICE was recently bumped
2019-08-20 09:03:12 +02:00
SomberNight
a9295e495c tests: regtest.sh now uses consistent indentation 2019-08-20 09:03:12 +02:00
SomberNight
6b1810f8dc commands.py: fix type of "timeout" arg
was str by default
2019-08-20 09:03:12 +02:00
SomberNight
159fe04daf lnpeer: on_channel_open should not fail on server error 2019-08-20 09:03:12 +02:00
ThomasV
e5286f7598 minor fix: always initialize Commands.lnworker 2019-08-20 09:03:12 +02:00
ThomasV
5e0427392f Daemon: Replace get_server with request.
This function performs a single RPC, and may raise a DaemonNotRunning exception.
2019-08-20 09:03:12 +02:00
ThomasV
28b1569f28 (trivial) fix getbalance 2019-08-20 09:03:12 +02:00
ThomasV
b81feb6550 daemon: simplify get_fd_or_server 2019-08-20 09:03:12 +02:00
SomberNight
a9239bd40f lnpeer: shutdown should wait until no HTLCs remain
in either ctx
2019-08-20 09:03:12 +02:00
SomberNight
2e38bcf416 lnpeer: failed htlc error handling ignored length of channel_update 2019-08-20 09:03:12 +02:00
SomberNight
d2d4d19fcb lnpeer: add a few sanity checks to payment-forwarding (and related) 2019-08-20 09:03:12 +02:00
SomberNight
0973b86925 lnworker: rework "is_dangerous"
"Should channel be closed due to expiring htlcs?"
2019-08-20 09:03:12 +02:00
SomberNight
ce54b5411e lnhtlc: htlcs_by_direction now returns dict keyed by htlc_id 2019-08-20 09:03:12 +02:00
ThomasV
b2f61bdc06 use aiohttp + jsonrpcserver in watchtower 2019-08-20 09:03:12 +02:00
ThomasV
de29fe6930 remove unused import 2019-08-20 09:03:12 +02:00
SomberNight
8ad25b3a52 lnpeer: make sure forwarding is disabled by default 2019-08-20 09:03:12 +02:00
SomberNight
a27b03be6d lnhtlc: local update raw messages must not be deleted before acked
In recv_rev() previously all unacked_local_updates were deleted
as it was assumed that all of them have been acked at that point by
the revoke_and_ack itself. However this is not necessarily the case:
see new test case.

renamed log['unacked_local_updates'] to log['unacked_local_updates2']
to avoid breaking existing wallet files
2019-08-20 09:03:12 +02:00
SomberNight
4fc9f243f7 lnpeer: reestablish_channel - always replay unacked local updates
Even if we haven't signed them yet (did not send commitment_signed).
Alternatively, if they are not yet signed, we could discard them here,
like we do already for remote updates above (chan.hm.discard_unsigned_remote_updates).
One of these two options must be done, and before this commit we were not doing either.
2019-08-20 09:03:12 +02:00
ThomasV
98a1c9268a qt: do not show paid requests 2019-08-20 09:03:12 +02:00
ThomasV
bd5c83e906 fix race condition with channel_timestamps 2019-08-20 09:03:12 +02:00
ThomasV
b493219829 require data loss protect 2019-08-20 09:03:12 +02:00
ThomasV
9f8e2c689e test funding_txn_minimum_depth, show it in GUI 2019-08-20 09:03:12 +02:00
ThomasV
bbec1dceda lnpeer: fix and simplify tests in maybe_send_commitment 2019-08-20 09:03:12 +02:00
ThomasV
39bae1c7cf channel_db: load_data should load node_info 2019-08-20 09:03:12 +02:00
ThomasV
46c2d7821f kivy: show pending requests in receive tab instead of dialog 2019-08-20 09:03:12 +02:00
ThomasV
f8038d024b kivy: lnpay_thread 2019-08-20 09:03:12 +02:00
ThomasV
9e78fdbf71 qt gui: simplify signals 2019-08-20 09:03:12 +02:00
ThomasV
e584a7451c simplify tx history: do not use separate columns for lightning 2019-08-20 09:03:12 +02:00
SomberNight
80c52d4808 simple_config.estimate_fee: make sure method never fails
code in lnsweep was already assuming this
2019-08-20 09:03:12 +02:00
SomberNight
7f1b456b93 lnhtlc.discard_unsigned_remote_updates: fix edge case 2019-08-20 09:03:12 +02:00
SomberNight
bb63bd98fb lnpeer: should not mark channel as OPEN if reestablish did not complete 2019-08-20 09:03:12 +02:00
SomberNight
940fc86749 lnpeer: reestablish_channel - fix data_loss_protect edge case 2019-08-20 09:03:12 +02:00
SomberNight
107f271e58 move all ctn book-keeping to lnhtlc (from lnchannel) 2019-08-20 09:03:12 +02:00
SomberNight
44761972cb lnchannel: ctx output-ordering: identical htlcs are ordered by CLTV 2019-08-20 09:03:12 +02:00
SomberNight
b1f606eaed lnchannel: start using "latest" and "next" instead of "current" and "pending"
"current" used to be "oldest_unrevoked"; and pending was "oldest_unrevoked + 1"
but this was very confusing...
so now we have "oldest_unrevoked", "latest", and "next"
where "next" is "latest + 1"
"oldest_unrevoked" and "latest" are either the same or are offset by 1
(but caller should know which one they need)

rm "got_sig_for_next" - it was a redundant sanity check, that really
just complicated things

rm "local_commitment", "remote_commitment", "set_local_commitment",
"set_remote_commitment" - just use "get_latest_commitment" instead
2019-08-20 09:03:12 +02:00
SomberNight
e32807d29d lnworker: only reestablish channels after on-chain state is synchronized 2019-08-20 09:03:12 +02:00
SomberNight
944e4f0ba0 implement data_loss_protect
so that we can spend their_ctx_to_remote even when we lost our state
but have an old backup
2019-08-20 09:03:12 +02:00
SomberNight
fdf8d8609b lnpeer: make feature-bit testing easier
so that we can always test like: self.localfeatures & FEATURE_BIT_OPT
2019-08-20 09:03:12 +02:00
SomberNight
014b921393 lnpeer: reestablish_channel - replay un-acked local updates
Replay un-acked local updates (including commitment_signed) byte-for-byte.
If we have sent them a commitment signature that they "lost" (due to disconnect),
we need to make sure we replay the same local updates, as otherwise they could
end up with two (or more) signed valid commitment transactions at the same ctn.
Multiple valid ctxs at the same ctn is a major headache for pre-signing spending txns,
e.g. for watchtowers, hence we must ensure these ctxs coincide.
2019-08-20 09:03:12 +02:00
SomberNight
e81ae1921b lnpeer: reestablish_channel - discard unsigned remote updates 2019-08-20 09:03:12 +02:00
SomberNight
c046f2cc1c lnhtlc: move 'next_htlc_id' from ChannelConfig to lnhtlc log 2019-08-20 09:03:12 +02:00
SomberNight
c8b19aec2a lnpeer: make reestablish_channel saner
clear up expectations about ctns
2019-08-20 09:03:12 +02:00
SomberNight
a3fd6b3ce8 lnhtlc: rename ctx_pending to revack_pending, and persist it 2019-08-20 09:03:12 +02:00
SomberNight
cd4268c521 lnworker: small clean-up of short_channel_id format 2019-08-20 09:03:12 +02:00
SomberNight
bdbc662a36 lnpeer: channel_reestablished is now a queue (instead of future) 2019-08-20 09:03:12 +02:00