Commit Graph
162 Commits
Author SHA1 Message Date
edouard 5e79c05c54 Add patch to liana version
The struct will be imported by the gui which
may need one day to increase the patch version number.
2023-02-02 14:43:04 +01:00
Antoine Poinsot 1cd61c9236 descriptors: require that an origin be set for the keys.
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.
2023-02-01 13:54:18 +01:00
Antoine Poinsot 3ea85fa950 descriptor: introduce a helper to analyze a PSBT spending Liana coins 2023-01-26 21:26:29 +01:00
Antoine Poinsot aac330ca65 descriptors: rename DescCreationError in a general desc-related error 2023-01-24 19:38:35 +01:00
Antoine Poinsot e22e30dc8d descriptors: support Multisig in both the primary and recovery paths
We only allow to create "legacy" multisigs for now (that is, what fits
in a CHECKMULTISIG, ie k-of-n with n<=20). See
https://github.com/wizardsardine/liana/issues/53 for discussions around
this.

We are a bit more laxist on parsing, where any miniscript that
corresponds to a multisig policy will be accepted.

Note this makes the helper inferring the CSV value from semantic policy
incorrect, but this is fix in a later commit as part of a complete
refactor of this logic.
2023-01-24 19:38:34 +01:00
Antoine Poinsot ed6ff9c67b commands: check addresses' network when creating transactions 2022-12-20 18:04:54 +01:00
edouard 103c1950ba Remove change_index from listspendtxs response
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.
2022-12-20 14:00:16 +01:00
Antoine Poinsot d3b89add9a daemon: apply clippy 1.66.0 fixes 2022-12-16 11:01:23 +01:00
Antoine Poinsot 3ac9f39aa1 Merge #224: Windows watchonly wallet path workaround
48e4909e7a daemon: store the watchonly wallet file in bitcoind's datadir on Windows (Antoine Poinsot)

Pull request description:

  Turns out that providing an absolute path to bitcoind when loading a wallet on Windows results in surprising behaviour.

ACKs for top commit:
  edouardparis:
    ACK 48e4909e7a

Tree-SHA512: b432460d529cf5b879361452af1e7947ec877c293f8a8a2e1740975a2957c0cdb288d1f9a1fa07e56193c7c65edf1f985d9e24dd3412f2bfc10922df239de766
2022-12-15 19:16:37 +01:00
Antoine Poinsot 48e4909e7a daemon: store the watchonly wallet file in bitcoind's datadir on Windows 2022-12-14 18:32:37 +01:00
Antoine Poinsot 030bfadaf7 bitcoind: decrease the sync progress roundup threshold 2022-12-14 16:51:17 +01:00
Antoine Poinsot 4560bc9ed2 bitcoind: move roundup_progress() to utils and unit test it 2022-12-14 16:51:16 +01:00
Antoine Poinsot ad1f0e20b1 Merge #182: Recovery command to sweep "expired" coins
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
2022-12-13 18:17:14 +01:00
Antoine Poinsot 05bbb3eef2 Merge #215: update bitcoind connection and be more robust at startup
acd6929831 doc: update for bitcoind 24.0.1 release (Antoine Poinsot)
650101525d bitcoind: set minimum required version to 24.0 (Antoine Poinsot)
9211d849c1 bitcoind: be less stupid when loading the watchonly wallet (Antoine Poinsot)

Pull request description:

  Fixes #210
  Fixes #209
  Fixes #213

ACKs for top commit:
  darosior:
    self-ACK acd6929831

