126 Commits

Author SHA1 Message Date
jp1ac4
5a15c744e7
commands: return warnings from spend creation 2024-01-11 20:06:00 +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
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
edouardparis
572567a7e4 Expose ListCoinsEntry derivation_index and is_change 2023-12-11 13:35:30 +01:00
jp1ac4
5391bfe04c
commands: add rbfpsbt command 2023-12-06 17:35:05 +00:00
jp1ac4
68b2503b12
func tests: move function to utils 2023-11-28 13:55:26 +00:00
jp1ac4
fdab722eff
func tests: run black 2023-11-28 13:55:25 +00:00
Antoine Poinsot
6bd6218d64
qa: demonstrate sweep functionality using createpsbt's change_address 2023-11-24 13:51:43 +01:00
jp1ac4
b8fd97fc83
commands: require change for self-send
This adds a new `LowestFeeChangeCondition` metric for use in
coin selection. It's the same as `LowestFee` with the option
to only find solutions with change.

This option is then used for self-sends to ensure only a solution
with change will be returned.
2023-11-24 10:10:22 +00:00
Antoine Poinsot
6b5fc2d1fa
qa: fix flaky test of unconfirmed spend RBF 2023-11-20 14:53:03 +01:00
Antoine Poinsot
cf7c4fbac9
bitcoin: drop spend txid for coins whose spending tx gets RBF'd
Even if the RBF does not spend this coin anymore.
2023-11-17 13:53:00 +01:00
Antoine Poinsot
544167dee4
bitcoin: mark coins whose spending tx got double spent as unspent again 2023-11-17 13:52:59 +01:00
Antoine Poinsot
bc25addf34
bitcoin: don't assign incorrect spend_txid on conflict tx confirmation 2023-11-17 13:52:58 +01:00
Antoine Poinsot
20ab30924f
qa: add a test describing current poller behaviour wrt replacements 2023-11-17 13:52:57 +01:00
edouardparis
33384c89b5
Add derivation_index to GetAddressResult
The derivation index is required for
for client to derive and verify the address
on hardware wallets.

Co-Authored-By: Antoine Poinsot <darosior@protonmail.com>
2023-11-16 18:12:34 +01:00
jp1ac4
cfa0f91dd3
commands: auto-select coins if none provided
When creating a new spend, if coin outpoints are not provided,
then coins will be selected automatically.

This automatic selection is such that the transaction fee is
minimized, taking into account the cost of creating any
change output now and the cost of spending it in the future.

If change is added, it must reduce the transaction waste and
be above the dust threshold. This same policy is applied also
in the case of manual coin selection, replacing the previous
logic for determining the change amount. This ensures that
creating a spend with auto-selection and another with manual
selection using the same auto-selected coins will give the
same change amount.
2023-11-14 13:32:53 +00:00
Antoine Poinsot
44f5a85b43
Merge #808: Followup to #709
0812a1216690514a0cf5ee6d80dbc6366fd91d43 jsonrpc: don't ignore invalid params to listaddresses (Antoine Poinsot)
d5338201d292ccf8d87849966c2f93efdfa0ccda commands: listaddresses cleanups (Antoine Poinsot)

Pull request description:

  This addresses my latest review from #709.

ACKs for top commit:
  jp1ac4:
    ACK 0812a12166

Tree-SHA512: 6f708fd2f1aa2f229a5c78a35e363870ef390513cce10fc6a5938b49e6b7ee5be9205bc4566376750e4f7eeea404709ce6d8c7a29df15b9216b8dbcf4b4fed7e
2023-11-13 11:55:51 +01:00
Antoine Poinsot
479efe7494
Merge #709: Implement listadresses
2660b77487d63218019413a4ca33b3a9629fbfc8 implement listadresses (pythcoiner)

Pull request description:

  address #681

  todo:
  - [x]  implement tests
  - [x] update docs

  edit: i'm really new to rust, don't hesitate to kick my ass when i write stupid code

ACKs for top commit:
  darosior:
    ACK 2660b77487d63218019413a4ca33b3a9629fbfc8 -- my requests are addressed in followup #808.

