373 Commits

Author SHA1 Message Date
Antoine Poinsot
e9bd8805e5
descriptors: fix derived key parsing and formatting 2024-02-27 13:03:11 +01:00
Antoine Poinsot
3aa9550a89
Merge #922: descriptors: add a method to get a PSBT's change outputs
39299263954b4d29f6bdcb177e9b2377d1ea92ed descriptors: add a method to get a PSBT's change outputs (Antoine Poinsot)
c6b554da93bdc90b0c2a6cb70d962fcaaf718aff descriptors: unit test we do take into account derivation steps before wildcard and multipath (Antoine Poinsot)

Pull request description:

  Fixes #857.

ACKs for top commit:
  darosior:
    ACK 39299263954b4d29f6bdcb177e9b2377d1ea92ed -- re-applying Edouard's ACK. Only change is the addition of an `index()` method on the `ChangeOutput` enum.

Tree-SHA512: fceaa4e492684be08d45ab09d74345d5825b73d930f5caa4162862e5ff94f32cd5e9ab23b0730bc7ef44569c8e10cfed0f343b4843590a2163122d3402fc3734
2024-01-24 11:28:51 +01:00
Antoine Poinsot
3929926395
descriptors: add a method to get a PSBT's change outputs 2024-01-24 11:26:00 +01:00
Antoine Poinsot
79141e2042
Merge #927: commands: include missing amount in spend response
13398982534d56a5723dfa86723c5917483c8653 commands: include missing amount in response (jp1ac4)