Tree-SHA512: 8cacf41b0e00faed877462dc57b595265ff2936937d45535d1be2b42fd1bf80df2928ccacbefd43f82d88a728aca898a8549899380e341de8b8e74d34ec74642
2022-12-13 18:00:17 +01:00
Antoine Poinsot f6db9c6677 descriptors: rule out null timelocks
They are valid by consensus, not by Miniscript.
2022-12-13 16:59:56 +01:00
Antoine Poinsot 650101525d bitcoind: set minimum required version to 24.0 2022-12-13 16:37:52 +01:00
Antoine Poinsot 9211d849c1 bitcoind: be less stupid when loading the watchonly wallet
Only load it if isn't there already.
2022-12-13 16:14:20 +01:00
Antoine Poinsot ba994ff8ff commands: do not underestimate the size of created transactions
We were truncating when computing the virtual size of satisfactions.
2022-12-13 15:37:58 +01:00
Antoine Poinsot a78f46fa2f [refactoring] jsonrpc: sort command names alphabetically 2022-12-09 12:27:48 +01:00
Antoine Poinsot c09ae3f87b commands, jsonrpc: add a new 'createrecovery' command
This is a new command dedicated to the recovery usecase. For now it's
dead simple: sweep all coins that are available through the recovery
path to a given address.
2022-12-09 12:27:47 +01:00
Antoine Poinsot 3d5d0134b4 commands: fix the capacity of input vectors in create_spend
They were based on the expected size of the outputs vector...
2022-12-09 12:20:39 +01:00
Antoine Poinsot f2312593da commands: check for dust outputs in the PSBT sanity checks 2022-12-09 12:19:02 +01:00
Antoine Poinsot 9f23161a53 commands: correct the max feerate value
We should have a functional test for this...
2022-12-09 12:19:02 +01:00
Antoine Poinsot 54410cd9c4 database: allow to query coins by their spending status 2022-12-09 12:19:01 +01:00
Antoine Poinsot 07e5ea3fd2 commands: fill non_witness_utxo field in PSBT inputs for createspend
We are still in segwit v0, so signers need it!!
2022-12-09 10:49:49 +01:00
Antoine Poinsot f03b617490 Merge #176: Friendlier bitcoind startup error handling
0306773cdc daemon: log and exit 1 on startup error, don't panic (Antoine Poinsot)
13b2b8eef4 bitcoind: immediately set the default retry limit (Antoine Poinsot)
b0ef121e91 bitcoind: accurate connection sanity checks at startup (Antoine Poinsot)

Pull request description:

  We were not properly treating warming up errors when bitcoind was starting up. Also, better to just log as error and `exit` with `1` instead of panic'ing on a daemon startup error.

  See the commit messages for details.

  Fixes #134
  Fixes #163

ACKs for top commit:
  edouardparis:
    ACK 0306773cdc

Tree-SHA512: e14a72456104682ccff30d88e21303447065d371aed7279461595795eb938ba823578f05cc47704d996dbe570d12f467b91a88d58363511864e6a1f10eb76004
2022-12-08 17:23:11 +01:00
Antoine Poinsot 0306773cdc daemon: log and exit 1 on startup error, don't panic 2022-12-08 14:59:50 +01:00
Antoine Poinsot 13b2b8eef4 bitcoind: immediately set the default retry limit
We were previously adding it later on to fail early on startup error.
This didn't handle well "warming up" errors.

Now that it was reachable and listening to requests already, we can just
use the real retry limit from the get-go.
2022-12-08 14:59:49 +01:00
Antoine Poinsot b0ef121e91 bitcoind: accurate connection sanity checks at startup
The current checks were only testing whether a bitcoind was at all
reachable. We need to make sure it is also listening to requests (and
not warming up) in order for the assumptions made later on (we panic on
requests if we retried for too long) to hold.

This makes the startup sanity checks also wait for bitcoind to get out
of warming up mode.
2022-12-08 14:59:49 +01:00
Antoine Poinsot 9cc748cd2a descriptors: make the satisfaction size helpers part of the multi desc
Otherwise caller would have to call "receive_desc()" or "change_desc()"
before being able to call that which is unnecessary and an awkward API.
2022-12-08 11:57:47 +01:00
Antoine Poinsot 929c79a56a descriptors: check for duplicates when creating a descriptor 2022-12-08 11:54:23 +01:00
Antoine Poinsot 066994dddb Merge #161: daemon: update rust-miniscript to 0.9
3224f08ba0 daemon: update rust-miniscript to 0.9 (Antoine Poinsot)

Pull request description:

  This also updates the multipaths descriptor patch to the review PR https://github.com/rust-bitcoin/rust-miniscript/pull/470 (rebased on 0.9)

  Fixes #123.

