Dicts don't have guaranteed ordering.
Also now tests both with dicts and list of tuples for single parameter
tests.
All the actual code still use dicts, parameter order in BIP21 URI's in
real life should not matter.
035fae452c Fix JM-Qt recover wallet bug (chris-belcher)
Pull request description:
Fixes issue #610
ACKs for top commit:
kristapsk:
ACK 035fae452c (tested that #610 is fixed and also checked all uses of `wallet_generate_recover_bip39()` in code).
Tree-SHA512: e75ff2940a9b520a2247e4d2c9ea96917b253eb42fcfa952a9717db0a6f3c8b1d893718a268dbe61f11403cbf8017579a81fbf69eafde6061acbab669c85f44a
Prior to this fix, doing Wallet->Generate in Qt and
choosing the mnemonic extension option creates an
erroneous error dialog on completion of wallet creation
(even though the wallet is created correctly), due to #565
which correctly decoded the binary mnemonic extension for
the Wallet->Show Seed function, but this was not correct
for the Wallet->Generate case.
The cause for this was the difference between the type of
the mnemonic extension variable when it was created, and
when it is received from storage.
This commit ensures consistency between the two cases by
making a newly created mnemonic extension variable binary.
52b9ba8 Initialization of BCI raises Exception not sys.exit (Adam Gibson)
cc219cc Handles RPC failure in Qt with message box and quit. (Adam Gibson)
5ce4b55 Quit gracefully if Bitcoin RPC connection lost (Adam Gibson)
Reasoning for this change: to ensure that Qt will show
a message and gracefully exit (or quit attempting to
load a wallet) in all 3 cases: on startup it show an
intelligible message if the RPC connection fails (as
before this PR), if the RPC fails while no wallet is
loaded and thus no wallet service is started, it should
show an intelligible error message when you attempt to
load a wallet and it fails, and finally it should show
an intelligible error message before quitting, if the rpc
connection fails during the period when the wallet is
already loaded.
By switching to an Exception instead of sys.exit, it does
mean that starting a yieldgenerator shows a stack trace,
but it also shows an intelligible error message (in red),
and this is command line, so UI requirements are less strong.
We preserve the "good" behaviour of no stack trace, but
only error message, if the rpc connection is lost during
running.
Fixes#442.
First, the CONNREFUSED socket error is handled in jsonrpc.
Second, we respond to this (but *not* to resets) with a reactor
shutdown in BitcoinCoreInterface.rpc(). This also necessitates
early-quitting in the calling function
(WalletService.transaction_monitor) since the reactor stop
will only stop future deferred calls, not the currently running
one. The obvious sys.exit approach is only used in startup,
because the reactor is not currently running at that point.
Also minor change to DummyBlockchainInterface for test.
cfc4869ac9 Install XDG desktop entry for JoinMarketQt (Kristaps Kaupe)
Pull request description:
Automates what was proposed as a tutorial in #484, but just for the current user.
Top commit has no ACKs.
Tree-SHA512: ad33429799508356c85fa8d59ab6a006aed45aec0c3eaaeac39f9329434b306497f59a0ebca8ae232cb3f72205215dbfba3a62453c99621a46988a64ddac3f0c
f26186d1bd Allow accessing basic wallet info without blockchain source (Kristaps Kaupe)
Pull request description:
In both GUI and `wallet-tool.py`. Useful to, for example, extract recovery seed from a .jmdat wallet file without blockchain source. Resolves#545.
Top commit has no ACKs.
Tree-SHA512: c9c2d3b8601eac5dd55a05694c3fbd0873007abc666170e43cf26d745602db84200f5000355e4cc1c3be8085c78764f7d1d6cec87552d4e5775d47aa3d835208
6b41b8b Disable creation of fidelity bond wallets (chris-belcher)
869ef55 Disable loading of fidelity bond wallets by Qt (chris-belcher)
14f086b Add usage guide for fidelity bond wallets (chris-belcher)
2860c4f Freeze timelocked UTXOs with locktimes in future (chris-belcher)
ddb32ce Rename functions to say "key" instead of "privkey" (chris-belcher)
c70183b Create tests for fidelity bond wallets (chris-belcher)
a0a0d28 Add support for spending timelocked UTXOs (chris-belcher)
762b1f6 Add watch only wallets for fidelity bonds (chris-belcher)
a937c44 Add wallet-tool addtxoutproof method (chris-belcher)
97216d3 Sync burner outputs and display in wallet-tool (chris-belcher)
255d155 Add merkle proof functions to BitcoinCoreInterface (chris-belcher)
2271ce0 Add support for burning coins with sendpayment (chris-belcher)
dc715c9 Add timelock fidelity bond wallet sync and display (chris-belcher)
ee70cd7 Add support for OP_CLTV timelock addresses (chris-belcher)
d86df33 Rename functions which create multisig scripts (chris-belcher)
53b056e Rename variable internal to address_type (chris-belcher)
Tree-SHA512: 9f24000b0ebb4524b30c8afaa4416e516c7241c565dd21a96f83b70d6b6c42e83ad20bfd4f6e85545a855af4fcfd6065feb674f5ed270ca51ac814b4c3684ab4
Previously timelocked UTXOs would be returned by calls like
select_utxo() and get_utxos_by_mixdepth(). This caused annoyances
if trying to burn a single UTXO. It could also cause recently-
unlocked coins to accidently get spent, perhaps co-spent with other
coins.
This commit fixes that by freezing UTXOs with the coin control
feature whenever the wallet is sync'd. When the timelock of a coin
passes the user must explicitly use coin control to spend it.
Watchonly wallets use pubkeys instead of privkeys, but in a bit of
hack the functions previously called "_get_priv_from_path" would
actually return public keys for watchonly wallets. This could have
pretty terrible consequences one day, so functions like that have
been renamed to use the word "key" instead, which could be either
private or public.
The cryptoengine class BTC_Timelocked_P2WSH now implements
sign_transaction() which can be used to spend timelocked UTXOs.
FidelityBondMixin.is_timelocked_path() is now used outside the class
so its leading underscore has been removed.
Watch only wallets can now be created via wallet-tool. The wallets
store a bip32 xpub key from which all the public keys are generated.
Watch only wallets only store and display the zeroth mixdepth, which
is the only one needed for fidelity bonds.
The bip32 xpub key needed to create a watch only wallet is now
specially highlighted in the wallet-tool display, this is to help users
actually find it amongst all the other xpubs.
The field key_ident in the wallet class was previously generated using
private keys, which are not available in watch only wallets. So now
for fidelity bond wallets key_ident is generated using a public key.
Existing non-fidelity-bond wallets are unaffected
Fidelity bond wallets are intended to be used when at a later date
using fidelity bonds to greatly increase joinmarket's resistance to
sybil attacks. This commit adds support for timelocked addresses.
It allows users to optionally create wallet which support such
addresses. The synchronization code is modified to also scan for
timelocked addresses. The keypairs of the timelocked addresses go in
the newly created 2nd address type, where before the zeroth index were
receive addresses and first index was change.
The locktime dates are fixed at the first of each month for the next 30
years. This means users dont need to remember any dates, and so just
their seed phrase and wallet type will still be enough to recover all
funds. Each keypair used for timelocking requires an additional 360
addresses to be scanned for, which isn't a problem for Bitcoin Core.
Fidelity bonds are only stored in the zeroth mixdepth, as they are not
used in repeated coinjoins so theres no point having them in multiple
mixdepths.
Timelocked addresses don't use the get_new_script() family of functions
because they all assume that one index equals one address, and that
therefore it's possible to ask for a "next" address. For timelocked
addresses knowing the index is not enough to know the address, the
timestamp must be known too. Also once one address made of
(index, timestamp) is used you mustn't use that index and pubkey again,
even though all the other timelocks for that index/pubkey are unused.
This is for privacy reasons, as its equivalent to address reuse.
Previously an example of a BIP32 path
would be: m/wallet-type'/mixdepth'/internal/index
The 'internal' name referred to internal and external addresses (also
called change and receive). The renaming to 'address_type' is in
preparation to add more branches for timelocked addresses and burner
outputs.
The variable formally known as 'internal' is now no longer a boolean
but always an integer. This almost-always seemlessly fits because the
values False and Ture correspond to 0 and 1. The function
_get_internal_type therefore has no purpose anymore. Delete it.