It would be possible for users to create a descriptor with xpubs without
an origin set. In fact, not many are used to origins and it's a very
likely mistake. Signers need this information in order to be able to
sign. So they could potentially create a wallet and potentially never be
able to sign for one or multiple keys.
Fix this by requiring an origin for all keys in the descriptor.
Multiple change indexes may be present in a spend
draft transaction and can be detected instead
in the response psbt with the bip32_derivation
outputs fields.
ba994ff8ff commands: do not underestimate the size of created transactions (Antoine Poinsot)
46a94d6c8e qa: test recovery 'sweep' transaction creation (Antoine Poinsot)
3b5cbd5122 qa: introduce a sign_and_broadcast utility (Antoine Poinsot)
d362885b85 qa: record the recovery xpub too (Antoine Poinsot)
a69fb625ea qa: use a CSV of 10 for recovery (Antoine Poinsot)
a78f46fa2f [refactoring] jsonrpc: sort command names alphabetically (Antoine Poinsot)
c09ae3f87b commands, jsonrpc: add a new 'createrecovery' command (Antoine Poinsot)
3d5d0134b4 commands: fix the capacity of input vectors in create_spend (Antoine Poinsot)
f2312593da commands: check for dust outputs in the PSBT sanity checks (Antoine Poinsot)
9f23161a53 commands: correct the max feerate value (Antoine Poinsot)
54410cd9c4 database: allow to query coins by their spending status (Antoine Poinsot)
Pull request description:
A new command that provides a simple way for a user to sweep all the coins whose timelocked recovery path is available.
The first part of #180. Note this also contains a number of drive-by fixes that i noticed while coding this up.
ACKs for top commit:
darosior:
self-ACK ba994ff8ff -- tested by Edouard on the GUI
Tree-SHA512: 002cb8602370fe3bec0692fe7bbe9e7af494b43756d3092da99b37e4ce2837bcdfcfb3afe7043900eb41c70de12e2129e19363b9efe41cee91c7f1f7c2824fb0
We weren't waiting for lianad to be back to the same height as bitcoind.
Necessarily it could happen that sorted_coins() would return an empty
list.
Fixes#142 (did 50 successful runs of the test)
The outpoints argument could eventually be made optional in order to
introduce some automated coin selection. So it makes more sense for it
to be after a required parameter, the destinations.
In config, expect to be given a multipath descriptor that contains a
derivation path for both receive and change addresses, but only for
those.
Instead of 'xpub/*', start using 'xpub/0/*' and 'xpub/1/*'.
When creating the watchonly wallet on bitcoind import both the receive
and change descriptors.
When polling, check for coins on both descriptors.
This replaces our existing implementation of PSBTs with a more
straightforward one, adapted from the Bitcoin Core functional tests
framework. This fixes a few flakes that occured because the previous
implementation could produce invalid PSBTs.
The Bitcoin Core implementation is pretty low level and was adapted to
treat mappings as such (the value in the PSBTMap can itself be a
mapping, like for partial signatures or BIP32 derivation paths).
The rest of the diff is adapting the users of PSBT to use the new
implementation and the clearly superior interface (yay!).
Since the Spend transaction command requires some parameters, this
implements the parameter-getting logic on the JSONRPC side as well.
This allows us to implement an end-to-end functional test of the
transaction flow using an external way to broadcast it. From the input
coins creation, to the Spend transaction broadcast.