Antoine Poinsot ec3a799dc6
Merge #1338: poller: query deposit tx for all coins, including expired
d7e5997c998edd2082ce86481726d22500bba67c poller: query deposit tx for all coins, including expired (Antoine Poinsot)

Pull request description:

  This fixes a crash whereby we missed the deposit transaction of a received coin because it was also part of the expired coins list.

  See the following logs.

  ```
  [8:33 AM](https://mm.revault.dev/revault/pl/a9mazcncaff3fc88yq8oqpipgo)
  root@cirrus-ci-task-4780461782728704:/tmp/cirrus-ci-build# tail -n100 /tmp/lianad-tests-o3guj0vh/test_rescan_edge_cases_1/
  lianad/log
  b'[1726295509][liana][INFO][thread main] Watchonly wallet created.'
  b'[1726295509][liana][INFO][thread main] Loading our watchonly wallet on bitcoind.'
  b'[1726295509][liana][INFO][thread main] Watchonly wallet loaded on bitcoind and sanity checked.'
  b'[1726295510][liana::database::sqlite][INFO][thread main] Created a fresh database at /tmp/lianad-tests-o3guj0vh/test_rescan_edge_cases_1/lianad/regtest/lianad.sqlite3.'
  b'[1726295510][liana::database::sqlite][INFO][thread main] Checking if the database needs upgrading.'
  b'[1726295510][liana][INFO][thread main] Database initialized and checked.'
  b'[1726295510][liana][INFO][thread Bitcoin Network poller] Bitcoin poller started.'
  b'[1726295510][liana::jsonrpc::server][DEBUG][thread Bitcoin Network poller] Binding socket at /tmp/lianad-tests-o3guj0vh/test_rescan_edge_cases_1/lianad/regtest/lianad_rpc'
  b'[1726295510][liana][INFO][thread Bitcoin Network poller] JSONRPC server started.'
  b'[1726295510][liana::bitcoin::poller][INFO][thread Bitcoin Network poller] Block chain synchronization progress: 100.00% (129 blocks / 129 headers)'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Current coins: {}'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly received coins: []'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly confirmed coins: []'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Expired coins: []'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spending coins: []'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spent coins: []'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Missing txids: []'
  b"[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] New tip: '(129,56fa7e0cc43c7767f68cc230df045a58a2c7cbd8e50d5ed900f39260d6e551fa)'"
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Updates done.'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Checking the state of an ongoing rescan if there is any'
  b'[1726295510][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] No ongoing rescan.'
  b'[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Block chain reorganization detected. Looking for common ancestor.'
  b"[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Common ancestor found: '(117,63a3207b98d2f832f9a213c8135243b5d8f7228778aeae4aa23ca6e565bf5b1e)'. Starting rescan from there. Old tip was '(129,56fa7e0cc43c7767f68cc230df045a58a2c7cbd8e50d5ed900f39260d6e551fa)'."
  b"[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Tip was rolled back to '(117,63a3207b98d2f832f9a213c8135243b5d8f7228778aeae4aa23ca6e565bf5b1e)'."
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Current coins: {}'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly received coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly confirmed coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Expired coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spending coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spent coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Chain tip changed while we were updating our state. Starting over.'
  b'[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Block chain reorganization detected. Looking for common ancestor.'
  b"[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Common ancestor found: '(106,7b2a449b8287d0e29054073110c47164edfc2ab842c43415705e53722acb1e24)'. Starting rescan from there. Old tip was '(117,63a3207b98d2f832f9a213c8135243b5d8f7228778aeae4aa23ca6e565bf5b1e)'."
  b"[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Tip was rolled back to '(106,7b2a449b8287d0e29054073110c47164edfc2ab842c43415705e53722acb1e24)'."
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Current coins: {}'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly received coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly confirmed coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Expired coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spending coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spent coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Chain tip changed while we were updating our state. Starting over.'
  b'[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Block chain reorganization detected. Looking for common ancestor.'
  b"[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Common ancestor found: '(101,7ad2fc79a78611d1d088ce6638c8324ba496bbd2e26a1d90a2be693b5d613f05)'. Starting rescan from there. Old tip was '(106,7b2a449b8287d0e29054073110c47164edfc2ab842c43415705e53722acb1e24)'."
  b"[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Tip was rolled back to '(101,7ad2fc79a78611d1d088ce6638c8324ba496bbd2e26a1d90a2be693b5d613f05)'."
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Current coins: {}'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly received coins: [Coin { outpoint: OutPoint { txid: 0x414ca732f0e59acef1ce6f63bdb6514dd8e0a8519671f38bb59c1b7353f6c00a, vout: 0 }, is_immature: false, block_info: None, amount: Amount(0.35600000 BTC), derivation_index: Normal { index: 2 }, is_change: false, spend_txid: None, spend_block: None }, Coin { outpoint: OutPoint { txid: 0x154afc0fd2190d65f0b5ffd466608c24bd55135666c142ae36b5a2648e0bf44e, vout: 0 }, is_immature: false, block_info: None, amount: Amount(0.35600000 BTC), derivation_index: Normal { index: 1 }, is_change: false, spend_txid: None, spend_block: None }, Coin { outpoint: OutPoint { txid: 0xaf4ef0538cdd46661de66c0175e0d053fbf82d56ff32b04c8699a56ef7f4a2f0, vout: 1 }, is_immature: false, block_info: None, amount: Amount(0.35600000 BTC), derivation_index: Normal { index: 0 }, is_change: false, spend_txid: None, spend_block: None }]'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly confirmed coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Expired coins: [OutPoint { txid: 0x414ca732f0e59acef1ce6f63bdb6514dd8e0a8519671f38bb59c1b7353f6c00a, vout: 0 }, OutPoint { txid: 0x154afc0fd2190d65f0b5ffd466608c24bd55135666c142ae36b5a2648e0bf44e, vout: 0 }]'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spending coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spent coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][INFO][thread Bitcoin Network poller] Chain tip changed while we were updating our state. Starting over.'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Current coins: {}'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly received coins: [Coin { outpoint: OutPoint { txid: 0x414ca732f0e59acef1ce6f63bdb6514dd8e0a8519671f38bb59c1b7353f6c00a, vout: 0 }, is_immature: false, block_info: None, amount: Amount(0.35600000 BTC), derivation_index: Normal { index: 2 }, is_change: false, spend_txid: None, spend_block: None }, Coin { outpoint: OutPoint { txid: 0x154afc0fd2190d65f0b5ffd466608c24bd55135666c142ae36b5a2648e0bf44e, vout: 0 }, is_immature: false, block_info: None, amount: Amount(0.35600000 BTC), derivation_index: Normal { index: 1 }, is_change: false, spend_txid: None, spend_block: None }, Coin { outpoint: OutPoint { txid: 0xaf4ef0538cdd46661de66c0175e0d053fbf82d56ff32b04c8699a56ef7f4a2f0, vout: 1 }, is_immature: false, block_info: None, amount: Amount(0.35600000 BTC), derivation_index: Normal { index: 0 }, is_change: false, spend_txid: None, spend_block: None }]'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly confirmed coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Expired coins: [OutPoint { txid: 0x414ca732f0e59acef1ce6f63bdb6514dd8e0a8519671f38bb59c1b7353f6c00a, vout: 0 }]'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spending coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Newly spent coins: []'
  b'[1726295511][liana::bitcoin::poller::looper][DEBUG][thread Bitcoin Network poller] Missing txids: [0xaf4ef0538cdd46661de66c0175e0d053fbf82d56ff32b04c8699a56ef7f4a2f0, 0x154afc0fd2190d65f0b5ffd466608c24bd55135666c142ae36b5a2648e0bf44e]'
  b'[1726295511][liana][ERROR][thread Bitcoin Network poller] panic occurred at line 465 of file src/database/sqlite/mod.rs: Some("Database must be available: SqliteFailure(Error { code: ConstraintViolation, extended_code: 787 }, Some(\\"FOREIGN KEY constraint failed\\"))")'
  b'   0: liana::setup_panic_hook::{{closure}}'
  b'   1: std::panicking::rust_panic_with_hook'
  b'   2: std::panicking::begin_panic_handler::{{closure}}'
  b'   3: std::sys::backtrace::__rust_end_short_backtrace'
  b'   4: rust_begin_unwind'
  b'   5: core::panicking::panic_fmt'
  b'   6: core::result::unwrap_failed'
  b'   7: <liana::database::sqlite::SqliteConn as liana::database::DatabaseConnection>::new_unspent_coins'
  b'   8: liana::bitcoin::poller::looper::updates'
  b'   9: liana::bitcoin::poller::looper::updates'
  b'  10: liana::bitcoin::poller::looper::updates'
  b'  11: liana::bitcoin::poller::looper::updates'
  b'  12: liana::bitcoin::poller::looper::updates'
  b'  13: liana::bitcoin::poller::looper::updates'
  b'  14: liana::bitcoin::poller::looper::updates'
  b'  15: liana::bitcoin::poller::looper::poll'
  b'  16: liana::bitcoin::poller::Poller::poll_forever'
  b'  17: std::sys::backtrace::__rust_begin_short_backtrace'
  b'  18: core::ops::function::FnOnce::call_once{{vtable.shim}}'
  b'  19: std::sys::pal::unix:🧵:Thread:🆕:thread_start'
  b'  20: <unknown>'
  b'  21: <unknown>'
  b''
  ```

  This should fix the flaky chain functional tests in ci.

