Update no-history-sync code:
This updates the new functionality in jmclient.wallet_utils
in the no-history-sync PR #444 to be compatible
with the python-bitcointx refactoring.
Remove all future/py2 compatibility code remaining:
This is in line with #525 and corrects erroneous
addition of more compatibility code.
Addresses all flake8 complaints (ununsed imports etc)
Addresses review of @dgpv
Addresses review of @kristapsk
This commit uses the now created PSBTWalletMixin and additionally
creates a SNICKERWalletMixin, and adds a SNICKERReceiver object
to jmclient. A test of the end to end workflow of create and then
co-sign a SNICKER coinjoin as per the draft BIP is in test_snicker.
Additional changes:
updated python-bitcointx dependency to >=1.0.5
Minor refactoring of callbacks in tests and additional redeem
script checks to PSBTWalletMixin.sign_psbt.
Note that this work replaces #403 .
Subclassed btcointx.CKeyBase to create a privkey type
that uses our signing code.
These are then used to allow signing of inputs in
transactions owned by our wallet.
Created a PSBTWalletMixin to perform the above function,
and added it to our three wallet types.
Wrote a detailed creation, sign and broadcast test
for a psbt using utxos from within and outside the wallet.
Detailed tests across all 3 wallet types for psbt
Tests cover also mixed inputs of different
types and owned/unowned. Direct send now exported to be used
in tests rather than only script usage, also supports returning
a tx object rather than only a txid.
Replaces core transaction, address, serialization
and sign functionality for Bitcoin with
python-bitcointx backend.
Removes bech32 and btscript
modules from jmbitcoin. Removes all string,
hex, binary conversion routines. A generic
hex/binary conversion now is added to jmbase.
Removes all transaction serialization and
deserialization routines. Removes the now
irrelevant test modules.
Remaining functions in jmbitcoin remove any parsing of
hex format, requiring callers to use binary only.
One additional test added, testing the remaining
function in secp256k1_transaction.py: the signing
of transactions. Deserialized form is now
bitcointx.CMutableTransaction.
For jmbase, in addition to the above, generic conversions
for utxos to and from strings is added, and a dynamic conversion
for AMP messages to binary-only. Within the code, utxos are
now only in (binarytxid, int) form, except where converted
for communcation.
Tthe largest part of the changes are
the modifications to jmbitcoin calls in jmclient;
as well as different encapsulation with CMutableTransaction,
there is also a removal of some but not all hex parsing;
it remains for rpc calls to Core and for AMP message
parsing. Backwards compatibility must be ensured so some
joinmarket protocol messages still use hex, and it is
also preserved in persistence of PoDLE data.
As part of this, some significant simplification of
certain legacy functions within the wallet has been done.
jmdaemon is entirely unaltered (save for one test which
simulates jmclient code).
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