117171f24ff5bd6731d9e5e50e4515a03013a9eb commands: use a separate key chain for change addresses (Antoine Poinsot)
d9f905a19a5c6076683bbe7714ecb86fbafe0555 db: track the next unused derivation index for change, too (Antoine Poinsot)
58a0e57c59bf7b4f451580917f701e95e45d1af6 db: record whether a coin was received on a change address (Antoine Poinsot)
9b04a551474b2cd5ed793e42832454635d964495 db: store derivation index also for addresses from the change desc (Antoine Poinsot)
4f3daa7741b6996c17133dacedb4e70c66f5bac8 descriptors: cache the receive and change descriptors (Antoine Poinsot)
ca3d7c1f3360daa53fbec723fb960051a926d687 descriptors: introduce a newtype for the multipath descriptor (Antoine Poinsot)
1320ee30bacdedd449dfa89a3008e01995917c9f daemon: use multipath descriptors (Antoine Poinsot)
d4db804e4bad928466fa1db4a84a474ff4c33d7b qa: add a missing 'wait_for' in spend creation test (Antoine Poinsot)
7a18c583cbfcd958db9c79e8b13a0a68c1d20d41 bitcoind: filter received coins based on parent descriptors (Antoine Poinsot)
ba4c1e0383e302d2a822176d93b3b9fadc174b4b bitcoind: include change outputs in listsinceblock (Antoine Poinsot)
caaca1fd1a721acae150b8bd9212e51b8e378c99 descriptors: rename derive into derive_received (Antoine Poinsot)
f985fd787917e344b17ae90edd7b99bc1c9f3a7c descriptors: remove as_inner method (Antoine Poinsot)
846d924792089e41e530e414b26f0823afc151eb qa: upgrade python-bip380 to latest master (Antoine Poinsot)
3105b86a28444097e20e14261ffbfd5448b2854b Use my own fork of rust-miniscript (Antoine Poinsot)
Pull request description:
This fixes#18 by implementing the de-facto standard of using a `/0/*` keychain for receiving addresses and a `/1/*` keychain for change addresses. Note that once we'll have multisig, reusing addresses will still be possible since wallet don't share the same "next derivation index".
In order to avoid forcing the user to configure and backup two almost identical descriptors, we make use of the recently proposed BIP389 (https://github.com/bitcoin/bips/pull/1354). In order to prevent as much as possible introducing a backward incompatibility in the configuration file after the first release, we restrict the usage of multipath descriptors to `<0;1>` here.
We now derive public keys from `xpub/0/*` and `xpub/1/*` while we were previously deriving them from `xpub/*`.
This triggered a pretty invasive refactoring, as most parts of the codebase had to be updated to support the new change/receive separation (even the functional test miniscript dependency had to be updated, see https://github.com/darosior/python-bip380/pull/21).
Broadly, this:
1. Update our Miniscript dependency to my upstream PR (https://github.com/rust-bitcoin/rust-miniscript/pull/470) rebased on top of the 8.0.0 release.
2. Updates the descriptors module to handle somewhat safely the multipath descriptors (to avoid mixing up the single, multi, and derived descriptors).
3. Makes a multipath descriptor mandatory in the configuration file.
4. Updates the Bitcoin backend poller aware of descriptors for which to track coins.
- Necessarily this updates the bitcoind implementation to import two descriptors
5. Record in database whether a coin was for the change or receive descriptor, in addition to its derivation index
ACKs for top commit:
edouardparis:
ACK 117171f24ff5bd6731d9e5e50e4515a03013a9eb
Tree-SHA512: efcb7267f1ba6a5a3072e96fd1c70272f81092e86ee1178833f83d0aa88f271f42c269b71ca9992e76bb3e103baf1a189a609cc20f14f29b7388ab133da99044
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.
Our bitcoind watchonly wallet could, maybe, have other descriptors that
were imported. Sounds pretty unlikely since we use a dedicated wallet
but hey.
More importantly, we'll need to know the parent descriptor of the coin
in order to recognize it as newly received or change.
49ccc28ca7b0ee6e266d79ace67ff35c3d50905c Cargo: update most dependencies to the latest version (Antoine Poinsot)
a4bdb1efb79b8b87ba6131dea96798766e1fbcf5 tree wide: upgrade to Miniscript 8.0.0 (Antoine Poinsot)
d432745da583e2c38e67cae540b9417d76867bfa Cargo: don't require the 'compiler' feature from miniscript (Antoine Poinsot)
f7ca86191a6972bb6a8e3d78261159648db4ca23 ci: temporary disable 1.48 build on macOS (Antoine Poinsot)
f3e93df80c5f400e0b8f83c4862f0ff4b9f0f367 qa: add missing sighash type to dummy signatures in test_update_spend (Antoine Poinsot)
Pull request description:
Took the opportunity to update some dependencies, too.
ACKs for top commit:
darosior:
ACK 49ccc28ca7b0ee6e266d79ace67ff35c3d50905c
Tree-SHA512: babd0ac6af752e4671b1221f63bcc85cf9f1029162893c71ba991b2da0c16bf02e70bf061969b1a058d7c22d57061d99a82d4ed8564787a38f8a35a784d21812
This also updates the indirect rust-bitcoin dependency to 0.29.
Major changes are in the descriptors management:
- The rust-miniscript descriptors don't support raw hashes
within the pk_h() fragments, so we don't need all the boutique
management for this.
- The key translator API changed.
- We now take a u16 for the timelock instead of our previous
checks. This was inspired by the new rust-bitcoin Sequence
type.
- We now take a path instead of just a derivation index in
DerivedKey. We might use paths after all...
As for rust-bitcoin it's just a few nits:
- No more 'global' field on PSBTs (yay)
- Couple more trait derivation on types
- Some APIs were renamed.
b89401e5835b94f7e5341028357b11db69f8e37d qa: remove an unused variable in test_update_spend (Antoine Poinsot)
af9f0aeaed0f5607db94348c136325cf5fe9e387 qa: replace our PSBT implementation with a tweaked version of Bitcoin Core's (Antoine Poinsot)
eff39ee35a4b4d9133586ab5200689da40ef254f rpc: a new 'broadcastspend' command (Antoine Poinsot)
37ee93a1e6ddd5089c1cc3d2cfa6f263b691cf32 commands: a new command for broadcasting a Spend transaction (Antoine Poinsot)
b14bc602d45cac8191059d8ed6a5391ca7cfc68f bitcoin: interface for broadcasting a transaction (Antoine Poinsot)
Pull request description:
This implements a new command to broadcast an existing Spend transaction.
Fixes#58.
Fixes#66.
ACKs for top commit:
darosior:
ACK b89401e5835b94f7e5341028357b11db69f8e37d
Tree-SHA512: 299f7ba1df48ff2bbda68055df885474f5ca2b8336c46403d5f0bdfc30ec66d52653615780c187c8cab23b756fd9dad97f02c7ac20c71d833c54183d3c2e5f0a
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!).
e75637d3629df901b1aa453b131c1c780bfd8724 jsonrpc: fixup two typos in error messages (Antoine Poinsot)
a9b0e5e559b0ddddbd8e612771a95182f131e0f0 qa: functional tests for block chain reorganization (Antoine Poinsot)
e88bbbe65b34cf7af645fc3f07a90266d4a66792 poller: block chain reorganization handling (Antoine Poinsot)
d6f24e1c6a20d961128aa9c95367bd62aa8cb229 bitcoind: don't return spent coins with unfetchable spending tx as spent (Antoine Poinsot)
99ab0d7add5f9f3f924a6bd61263135c09e2a4cc commands: add a 'spend_info' field to the 'listcoins' entries (Antoine Poinsot)
57add1d86bb734b0f5291b2f266ef5652c93bc8d commands: return the DB's block height in 'getinfo' (Antoine Poinsot)
92f7ef12251309a30d100108ad82cd6790b5f4ac commands: make listcoins return all coins by default (Antoine Poinsot)
e9e4acd69de55e0c32c7e275e3b5318b5e161c46 db: database interface to rollback to a previous best block (Antoine Poinsot)
972c8dac86976723f4c417142999d4850c2fb9b6 db: require the spend block height from the DB interface (Antoine Poinsot)
6038843d33621c098d958d343c8b6d038922f72f database: rename coins' spent_at in spend_block_time (Antoine Poinsot)
cce227f80fbcbb32c5fca6fe78142131d7f35a53 bitcoin: interface to get the common block in our and the backend's chains (Antoine Poinsot)
Pull request description:
This finally implements our reorganization handling. Like in revaultd, upon noticing a tip change that indicates a reorg happened in our Bitcoin backend we rollback our state to the common ancestor between our state and the new chain, then start rescanning from there. The logic is much more straightforward than in revaultd though, as there is no presigned transactions to care about.
The PR grew a bit large as this needed a bit of preparatory work in order to be reasonably tested (and i noticed a few bugs and cleanups that slipped through review in #29). Please let me know if reviewers prefer that i split the prep work on the commands in another PR.
Fixes#15.
ACKs for top commit:
darosior:
ACK e75637d3629df901b1aa453b131c1c780bfd8724
Tree-SHA512: 1ebb2a3e10b462b739e1d5cb831de946177436c8fad4dcb20eb575fd0f58bef98a86e25c5fe0ed07d946975f982a420940607a69e74f24a02ef16271c92eceba
Hence add a 'spend_block_height' field to the 'coin' column in the
SQLite implementation. This also contains a couple cleanups, as well as
a fix (we were still checking if the blockheight was > 1).
7e911b8bb7ccca866db2afadb357615d3712a4cb ci: add Clippy check for both the daemon and the GUI (Antoine Poinsot)
6871407b1a2514c8c3b259a88cd5c267b206761e gui: clippification (Antoine Poinsot)
8b4866158bc2097a14857194d38bfb058678a55b daemon: clippification (Antoine Poinsot)
Pull request description:
This fixes *all* clippy warning from the whole repository. Some of them are... Well very opinionated to say the least. But to avoid bikeshedding i just applied all of them. Let's start fresh!
@edouardparis can you skim through the clippy fixes in the GUI folder? I checked the daemon one already.
Fixes#10.
ACKs for top commit:
edouardparis:
ACK 7e911b8bb7ccca866db2afadb357615d3712a4cb
Tree-SHA512: acebc86425039511d090b58139e12c149463d7a288d0d2aed3ba75d303aa2034db65f39f7e00436d556e86aa382686acab6699e65afe10ea31238c0a48a0635c
172cda19a0a72b77e3832f2e29ed7ff6f8062c44 bitcoin: avoid an unnecessary large clone() (Antoine Poinsot)
7513bcbf09f13f1625b989d52c52087048d90a73 bitcoind: use and_then instead of map().flatten() (Antoine Poinsot)
51f11a9e2f51945c7ec1f59a9acfd43d2f3977d3 looper: cleanup the check for spending coins' confirmation (Antoine Poinsot)
c9b6c6dedbc1e28b05543191238d0a81a92ba238 db: re-rename list_unspent_coins into unspent_coins (Antoine Poinsot)
3534e35b8721c5026b27d4d3c07b87dc6e4fa3dd bitcoin: remove erroneous block height check (Antoine Poinsot)
bb9897bdbb9926f6c3f8d9fb95339e45546372e2 Update coin txid if conflicting tx was confirmed (edouard)
3cf6bcbb98fc0034bc46ed58564e8aa4a1b6ffa6 add spent_coins to bitcoind poller (edouard)
94ee94edbdcdd917df131ad87893406f5f8597a2 Add blocktime and spent_at to coins table (edouard)
Pull request description:
Add two new columns:
- `blocktime`: timestamp of the block containing the transaction funding the coin.
- `spent_at`: timestamp of the block containing the transaction spending the coin.
Update the coin `spent_at` when the spend transaction is confirmed
ACKs for top commit:
darosior:
ACK 172cda19a0a72b77e3832f2e29ed7ff6f8062c44
Tree-SHA512: 4f12dd273784c1e8fab7f6427800fd10e6404d47e07e2293106d4454165dffb856cd65c5f4e4537867be403bd1790ce363968bfb94fec58ab02af3624ed68f22