ACKs for top commit:
  jp1ac4:
    ACK d7e5997c998edd2082ce86481726d22500bba67c.

Tree-SHA512: 2d51b15c4ef5aaeac5a703fb348c637d7bb44703b783fb928d7989cc69bf2ba3874128c74679640a4737236c60734394f36ab0974a8c9bdacc3ca5f59191b702
2024-09-16 11:03:47 +02:00
2024-06-25 03:01:29 +02:00
2024-09-12 09:31:21 +02:00
2024-09-12 09:31:21 +02:00
2024-09-11 10:11:58 +02:00
2024-09-12 09:31:21 +02:00
2024-09-12 09:31:21 +02:00
2024-09-12 11:46:39 +02:00
2024-01-04 14:32:57 +01:00
2022-11-17 17:10:22 +01:00
2024-04-04 12:06:50 +02:00

Liana

The missing safety net for your bitcoins.

About

Liana is a simple Bitcoin wallet. Like other Bitcoin wallets you have one key which can spend the funds in the wallet immediately. Unlike other wallets, Liana lets you in addition specify one key which can only spend the coins after the wallet has been inactive for some time.

We refer to these as the primary spending path (always accessible) and the recovery path (only available after some time of inactivity). You may have more than one key in either the primary or the recovery path (multisig). You may have more than one recovery path.

