LBRY-Vault/electrum
SomberNight 9baaf1afda
commands: make 'wallet'-mangling in decorator less obscure, and fixes
- some commands expect a 'wallet_path' arg, while others expect 'wallet'
- 'wallet_path' in the end is supposed to be a str,
  'wallet' in the end is supposed to be an Optional[Abstract_Wallet]
- initially, in the decorator, 'wallet' can be a str, in which case
  the decorator replaces it with an Abstract_Wallet (from the daemon)
- Previously the decorator sometimes converted 'wallet_path' to 'wallet'.
  This was because when called from the CLI it was always given 'wallet_path' (and never 'wallet),
  while when called from JSON-RPC it was given either 'wallet' or 'wallet_path' (depending on command).
  Now, the CLI also behaves as JSON-RPC, and hence 'wallet_path' and 'wallet' are fully separate.
- A bug is fixed where, when a command that only optionally takes a 'wallet' (such as gettransaction),
  was called from the JSON-RPC with the arg present, it raised; and when called from CLI with the arg present
  the arg was not actually passed to the command.
- A bug is fixed where if one command calls another command (that both take a 'wallet'),
  it would raise (due to assuming 'wallet' is str and needs to be converted to Abstract_Wallet).
  This fixes #6154.

-----

$ ./run_electrum --testnet daemon -d
$ ./run_electrum --testnet load_wallet -w ~/.electrum/testnet/wallets/default_wallet

$ curl --data-binary '{"id":"curltext","jsonrpc":"2.0","method":"gettransaction","params":{"txid":"9f43ff71ea2594873e4e7d15e61254a3661ff2df1af76325c854d9aa199550ce"}}' http://user:pass@127.0.0.1:7777
{"jsonrpc": "2.0", "result": "0200000001caaac6b5eb916e3067d0224f942fb331ce1dcfb4031cfb479e7941dcf95e409801000000fdfe0000483045022100e2a508bb78c2172eb03f081a342454ba1d24669e959700973b1a742a4fedd0c302203174e06feda265031cf9aa0364d4a4eafb71b0c0a62e76be7795cfbb307b677a01483045022100d0e14564838fac754395158741d64c73da2b86e7900dfdc6a63c7492b232ba130220778e7e7c21d94ebcd340057302aeff7e9a797a3aa3e0ac4884e9ff27339ea6e9014c69522102091f0b4d8ab30016a5d1c088249e02883fad8160f06fa53588ad8598650a3e6221035f2f8263bb3608d6cc4ee03bd4cb8d65c4d70af71049f05fbfee4978832a1fd22103fe42dab58718ea0413f7c8de693cdeee22ce19b1dc34c0bbdd7a48245465c5a253aefdffffff01cb9f0700000000001976a914c13fd6294d1be7b9410a5538f4b4ef10fc594ee788ac802c1800", "id": "curltext"}

$ curl --data-binary '{"id":"curltext","jsonrpc":"2.0","method":"gettransaction","params":{"txid":"9f43ff71ea2594873e4e7d15e61254a3661ff2df1af76325c854d9aa199550ce", "wallet":"~/.electrum/testnet/wallets/default_wallet"}}' http://user:pass@127.0.0.1:7777
{"jsonrpc": "2.0", "error": {"code": -32000, "message": "'str' object has no attribute 'db'"}, "id": "curltext"}
2020-05-14 16:33:02 +02:00
..
gui kivy: fix "choose from peers" in network server-select popup 2020-05-13 19:05:07 +02:00
lnwire lnmsg: rewrite LN msg encoding/decoding 2020-04-01 21:39:48 +02:00
plugins coldcard: log exception traceback in create_client 2020-05-13 18:11:53 +02:00
scripts network: allow mixed protocols among interfaces 2020-04-16 21:19:42 +02:00
tests daemon.py: Add authentication to Watchtower. 2020-05-12 10:12:30 +02:00
wordlist
www@7d902a422a fix websocket messages 2019-09-05 11:45:28 +02:00
__init__.py windows: dll-load 'hack' needs to be applied not only from main script 2020-02-11 20:57:37 +01:00
address_synchronizer.py multi-wallet: properly stop lnworker/lnwatcher 2020-05-01 04:50:08 +02:00
base_crash_reporter.py qt exception window: turn Exception_Hook into singleton 2020-05-01 06:33:38 +02:00
base_wizard.py One can now click the back button in the show_xpub_and_add_cosigners wizard step 2020-05-07 10:19:48 +02:00
bip32.py follow-up prev: do all checks, and add tests 2020-02-27 05:13:31 +01:00
bitcoin.py bitcoin.py: change API of address_to_hash 2020-04-12 15:34:19 +02:00
blockchain.py ln: check if chain tip is stale when receiving HTLC 2020-04-13 17:04:27 +02:00
channel_db.py discard channel updates too far in the future, or too close apart (see #6124) 2020-05-10 12:16:16 +02:00
checkpoints.json update block header checkpoints 2020-03-05 17:19:48 +01:00
checkpoints_testnet.json update block header checkpoints 2020-03-05 17:19:48 +01:00
coinchooser.py test_lnpeer: some clean-up, make it easier to add "num_node>2" tests 2020-05-06 11:06:33 +02:00
commands.py commands: make 'wallet'-mangling in decorator less obscure, and fixes 2020-05-14 16:33:02 +02:00
constants.py lnworker: re-enable dns seeds for peer-finding bootstrap 2020-03-03 20:12:12 +01:00
contacts.py Separate db from storage 2020-02-10 17:45:23 +01:00
crypto.py Fix "backed" typo in crypto.py 2020-05-03 03:08:28 +00:00
currencies.json
daemon.py commands: make 'wallet'-mangling in decorator less obscure, and fixes 2020-05-14 16:33:02 +02:00
dns_hacks.py network dns hacks: split from network.py into its own file 2020-01-22 18:32:57 +00:00
dnssec.py ecc: abstract away some usage of python-ecdsa: bytes<->int conversions 2020-02-11 16:41:49 +01:00
ecc.py ecc.ECPubkey: also accept bytearray in __init__ 2020-02-19 00:40:33 +01:00
ecc_fast.py libsecp: log exception if failed to load 2020-02-21 15:59:18 +01:00
electrum
exchange_rate.py network: replace "server" strings with ServerAddr objects 2020-04-15 17:23:47 +02:00
i18n.py translations: add note that f-strings cannot be translated 2020-04-11 16:33:45 +02:00
interface.py interface: make localhost exempt from ip-range bucketing 2020-04-25 06:38:26 +02:00
json_db.py follow-up prev: try to handle json db int key madness :/ 2020-03-17 20:32:27 +01:00
keystore.py hww: distinguish devices based on "soft device id" (not just labels) 2020-04-08 14:44:42 +02:00
lnaddr.py fix #6056 2020-04-11 12:02:38 +02:00
lnchannel.py fix #6125: detect self-payments 2020-05-06 12:58:55 +02:00
lnhtlc.py fix htlc forwarding: 2020-05-05 09:23:48 +02:00
lnmsg.py lnmsg: small speed-up: read first, check length after 2020-04-01 21:49:23 +02:00
lnonion.py fix htlc forwarding: 2020-05-05 09:23:48 +02:00
lnpeer.py test_lnpeer: add some multi-hop payment unit tests 2020-05-06 11:06:44 +02:00
lnrouter.py lnrouter: blacklist channels for a limited time (see #6124) 2020-05-10 12:37:27 +02:00
lnsweep.py remove UnknownPaymentHash (exception used as value) 2020-05-02 22:37:28 +02:00
lntransport.py lntransport: use network proxy if available 2020-04-15 21:44:09 +02:00
lnutil.py fix htlc forwarding: 2020-05-05 09:23:48 +02:00
lnverifier.py rename all TaskGroup() fields to "taskgroup" 2020-02-27 19:13:56 +01:00
lnwatcher.py small clean-up re "extract preimage from on-chain htlc_tx" 2020-05-06 03:15:20 +02:00
lnworker.py ln invoices: more relaxed filtering of chans to include route hints for 2020-05-11 16:01:33 +02:00
logging.py
mnemonic.py mnemonic: implement Wordlist class 2020-02-29 00:20:11 +01:00
network.py network: validate server peers sent by main server 2020-05-13 19:28:35 +02:00
old_mnemonic.py mnemonic: implement Wordlist class 2020-02-29 00:20:11 +01:00
paymentrequest.proto
paymentrequest.py README: rm "Compile the protobuf description file" section 2020-02-21 18:50:52 +01:00
paymentrequest_pb2.py
pem.py
plot.py
plugin.py hww hidapi usage: try to mitigate some thread-safety issues 2020-04-17 19:53:39 +02:00
qrscanner.py
ripemd.py
rsakey.py
segwit_addr.py integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
servers.json Remove phishing server 2019-12-26 23:47:32 +07:00
servers_regtest.json
servers_testnet.json
simple_config.py Simplify services (watchtower, payserver): 2020-05-10 14:52:50 +02:00
sql_db.py show watchtower db size in GUI 2020-05-13 15:13:09 +02:00
storage.py wizard.create_storage: state API and abide by it 2020-04-09 19:45:38 +02:00
synchronizer.py commands: "notify" cmd: stop watching addr if called with empty URL 2020-04-24 15:34:55 +02:00
transaction.py small clean-up re "extract preimage from on-chain htlc_tx" 2020-05-06 03:15:20 +02:00
util.py fixups for CallbackManager refactor 2020-04-24 15:32:05 +02:00
verifier.py rename all TaskGroup() fields to "taskgroup" 2020-02-27 19:13:56 +01:00
version.py bump version number to 4.0.0a0 (alpha version) 2019-10-11 18:13:48 +02:00
wallet.py fix #6157 2020-05-11 08:12:09 +02:00
wallet_db.py Replace wallet backup with channel backups 2020-04-10 14:45:23 +02:00
x509.py ecc: abstract away some usage of python-ecdsa: bytes<->int conversions 2020-02-11 16:41:49 +01:00