Pull request description:

  This PR follows a discussion around https://github.com/wizardsardine/liana/pull/873#issuecomment-1886715468.

  The GUI uses the `InsufficientFunds` error to get the missing amount when the user is creating a new spend, but it is not straightforward to extract this information in a general way from the RPC error (see https://github.com/wizardsardine/liana/issues/822#issuecomment-1836482355) and instead the spend module's `create_spend` is currently used (see https://github.com/wizardsardine/liana/pull/863).

  With this PR, the missing amount will be included in the `createspend` response rather than as an error.

  These changes are based on suggestions from @darosior and @edouardparis.

  In a follow-up PR, the GUI should revert to using the `createspend` command to calculate the amount left to select.

ACKs for top commit:
  darosior:
    re-ACK 1339898

Tree-SHA512: bf702d6b355339e96e719c1d95824e7941ac4fbaece4ec4cccd00b56ea4683ce7fb0cefc43faa5731b57e7935ef99da3a2c73b84aaeb9fa5f67703c799be2196
2024-01-23 17:33:48 +01:00
jp1ac4
1339898253
commands: include missing amount in response
The GUI uses the InsufficientFunds error to get the missing
amount when the user is creating a new spend.

It is not straightforward to extract this information in a
general way from the RPC error. Instead, this missing amount
will be included in the command response.

These changes are based on suggestions from darosior
and edouardparis.
2024-01-23 15:01:34 +00:00
pythcoiner
79177945ad add timestamp field to getinfo 2024-01-19 13:06:32 +01:00
Antoine Poinsot
c6b554da93
descriptors: unit test we do take into account derivation steps before wildcard and multipath 2024-01-15 18:57:39 +01:00
jp1ac4
5a15c744e7
commands: return warnings from spend creation 2024-01-11 20:06:00 +00:00
jp1ac4
da474ad6ce
spend: add warning when adding change to fee 2024-01-11 20:05:59 +00:00
jp1ac4
8d84f0de86
spend: return max possible change from coin selection 2024-01-11 20:05:59 +00:00
jp1ac4
e4d8330f34
spend: use debug log level in coin selection
This function is now called many times from the GUI via
`create_spend` and we expect this log message to be generated
multiple times.
2024-01-11 20:04:55 +00:00
Antoine Poinsot
d8a5e1d780
Merge #906: Bump MSRV, upgrade dependencies and clippification
0e99136404fcbbdee09eef4b116f17222cb2dee0 Clippification (Antoine Poinsot)
4949632fe6510151df9281b55a049169842ee5ef bitcoin: remove unused import (Antoine Poinsot)
ce026a62e6bf064cea249f391e4ab870f1cbcb61 Update rust-bitcoin and rust-miniscript (Antoine Poinsot)
2bce4c525d51b8ecbc923a43632ef8a724426453 Cargo: bump jsonrpc version to 0.17 (Antoine Poinsot)
65c9e389bb89197c2e9066b82789cec63b18d2d1 Cargo: bump rusqlite to 0.30 (Antoine Poinsot)
84e8a2ae8630789f5b8cc3796e0f1e4ff87614f2 Cargo.lock: update minor dependencies after MSRV bump (Antoine Poinsot)
92328fb8f6e34a383e876a79fad3fee4110c09a5 Bump MSRV for lianad to 1.63 (Antoine Poinsot)

Pull request description:

  New years' cleanup!

  Our MSRV was becoming too restrictive to keep being able to benefit from the latest releases of our dependencies. Strike a better balance between not requiring a recklessly new compiler and still being able to get upstream bug fixes.

  From this update most of our dependencies to their latest point releases. Then upgrade rusqlite, jsonrpc and rust-[bitcoin, miniscript] to their latest major version. Note their is a ton of updates. I've done a minimal due diligence to check what was updated, to what version, what changed, but i can't realistically audit all the code changes this is effectively pulling. I think we need to look into `cargo-crev`.

  Take the opportunity to apply some clippy cleanups, and bump the version we're using in CI.

  See commit messages for details.

ACKs for top commit:
  darosior:
    reACK 0e99136404fcbbdee09eef4b116f17222cb2dee0 -- re-applying jp1ac4's ACK after addressing review

Tree-SHA512: f7940a90065fdf2e9c2013a882955f8f8febe537f8268224a321ae2df2e380c5a34c8c99891b25aa3ee14efe9c5eaaa7ee3ffa6ea163a749cec044db351dd408
2024-01-11 10:48:27 +01:00
Antoine Poinsot
0e99136404
Clippification
Bump clippy in CI to latest stable.
2024-01-11 10:45:41 +01:00
Antoine Poinsot
4949632fe6
bitcoin: remove unused import 2024-01-11 10:45:40 +01:00
Antoine Poinsot
ce026a62e6
Update rust-bitcoin and rust-miniscript
The most notable change is rust-bitcoin's change in the serialization of
transaction with no input. It now accounts for the segwit marker even
for those. The base tx weight in coin selection had to be adapted to
handle this.

See https://gnusha.org/bitcoin-rust/2024-01-04.log for details.
2024-01-11 10:45:36 +01:00
Antoine Poinsot
2bce4c525d
Cargo: bump jsonrpc version to 0.17
It now finally accepts an option as argument.
2024-01-04 14:32:58 +01:00
Antoine Poinsot
a3731fa004
bitcoind: error when trying to rescan past prune height 2024-01-03 11:30:29 +01:00
Antoine Poinsot
5c3763526d
config: redact RPC credentials in Config Debug impl. 2023-12-21 14:27:36 +01:00
jp1ac4
552a49edb2
config: add user:password option for RPC authentication 2023-12-20 15:56:06 +00:00
Antoine Poinsot
6d2833fc18
Drop watchonly wallet migration for old Windows datadir
It was introduced in v2 (released in August 2023) for migrating datadir created using Liana v1 (May 2023).
2023-12-20 11:21:51 +01:00
jp1ac4
927c252d2e
spend: use helper for unsigned tx max size 2023-12-14 14:49:30 +00:00
jp1ac4
af416f6502
commands: use helper for unsigned tx max size 2023-12-14 14:49:29 +00:00
jp1ac4
e9264bdf0d
descriptors: add helper for unsigned tx max size 2023-12-14 14:49:29 +00:00
jp1ac4
0f8571b901
descriptors: use witness scale factor from lib 2023-12-14 14:18:34 +00:00
Antoine Poinsot
87d1c55d2e
Merge #870: Prepare v4 release
6625e67eed37ba385223dab6256478c312a190dc CHANGELOG: release notes for v4 (Antoine Poinsot)
35e50b4f383652b3cc7929a93e2dd5737fa74118 Bump lianad version to 4.0 (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  darosior:
    self-ACK 6625e67eed37ba385223dab6256478c312a190dc

Tree-SHA512: 2fd3492578ab1bd92c9249b1a4f5bb6134fac6b86febc1bffb33edc184bcbd30aad8554d5e3cb3bb5640ffe8b51c78d7839e1913c126edc5d6de0043c0d54a51
2023-12-12 18:32:52 +01:00
jp1ac4
5f534eb988
spend: a temporary partial fix for LowestFee
This is a temporary partial fix for
https://github.com/bitcoindevkit/coin-select/issues/6 that should be
reverted once the upstream fix has been made.

When calculating the score, the excess should be added to changeless solutions
instead of those with change.

Given a solution has been found, this fix adds or removes the excess to its
incorrectly calculated score as required so that two changeless solutions can
be differentiated if one has higher excess (and therefore pays a higher fee).

Note that the `bound` function is also affected by this bug, which could mean
some branches are not considered when running BnB, but at least this fix will
mean the score for those solutions that are found is correct.
2023-12-12 14:31:36 +00:00
Antoine Poinsot
35e50b4f38
Bump lianad version to 4.0 2023-12-12 15:10:50 +01:00
Antoine Poinsot
23e834a978
Merge #865: Expose spend module and coins fields
572567a7e4ceb838edcdf765af01b4aa69ac230d Expose ListCoinsEntry derivation_index and is_change (edouardparis)
3200c942fb048ea23f0bd663c53f756a646e848b lib: expose spend module (edouardparis)

Pull request description:

  In order to externally use create_spend, the spend module must be exposed and the listcoinsentry must include the derivation_index and is_change fields.

ACKs for top commit:
  darosior:
    utACK 572567a7e4ceb838edcdf765af01b4aa69ac230d

Tree-SHA512: 536a379974f58929f0036340e9f888614094e367cecaa474afa5f7f60ad1be73aac9bf8c7fbb1e7fc5947fc70dc44667462655147b287a10210f99d75061419b
2023-12-11 15:23:35 +01:00
edouardparis
572567a7e4 Expose ListCoinsEntry derivation_index and is_change 2023-12-11 13:35:30 +01:00
edouardparis
3200c942fb lib: expose spend module 2023-12-11 11:52:00 +01:00
Antoine Poinsot
c002ab9579
spend: scale down the number of BnB when not compiling with optimizations 2023-12-08 15:10:44 +01:00
Antoine Poinsot
f18086c152
spend: scale down the number of BnB rounds as number of candidates increases 2023-12-08 15:10:43 +01:00
Antoine Poinsot
0f6941150c
spend: a nicer interface for providing fee informations
Allows for a clearer interface: you explicitly set whether you are
creating a replacement, and you don't have dangling 0s when you don't
which necessitate a comment to explain what they correspond to.
2023-12-08 15:08:22 +01:00
Antoine Poinsot
990b153107
commands: don't query unconfirmed coins when creating recovery tx
They would be discarded immediately in the filter below.
2023-12-08 15:07:33 +01:00
Antoine Poinsot
c63a120794
spend: don't use database's Coin type
We could use a trait but instead there is just a couple fields we need so simply copy them over.
2023-12-08 15:07:33 +01:00
Antoine Poinsot
08ce0ad1d7
spend: update comment about create_spend behaviour 2023-12-08 15:07:32 +01:00
Antoine Poinsot
0c395bb63c
spend: document the create_spend function 2023-12-08 15:07:29 +01:00
Antoine Poinsot
f3113ba0d2
commands: remove redundant output value check
It's already performed (twice) in spend::create_psbt()
2023-12-08 15:03:28 +01:00
Antoine Poinsot
5894e788b8
spend: move tx size calc helper back to command module
It's not needed in spend anymore
2023-12-08 15:03:27 +01:00
Antoine Poinsot
6ddda6137c
spend: make coin selection helpers private
They aren't externally called anymore
2023-12-08 15:03:27 +01:00
Antoine Poinsot
33be1ff18b
commands: make create_recovery use the create_spend helper
Now that we have sweep capability no need to duplicate half the logic, just reuse the helper.
2023-12-08 15:03:26 +01:00
Antoine Poinsot
0523f0047f
commands: update next deriv index for any spend output address
It's basically free to do now, so we might as well do it.
2023-12-08 15:03:26 +01:00
Antoine Poinsot
5d50155532
spend: avoid direct access to our Bitcoin backend
We introduce a trait to get the wallet transaction correponding to the
transaction input in order to encapsulate the spend module.
2023-12-08 15:03:24 +01:00
Antoine Poinsot
7c238124be
spend: don't access the database in the PSBT creation function
Instead, pass the address details, if known, as a parameter.
2023-12-07 10:31:10 +01:00
Antoine Poinsot
22f97e11b7
spend: let caller update next derivation index
This is a first step toward removing the database accesses from the
spend PSBT creation helper. It now always take a change address, and
return whether it used it. If it did the caller retrieves the
information about the change address and if necessary bumps the next
derivation index to use.
2023-12-07 10:31:10 +01:00
Antoine Poinsot
9fdb75cf88
commands: split up spend transaction creation into its own module
This moves create_spend_internal in bulk. The interface is still inappropriate and will be adapted in the next commits.
2023-12-07 10:31:08 +01:00
jp1ac4
5391bfe04c
commands: add rbfpsbt command 2023-12-06 17:35:05 +00:00
jp1ac4
d5f3167404
commands: add create_spend_internal function
This is a more general version of `create_spend` in that it allows
for a mixure of both mandatory and optional coin selection candidates
and has a `min_fee` parameter.

Another difference is that it takes destination addresses that have
been checked for the network and amounts as `Amount`.

`create_spend` has been updated to call `create_spend_internal`.
2023-12-06 17:35:05 +00:00
jp1ac4
714fd5e142
bitcoin: add mempool_spenders to Bitcoin interface
`is_in_mempool` has been updated to use `mempool_entry`.
2023-12-06 17:35:05 +00:00
Antoine Poinsot
a77a36cb9e
commands: make it possible to create a sweep spend transaction
We leverage the change logic for this. By making it possible to set the
change address to an external address, one can send all the value from
the inputs to this address.
2023-11-24 13:51:42 +01:00