Here is an example of a Liana wallet configuration:

  • Owner's key (can always spend)
  • Any 2 keys from the owner's spouse and two kids (after 1 year)
  • A third party, in case all else failed (after 1 year and 3 months)

The lockup period is enforced onchain by the Bitcoin network. This is achieved by leveraging timelock capabilities of Bitcoin smart contracts (Script).

Liana can be used for trustless inheritance, loss protection or safer backups. Visit our website for more information.

Usage

Liana is available on Windows, Mac and Linux. To install and start using it see doc/USAGE.md. A more accessible version of Liana is also available as a web application here.

If you just want to quickly try out Liana on Bitcoin Signet, see doc/TRY.md.

Hacking on Liana

Liana is an open source project. It is hosted at Github. Contributions are very welcome. See here for guidelines. Most regular contributors hang out on our Discord. Join us there if you have any question about contributing.

Liana is separated in two main components: the daemon and the Graphical User Interface.

Liana daemon

The daemon contains the core logic of the wallet. It is both a library (a Rust crate) that exposes a command interface and a standalone UNIX daemon that exposes a JSONRPC API through a Unix Domain Socket.

The code for the daemon can be found in the src/ folder at the root of this repository.

Liana GUI

The GUI contains both an installer that guides a user through setting up a Liana wallet, as well as a graphical interface to the daemon using the iced library.

The code for the GUI can be found in the gui/src/ folder.

Security

See SECURITY.md for details about reporting a security vulnerability or any bug that could potentially impact the security of users' funds.

License

Released under the BSD 3-Clause Licence. See the LICENCE file.

Description
A fork of https://github.com/wizardsardine/liana with removed loopback restrictions to allow connecting to a custom remote bitcoin core node
Readme
Languages
Rust 90.4%
Python 8.5%
Shell 0.5%
Scheme 0.3%
Nix 0.3%