Commit graph

29 commits

Author SHA1 Message Date
ThomasV
69ef9aa3d7 channel_reestablish: assume that DLP is enabled, because we require it 2020-02-11 21:39:23 +01:00
ThomasV
ece75c3244 test_lnpeer: simple test of channel_reestablish 2020-02-11 19:53:21 +01:00
ThomasV
e1ce3aace7 Separate db from storage
- storage is content-agnostic
 - db and storage are passed to wallet contructor
2020-02-10 17:45:23 +01:00
SomberNight
308517d473
python 3.8: adapt to breaking changes re asyncio.CancelledError
(and TimeoutError)

closes #5798
2019-12-11 23:07:47 +01:00
Janus Troelsen
3ac8f461a9 Tests: Remove on_channels_updated (#5819) 2019-12-04 19:40:52 +00:00
ThomasV
61dfcba092 Refactor channel states:
- persisted states are saved
 - state transitions are checked
 - transient states are stored in channel.peer_state
 - new channel states: 'PREOPENING', 'FUNDED' and 'REDEEMED'
 - upgrade storage to version 21
2019-11-22 20:14:54 +01:00
ThomasV
9ff1bd4110 fix test following aac0fe9ae6 2019-10-22 18:54:00 +02:00
ThomasV
dd0be1541e Improve handling of lightning payment status:
- Move 'handle_error_code_from_failed_htlc' to channel_db,
and call it from pay_to_route, because it should not be
called when HTLCs are forwarded.
- Replace 'payment_received' and 'payment_status'
callbacks with 'invoice_status' and 'request_status'.
- Show payment error logs in the Qt GUI
- In the invoices list, show paid invoices for which
we still have the log.
2019-10-11 17:51:33 +02:00
ThomasV
c4ab1e6fad Encapsulate lightning payment events:
- make LNWorker.pending_payments private
 - public methods: payment_sent, payment_received, await_payment
2019-10-11 10:18:28 +02:00
ThomasV
638de63f13 lnworker: rename 'invoices' to 'payments' when they can be in both directions 2019-10-09 20:16:11 +02:00
ThomasV
bcb10e6e53 remove redundant test from lnworker._pay, rename pay_to_route parameter to lnaddr 2019-10-04 18:06:53 +02:00
SomberNight
04edad9984
config: no longer singleton. it is passed to Wallet.__init__
The few other cases that used SimpleConfig.get_instance() now
either get passed a config instance, or they try to get a reference
to something else that has a reference to a config.
(see lnsweep, qt/qrcodewidget, qt/qrtextedit)
2019-09-22 20:46:01 +02:00
ThomasV
f08e5541ae Refactor invoices in lnworker.
- use InvoiceInfo (NamedTuple) for normal operations,
   because lndecode operations can be very slow.
 - all invoices/requests are stored in wallet
 - invoice expiration detection is performed in wallet
 - CLI commands: list_invoices, add_request, add_lightning_request
 - revert 0062c6d695 because it forbids self-payments
2019-09-22 16:06:53 +02:00
ThomasV
54257cbcca Rewrite JsonRPC requests using asyncio.
- commands are async
 - the asyncio loop is started and stopped from the main script
 - the daemon's main loop runs in the main thread
 - use jsonrpcserver and jsonrpcclient instead of jsonrpclib
2019-08-20 09:03:12 +02:00
ThomasV
f2d58d0e3f optimize channel_db:
- use python objects mirrored by sql database
 - write sql to file asynchronously
 - the sql decorator is awaited in sweepstore, not in channel_db
2019-08-20 09:03:12 +02:00
ThomasV
6d9ef29690 redo LNWorker pay:
- wait until htlc has been fulfilled
 - raise if htlc is not fulfilled
 - return boolean success
 - try multiple paths in GUI
2019-08-20 09:03:11 +02:00
ThomasV
3c0df28c98 do not include 'force_closing' in channel states, because it is not part of the peer protocol 2019-08-20 09:03:11 +02:00
ThomasV
95376226e8 save lightning invoice descriptions as labels and allow user to edit them 2019-08-20 09:03:11 +02:00
SomberNight
e4ed15f683 fix tests 2019-08-20 09:03:11 +02:00
ThomasV
730be17aba Use separate lightning nodes for gossip and channel operations. 2019-08-20 09:03:11 +02:00
ThomasV
12743bda93 remove test_require_data_loss_protect 2019-08-20 09:03:11 +02:00
ThomasV
aa398993cf lnrouter fixes:
- use gossip_queries_req instead of initial_routing_sync
 - add connected nodes to recent peers only after successful init
 - derive timestamp used with gossip_timestamp_filter from channel_db
 - fix query_short_channel_ids:
     1. channel IDs must be sorted with zlib
     2. limit request to 100
     3. do not abuse this to request node_announcements; it is fine not to have all nodes.
 - fix get_recent_peers:
     1. do not set last_connected_date to 'now' if we never connected a node
     2. sql query was misconstructed and was returning only one peer
 - populate FALLBACK_NODE_LIST_MAINNET with nodes that have the requested flags
2019-08-20 09:03:11 +02:00
ThomasV
4dc6c6c82e fix tests (follow up prev commit) 2019-08-20 09:03:11 +02:00
ThomasV
bfdf0a7e88 start asyncio loop in test_lnrouter and test_lnpeer 2019-08-20 09:03:11 +02:00
Janus
95a2174789 sqlite in lnrouter: lnpeer: introduce _gossip_loop for gossip handling separated from message handling 2019-08-20 09:03:11 +02:00
Janus
dd7c4b3bab sqlite in lnrouter 2019-08-20 09:03:11 +02:00
ThomasV
62be0c481c lightning: Save invoices and preimages separately. Save preimages when forwarding 2019-08-20 09:03:11 +02:00
ThomasV
50b4f785a9 test_lnpeer: add names 2019-08-20 09:03:11 +02:00
ThomasV
3dce65dc73 Rename lnchan, lnchannel_verifier, lnbase
Auto-completions are a pain if files share a long prefix
2019-08-20 09:03:11 +02:00
Renamed from electrum/tests/test_lnbase.py (Browse further)