Tree-SHA512: a5fdfb4516dc0379bfec1be535e752795dec75d28cbc5b9fa4fe9898fa00b1cfaa9cee3b95f4dfd68365f4585426e1b4457a8366cc4f783600704994f879526f
2023-11-11 14:43:23 +01:00
Antoine Poinsot
0812a12166
jsonrpc: don't ignore invalid params to listaddresses 2023-11-11 14:25:24 +01:00
Antoine Poinsot
d5338201d2
commands: listaddresses cleanups
Introduce a single error enum variant. Avoid underflows. Clarify and comment the logic.
2023-11-11 13:59:06 +01:00
pythcoiner
2660b77487 implement listadresses 2023-11-10 14:59:44 +01:00
Antoine Poinsot
17ca01322e
Revert "Merge #722: Only include BIP32 derivations for a single spending path when creating PSBTs"
This reverts commit 71056982636b408485ab24dab6628a555a6e7924, reversing
changes made to 03c37bd378f4f6bf11d90b224ed1db74b3596eaf.

This reverts PR #722. It turns out the Ledger Bitcoin app needs the
BIP32 derivation for all the keys in the Script, not only for the
spending path used. Therefore always create PSBT with all the BIP32
derivations. We'll add a way to prune them for talking to the Bitbox in
a future commit.
2023-10-27 15:46:03 +02:00
Antoine Poinsot
6f5b053ea5
Revert "Merge #742: commands: don't add derivation paths for keys from different path but same signer"
This reverts commit ec0c2426aa5fa6cee2efabd3ee6f175b41c35f64, reversing
changes made to 26d750d09c84734f56c2dc18cb332a232e24fb6d.

