Commit graph

103 commits

Author SHA1 Message Date
ThomasV
128285a050 http server: add ssl and bip70 signed requests 2019-09-05 10:57:50 +02:00
SomberNight
9d65120e59
commands: fix "close_wallet" 2019-09-04 20:16:47 +02:00
SomberNight
1bd9b3a66a
commands: fix "restore" cmd
Previously commands did not run on the asyncio thread but now they do.
"restore" was polling like "while 1: time.sleep()", blocking the event loop.

Now "restore" does not sync the wallet; which is actually cleaner
as previously this wallet would never get unloaded from the daemon (syncing forever).

This is also symmetric with the "create" cmd which also does not try to sync with the network.

However now it became difficult to write a script that restores a wallet and wants to wait
until it gets synced. Workaround for now is to poll with "list_wallets" whether it's synced.

We could create a new command that blocks until the loaded wallet gets synced.
2019-09-04 20:15:54 +02:00
ThomasV
747ab7a0a2 Integrate http_server (previously in electrum-merchant)
Use submodule to fetch HTML and CSS files
2019-09-04 12:20:05 +02:00
ThomasV
7f870f5e09 replace daemon 'start' subdommand with -d 2019-09-02 19:04:08 +02:00
SomberNight
eb5033dfc6
commands: add feerate param to payto/paytomany 2019-09-01 17:52:02 +02:00
ThomasV
e79253b5e0 Syntax change: Require --offline to run commands without a daemon.
That makes the syntax less ambiguous. It also makes it possible to
implement a CLI that does not import all the electrum modules.
2019-08-31 09:24:00 +02:00
ThomasV
8010123c08 Display and refresh the status of incoming payment requests:
- All requests have an expiration date
 - Paid requests are automatically removed from the list
 - Unpaid, unconfirmed and expired requests are displayed
 - Fix a bug in get_payment_status, conf was off by one
2019-08-22 06:00:45 +02:00
ThomasV
246cda2928 fix Flake8 tests 2019-08-20 09:03:12 +02:00
ThomasV
9cfeadea70 Turn daemon subcommands into RPCs 2019-08-20 09:03:12 +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
SomberNight
6b1810f8dc commands.py: fix type of "timeout" arg
was str by default
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
28b1569f28 (trivial) fix getbalance 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
SomberNight
4ccfa39fdd cli: fix add_peer cmd 2019-08-20 09:03:12 +02:00
ThomasV
af7d7e883c Rework wallet history methods:
- wallet.get_full_history returns onchain and lightning
 - capital gains are returned by get_detailed_history
 - display lightning history in kivy
 - command line: separate lightning and onchain history
2019-08-20 09:03:12 +02:00
ThomasV
0913194a53 qt: add clear button to receive tab, show invoice right after it is added 2019-08-20 09:03:11 +02:00
ThomasV
b8d908d63e lnworker improvements:
- enable option data_loss_protect
 - separate add_peer from open_channel
 - display exceptions raised in open_channel
2019-08-20 09:03:11 +02:00
ThomasV
dbe8b75659 move lnpay attempts logic to lnworker.pay 2019-08-20 09:03:11 +02:00
ThomasV
7be4cdaf18 redeem htlcs:
- fix bug in lnsweep: lnwatcher transactions were indexed by prev_txid
 - add test for breach remedy with unsettled htlcs
 - add timeout option to lnpay, and replace DO_NOT_SETTLE with SETTLE_DELAY
   so that we can read intermediate commitment tx in regtest
2019-08-20 09:03:11 +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
b1f8c42424 post-rebase fix 2019-08-20 09:03:11 +02:00
ThomasV
842fff832f enable lightning through command line option 2019-08-20 09:03:11 +02:00
ThomasV
e7218d798d add get_channel_ctx to CLI, for testing breaches 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
ThomasV
d383573bc3 CLI: use funding_point in channel_open and channel_close. add host:port to nodeid 2019-08-20 09:03:11 +02:00
ThomasV
f04e10f61a save channel timestamps, and show lightning payments in history tab 2019-08-20 09:03:11 +02:00
ThomasV
b7d93e2e11 gui: display lightning balance in status bar 2019-08-20 09:03:11 +02:00
ThomasV
2af178a586 Store boolean is_received in lightning invoices. Sort lightning history with timestamp. Minor fixes 2019-08-20 09:03:11 +02:00
ThomasV
281d51c002 follow-up prev commit 2019-08-20 09:03:11 +02:00
ThomasV
0e8dba897e lightning:
* store invoices for both directions
* do not store lightning_payments_inflight, lightning_payments_completed in lnworker
* payment history is returned by get_payments method of LNChannel
* command line: lightning history, lightning_invoices
* re-enable push_msat
2019-08-20 09:03:11 +02:00
ThomasV
b0d6000771 turn lightning_payments_completed into dict. Show status of lightning payments in GUI. Make 'listchannels' available offline 2019-08-20 09:03:11 +02:00
Janus
6b6097a453 ln: add closechannel cli command 2019-08-20 09:03:11 +02:00
Janus
1425628604 add command for listing invoices and their progress, fix list_channels 2019-08-20 09:03:11 +02:00
ThomasV
626d09b358 add 'recḱless' option to allow using lightning on mainnet 2019-08-20 09:03:10 +02:00
ThomasV
9a88b5605a add more fields to list_channels 2019-08-20 09:03:10 +02:00
ThomasV
6f3c2b30ed lnbase: propagate error messages received in on_error to their relevant coroutines 2019-08-20 09:03:10 +02:00
SomberNight
17457327ef make key derivation reasonable
no more hardcoded secrets, no more key-reuse
2019-08-20 09:03:10 +02:00
Janus
0405f0d9ad accept channel opening requests initiated by remote 2019-08-20 09:03:10 +02:00
Janus
646881f437 lnworker.pay(): lightning-integration support 2019-08-20 09:03:10 +02:00
Janus
efc8d50570 move connection string decoding to lnworker, fix test_lnutil 2019-08-20 09:03:10 +02:00
Janus
1988b552e1 commands: add dumpgraph command to see which nodes electrum knows about 2019-08-20 09:03:10 +02:00
Janus
cf4f0c5d3a add command to clear ln blacklist, prevent error in pay() from killing Peer 2019-08-20 09:03:10 +02:00
Janus
eca5545004 lnhtlc: don't throw away fee updates or htlcs
also add inject_fees debug command
2019-08-20 09:03:10 +02:00
Janus
77e9abc655 ln: store HTLCStateMachine in lnworker.channels 2019-08-20 09:03:10 +02:00
ThomasV
6e71340e52 do not block GUI with open_channel 2019-08-20 09:03:10 +02:00
ThomasV
34d5f1b2e3 lightning: connect send button 2019-08-20 09:03:10 +02:00
Janus
7d2a6d83d5 ln: don't make invoice if peer can't possibly pay, append _sat to sat
parameters to avoid confusion
2019-08-20 09:03:10 +02:00
ThomasV
af4f0b6daf lnworker: separate invoice creation from payment flow 2019-08-20 09:03:10 +02:00