ACKs for top commit:
  darosior:
    self-ACK 3224f08ba0 -- trivial.

Tree-SHA512: 03c8b181e96df8d73953cefadfbb090049859f01e6c8d03cf8417ad4d46795dc295b097f8df6c0f683fb9da03b78f39e824cb7768376d1d5718bdce177edcb6d
2022-12-08 10:09:50 +01:00
Antoine Poinsot 3224f08ba0 daemon: update rust-miniscript to 0.9
This also updates the multipaths descriptor patch to the review PR https://github.com/rust-bitcoin/rust-miniscript/pull/470 (rebased on 0.9)
2022-12-07 11:58:36 +01:00
Antoine Poinsot dc61a1c3bd commands: remove discrepancy between blockheight and block_height 2022-12-07 11:42:17 +01:00
Antoine Poinsot 0c80702f1b Merge #151: Some tiny cleanups
a4e6656688 daemon: remove / correct some TODOs (Antoine Poinsot)
628ed3d0ed descriptors: remove TODO in assertions, explain instead (Antoine Poinsot)
62067f0030 qa: remove needless import in fixtures (Antoine Poinsot)

Pull request description:

  Small things i noticed while working on #148.

ACKs for top commit:
  darosior:
    ACK a4e6656688

Tree-SHA512: 0d6b6b95a99744cd92b9ecd30d9678ff27c7223238a31c3e9093899caa11889d40cfe4c7d855c07c378ca127ca900269980d179aeb02478f04e3eaa1e20e1721
2022-12-06 13:20:33 +01:00
Antoine Poinsot a4e6656688 daemon: remove / correct some TODOs 2022-12-05 11:17:27 +01:00
Antoine Poinsot 628ed3d0ed descriptors: remove TODO in assertions, explain instead 2022-12-05 10:05:26 +01:00
Antoine Poinsot eebc96c4d5 descriptors: add a method to get the size of a spending input
This is useful for the GUI.
2022-12-05 09:58:04 +01:00
Antoine Poinsot 478707df27 bitcoind: detect coins as spent even if they are unconfirmed 2022-11-23 11:51:28 +01:00
Antoine Poinsot 8e7e46a52c bitcoind: detect spent coins for send-to-self transactions
We weren't specifying include_change therefore those were not part of
listsinceblock result and never detected as spent!
2022-11-23 11:51:27 +01:00
Antoine Poinsot 1f06c4d4dc db: fix the list_txids query
We need to limit the number of *distinct* txids. Limiting the number of
results in the inner queries at all could lead to incorrect results
with regard to ordering too.

See https://github.com/revault/liana/pull/99#discussion_r1029619579.
2022-11-22 19:31:02 +01:00
edouard 774f969594 Add listtransaction command 2022-11-22 19:31:02 +01:00
edouard 3cd709697b Add listconfirmed command 2022-11-22 19:31:02 +01:00
Antoine Poinsot f5ff0fad36 daemon: 'revaultd' name usage leftovers 2022-11-18 18:33:07 +01:00
Antoine Poinsot 968a7d17a0 daemon: rename Minisafe to Liana 2022-11-17 17:10:22 +01:00
Antoine Poinsot 4bd65213e2 commands: swap the outpoints and destinations arguments to createspend
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.
2022-11-17 15:15:22 +01:00
Antoine Poinsot 838daa0c93 commands: set the BIP32 derivation in PSBT for change outputs
So the signing devices (or even the GUI) can view them as such.
2022-11-17 15:01:34 +01:00
Antoine Poinsot dbf17681a4 commands: signal for opt-in RBF in Spend transactions 2022-11-17 14:52:27 +01:00
Antoine Poinsot b31673de32 poller: update our internal derivation index also from the chain
Fixes #81
2022-11-16 15:46:25 +01:00
Antoine Poinsot 42d2ffeec1 db: more flexible interface for updating our next derivation indexes.
Instead of only incrementing it, allow to be able to set it to any
value. This will be useful for instance to set the derivation to the
latest used onchain, if another wallet is much further down the
derivation tree than we are (or after a rescan).
2022-11-16 15:19:50 +01:00