This reverts the fixes to the pruning of BIP32 derivation paths when
creating a PSBT, in preparation of reverting the merge of this feature
altogether. This is because always creating PSBT with only the BIP32
derivations for a single path broke the Ledger support.
2023-10-27 15:43:52 +02:00
Antoine Poinsot
2e1c54491e
qa: test der paths in PSBT when desc has duplicate signer 2023-10-24 16:38:57 +02:00
Antoine Poinsot
8d213d5e31
qa: correct create_spend functional test
Both transactions may not spend the same coins. We need to compare the set of all der paths across inputs.
2023-10-24 16:38:57 +02:00
Antoine Poinsot
cf33228b0d
qa: don't assume desc xpubs' der path length in finalizer
It's always 2 for now, but we are going to break this invariant. Make this code more robust.
2023-10-24 16:14:41 +02:00
edouard
7105698263
Merge #722: Only include BIP32 derivations for a single spending path when creating PSBTs
7f3b0b021858cfb2fe914f3ba6b30a39e3ae05ff qa: test a PSBT has only the BIP32 derivations for a single spending path (Antoine Poinsot)
b71bd693d6ea4c1c3567194fc82be43fb70c05bb qa: don't use a static dummy origin for descriptor xpubs (Antoine Poinsot)
a81d39c81a89cdf5e70b9888cbeb3abaf290a365 commands: do not include BIP32 derivations for other spending paths (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  edouardparis:
    ACK 7f3b0b021858cfb2fe914f3ba6b30a39e3ae05ff

Tree-SHA512: f0e132edf8d653c5575f843b1e85d995f155a2435a6e6257564dc945562df70ec2049c29d77f7580858d9e4a58290b0798f298f77c18255415c4cf26ccc07f33
2023-10-24 12:40:43 +02:00
edouard
01ca960370
Delete empty labels when they are updated
In order to delete a label, client sends in the
request a null value as label value.

Co-Authored-by: Antoine Poinsot <darosior@protonmail.com>
2023-10-21 09:21:02 +02:00
Antoine Poinsot
0a95266cce
qa: don't use a static dummy origin for descriptor xpubs 2023-10-08 11:50:58 +02:00
Antoine Poinsot
7f3b0b0218
qa: test a PSBT has only the BIP32 derivations for a single spending path 2023-10-06 18:23:12 +02:00
Antoine Poinsot
b71bd693d6
qa: don't use a static dummy origin for descriptor xpubs 2023-10-06 18:23:12 +02:00
jp1ac4
eeaf90e522
commands: optionally filter listcoins by status and/or outpoint 2023-09-13 08:49:54 +01:00
Antoine Poinsot
edb2c513a3
Bump lianad version to 2.0 2023-08-31 13:11:37 +02:00
Antoine Poinsot
d5d2a7626f
Merge #648: tests: fix a small race in the rescan_and_recover test
9685920102b6f8340aeec5493b07e55ae9628398 tests: fix a small race in the rescan_and_recover test (Antoine Poinsot)

Pull request description:

ACKs for top commit:
  darosior:
    self-ACK 9685920102b6f8340aeec5493b07e55ae9628398 -- trivial, tested locally by running many instances of the test in parallel

Tree-SHA512: b384eeac6eba7416a9316b271c4ace26d933f9bfb85a6f4cc59133937cafda0baa9086926fad8ba8c262a1edaf3479b1a6db190da339fd8ff78820aa46b90656
2023-08-31 11:19:20 +02:00
Antoine Poinsot
5680ad27ec
lib: on Windows, migrate the watchonly wallet from bitcoind datadir
We used to store it there, if it's not within our own datadir copy it
from where it would have been stored by Liana v1.

Note we don't conditionally compile this on Windows so the codepath can
be tested with a functional test.
2023-08-30 17:51:53 +02:00
Antoine Poinsot
9685920102
tests: fix a small race in the rescan_and_recover test 2023-08-29 18:33:08 +02:00
Antoine Poinsot
a0c8adbfcc
Merge #609: Add more bitcoind-related setup logging
5c87937d4676354f19357e17b36655eb4853dbf9 Add more bitcoind-related setup logging (Antoine Poinsot)

Pull request description:

  At startup it sometimes appear we may be hanging when setting up bitcoind. Add more logging to give more information about what's taking long to setup (for instance, loading the watchonly wallet).

  Related to https://github.com/wizardsardine/liana/issues/475.

ACKs for top commit:
  darosior:
    ACK 5c87937d4676354f19357e17b36655eb4853dbf9

Tree-SHA512: 75c553cabf545d57a5fc2d251e5b4cd880a931a408c6f1b1052067f2ccc8e0728ad779f30de5a88c2566f9e67ac085b713393ee4fa193331e49c3a8e6112ecc8
2023-08-28 16:35:51 +02:00
Antoine Poinsot
204c160c4d tests: test the RPC interface for managing labels 2023-08-28 13:14:21 +02:00
Antoine Poinsot
7ecefdebdf
Revert "tests: don't wait for lianad to log on shutdown"
This reverts commit 97abc4699c7343e4be6a0596a25481f9e07bb3bb.
2023-08-22 16:44:22 +02:00
Antoine Poinsot
97abc4699c
tests: don't wait for lianad to log on shutdown
It seems to be causing some races that i don't want to be investigating
at the moment. It's redundant anyways as we are already checking for the
return code of the process.
2023-08-22 16:23:48 +02:00
Antoine Poinsot
5c87937d46
Add more bitcoind-related setup logging
At startup it sometimes appear we may be hanging when setting up
bitcoind. Add more loading to give more information about what's taking
long to setup (for instance, loading the watchonly wallet).
2023-08-14 10:29:33 +02:00
Antoine Poinsot
0785bb7f9f
poller: don't filter out coins with already a spend txid when checking for spends
What if the spending transaction gets RBF'd?
2023-08-11 11:52:51 +02:00
Antoine Poinsot
0f6fc48e88
qa: only run the RPC retry functional test with bitcoind 25.0 2023-08-09 15:50:22 +02:00
Antoine Poinsot
be2030af28
qa: unflake the test_retry_on_workqueue_exceeded functional test
This was racy as it was relying on the `waitfornewblock` timeout, so it
would occasionally fail in CI.

Make this test more robust by having `waitfornewblock` wait indefinitely
and submitting a block through the P2P interface to unstuck it.
2023-08-09 12:55:58 +02:00
Antoine Poinsot
b96db71a4d
qa: bitcoind: add a helper for sending a P2P message to bitcoind 2023-08-09 12:55:58 +02:00
Antoine Poinsot
df396cccc8
qa: set load_on_startup for bitcoind internal wallet 2023-08-09 12:13:30 +02:00
Antoine Poinsot
097d5e71c1
qa: adapt the migration functional test to also support 1.0 2023-07-20 13:48:33 +02:00
Antoine Poinsot
289f6581cc
qa: functional test createspend refuses immature outpoints 2023-07-20 13:43:15 +02:00