wizardsardine / liana

The missing safety net for your coins
https://wizardsardine.com/liana
BSD 3-Clause "New" or "Revised" License
329 stars 58 forks source link

[lianad] panic if used with non-rescan wallet + imported DB #1128

Open pythcoiner opened 5 months ago

pythcoiner commented 5 months ago

(this should not happend to an user, i manually add a liana DB to a freshly re-created wallet that is connected to a remote bitcoind + did not rescan) (but i think we should not panic but error) this happend while spending (after broadcast) image

2024-06-21T06:57:03.555653Z ERROR liana:60: panic occurred at line 465 of file /home/pyth/.cargo/git/checkouts/liana-efb3a908181ef2cf/6d498db/src/bitcoin/d/mod.rs: Some("We must not fail to make a request for more than a minute: Server(Rpc(RpcError { code: -5, message: \"Invalid or non-wallet transaction id\", data: None }))")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: liana::bitcoin::d::BitcoinD::get_spender_txid
   8: <liana::bitcoin::d::BitcoinD as liana::bitcoin::BitcoinInterface>::spending_coins
   9: <alloc::sync::Arc<std::sync::mutex::Mutex<dyn liana::bitcoin::BitcoinInterface>> as liana::bitcoin::BitcoinInterface>::spending_coins
  10: liana::bitcoin::poller::looper::update_coins
  11: liana::bitcoin::poller::looper::updates
  12: liana::bitcoin::poller::looper::poll
  13: liana::bitcoin::poller::Poller::poll_forever
  14: std::sys_common::backtrace::__rust_begin_short_backtrace
  15: core::ops::function::FnOnce::call_once{{vtable.shim}}
  16: std::sys::pal::unix::thread::Thread::new::thread_start
  17: <unknown>
  18: <unknown>

  2024-06-16T06:57:03.556816Z ERROR liana::commands:701: Error receiving completion signal from poller: receiving on a closed channel

  2024-06-16T06:57:07.338712Z ERROR liana:60: panic occurred at line 473 of file /home/pyth/.cargo/git/checkouts/liana-efb3a908181ef2cf/6d498db/src/lib.rs: Some("The other end should never have hung up before this.: SendError { .. }")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: liana::DaemonHandle::stop
   8: <liana_gui::daemon::embedded::EmbeddedDaemon as liana_gui::daemon::Daemon>::is_alive::{{closure}}
   9: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  10: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  11: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  12: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  13: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  14: <futures_util::future::future::Then<Fut1,Fut2,F> as core::future::future::Future>::poll
  15: tokio::runtime::task::core::Core<T,S>::poll
  16: tokio::runtime::task::harness::Harness<T,S>::poll
  17: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  18: tokio::runtime::scheduler::multi_thread::worker::run
  19: tokio::runtime::task::core::Core<T,S>::poll
  20: tokio::runtime::task::harness::Harness<T,S>::poll
  21: tokio::runtime::blocking::pool::Inner::run
  22: std::sys_common::backtrace::__rust_begin_short_backtrace
  23: core::ops::function::FnOnce::call_once{{vtable.shim}}
  24: std::sys::pal::unix::thread::Thread::new::thread_start
  25: <unknown>
  26: <unknown>

  2024-06-16T06:57:17.335958Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

  2024-06-16T06:57:27.336223Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

  2024-06-16T06:57:37.336689Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

  2024-06-16T06:57:47.336566Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

  2024-06-16T06:57:57.336582Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

Note: from master 610a95bf3bab8ba2d1bb5836e2ecb09dd152de02

pythcoiner commented 5 months ago

more context: wallet imported + liana DB copied + connected to a remote bitcoind (forgot to rescan)

More log after restart liana-gui:

2024-06-21T07:26:01.907577Z  INFO liana::bitcoin::poller:113: Block chain synchronization progress: 100.00% (848864 blocks / 848864 headers)

  2024-06-21T07:26:01.915931Z  INFO liana::bitcoin::poller::looper:189: Block chain reorganization detected. Looking for common ancestor.

  2024-06-21T07:26:01.925512Z  INFO liana::bitcoin::poller::looper:191: Common ancestor found: '(848859,00000000000000000001c7f704605a00db1f41ecaa83dea1705b61d14c20cf82)'. Starting rescan from there. Old tip was '(848860,000000000000000000003f620e65976fc1768e6f81705cc7fdf25cfcb421825a)'.

  2024-06-21T07:26:02.076677Z  INFO liana::bitcoin::poller::looper:221: Tip was rolled back to '(848859,00000000000000000001c7f704605a00db1f41ecaa83dea1705b61d14c20cf82)'.

  2024-06-21T07:26:02.348884Z ERROR liana:60: panic occurred at line 465 of file /home/pyth/.cargo/git/checkouts/liana-efb3a908181ef2cf/6d498db/src/bitcoin/d/mod.rs: Some("We must not fail to make a request for more than a minute: Server(Rpc(RpcError { code: -5, message: \"Invalid or non-wallet transaction id\", data: None }))")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: liana::bitcoin::d::BitcoinD::get_spender_txid
   8: <liana::bitcoin::d::BitcoinD as liana::bitcoin::BitcoinInterface>::spending_coins
   9: <alloc::sync::Arc<std::sync::mutex::Mutex<dyn liana::bitcoin::BitcoinInterface>> as liana::bitcoin::BitcoinInterface>::spending_coins
  10: liana::bitcoin::poller::looper::update_coins
  11: liana::bitcoin::poller::looper::updates
  12: liana::bitcoin::poller::looper::updates
  13: liana::bitcoin::poller::looper::poll
  14: liana::bitcoin::poller::Poller::poll_forever
  15: std::sys_common::backtrace::__rust_begin_short_backtrace
  16: core::ops::function::FnOnce::call_once{{vtable.shim}}
  17: std::sys::pal::unix::thread::Thread::new::thread_start
  18: <unknown>
  19: <unknown>

  2024-06-21T07:26:02.802462Z ERROR liana:60: panic occurred at line 402 of file /home/pyth/.cargo/git/checkouts/liana-efb3a908181ef2cf/6d498db/src/bitcoin/mod.rs: Some("called `Result::unwrap()` on an `Err` value: PoisonError { .. }")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: <alloc::sync::Arc<std::sync::mutex::Mutex<dyn liana::bitcoin::BitcoinInterface>> as liana::bitcoin::BitcoinInterface>::sync_progress
   8: liana::commands::<impl liana::DaemonControl>::get_info
   9: <liana_gui::daemon::embedded::EmbeddedDaemon as liana_gui::daemon::Daemon>::get_info::{{closure}}
  10: liana_gui::daemon::Daemon::list_pending_txs::{{closure}}
  11: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  12: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  13: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  14: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  15: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  16: <futures_util::future::future::Then<Fut1,Fut2,F> as core::future::future::Future>::poll
  17: tokio::runtime::task::core::Core<T,S>::poll
  18: tokio::runtime::task::harness::Harness<T,S>::poll
  19: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  20: tokio::runtime::scheduler::multi_thread::worker::run
  21: tokio::runtime::task::core::Core<T,S>::poll
  22: tokio::runtime::task::harness::Harness<T,S>::poll
  23: tokio::runtime::blocking::pool::Inner::run
  24: std::sys_common::backtrace::__rust_begin_short_backtrace
  25: core::ops::function::FnOnce::call_once{{vtable.shim}}
  26: std::sys::pal::unix::thread::Thread::new::thread_start
  27: <unknown>
  28: <unknown>

  2024-06-21T07:26:02.813426Z ERROR liana:60: panic occurred at line 477 of file /home/pyth/.cargo/git/checkouts/liana-efb3a908181ef2cf/6d498db/src/bitcoin/mod.rs: Some("called `Result::unwrap()` on an `Err` value: PoisonError { .. }")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: <alloc::sync::Arc<std::sync::mutex::Mutex<dyn liana::bitcoin::BitcoinInterface>> as liana::bitcoin::BitcoinInterface>::wallet_transaction
   8: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   9: liana::commands::<impl liana::DaemonControl>::list_confirmed_transactions
  10: <liana_gui::daemon::embedded::EmbeddedDaemon as liana_gui::daemon::Daemon>::list_confirmed_txs::{{closure}}
  11: liana_gui::daemon::Daemon::list_history_txs::{{closure}}
  12: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  13: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  14: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  15: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  16: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  17: <futures_util::future::future::Then<Fut1,Fut2,F> as core::future::future::Future>::poll
  18: tokio::runtime::task::core::Core<T,S>::poll
  19: tokio::runtime::task::harness::Harness<T,S>::poll
  20: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  21: tokio::runtime::scheduler::multi_thread::worker::run
  22: tokio::runtime::task::core::Core<T,S>::poll
  23: tokio::runtime::task::harness::Harness<T,S>::poll
  24: tokio::runtime::blocking::pool::Inner::run
  25: std::sys_common::backtrace::__rust_begin_short_backtrace
  26: core::ops::function::FnOnce::call_once{{vtable.shim}}
  27: std::sys::pal::unix::thread::Thread::new::thread_start
  28: <unknown>
  29: <unknown>

  2024-06-21T07:26:12.678684Z ERROR liana:60: panic occurred at line 473 of file /home/pyth/.cargo/git/checkouts/liana-efb3a908181ef2cf/6d498db/src/lib.rs: Some("The other end should never have hung up before this.: SendError { .. }")
   0: liana::setup_panic_hook::{{closure}}
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys_common::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: liana::DaemonHandle::stop
   8: <liana_gui::daemon::embedded::EmbeddedDaemon as liana_gui::daemon::Daemon>::is_alive::{{closure}}
   9: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  10: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  11: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  12: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  13: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  14: <futures_util::future::future::Then<Fut1,Fut2,F> as core::future::future::Future>::poll
  15: tokio::runtime::task::core::Core<T,S>::poll
  16: tokio::runtime::task::harness::Harness<T,S>::poll
  17: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
  18: tokio::runtime::scheduler::multi_thread::worker::run
  19: tokio::runtime::task::core::Core<T,S>::poll
  20: tokio::runtime::task::harness::Harness<T,S>::poll
  21: tokio::runtime::blocking::pool::Inner::run
  22: std::sys_common::backtrace::__rust_begin_short_backtrace
  23: core::ops::function::FnOnce::call_once{{vtable.shim}}
  24: std::sys::pal::unix::thread::Thread::new::thread_start
  25: <unknown>
  26: <unknown>

  2024-06-21T07:26:22.678533Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

  2024-06-21T07:26:32.678711Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped

  2024-06-21T07:26:42.678346Z ERROR liana_gui::app:266: Failed to update cache: Daemon stopped
pythcoiner commented 5 months ago

note: i cannot rescan at that point need remove + recreate wallet

darosior commented 5 months ago

it seems like you imported a DB without importing the corresponding descriptor, which made bitcoind return an error, which made the poller thread crash and then the GUI crashed. I don't think we should ever support this scenario.

pythcoiner commented 5 months ago

it seems like you imported a DB without importing the corresponding descriptor, which made bitcoind return an error, which made the poller thread crash and then the GUI crashed. I don't think we should ever support this scenario.

it's the corresponding descriptor: i've spend one of the coin w/o rescanning

btw the gui didn't panic

darosior commented 5 months ago

Clearly the watchonly wallet has no knowledge of the descriptor whatsoever, so it must not have been loaded. On Friday, June 21st, 2024 at 1:55 PM, pythcoiner @.***> wrote:

it seems like you imported a DB without importing the corresponding descriptor, which made bitcoind return an error, which made the poller thread crash and then the GUI crashed. I don't think we should ever support this scenario.

it's the corresponding descriptor: i've spend one of the coin w/o rescanning

btw the gui didn't panic

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

pythcoiner commented 5 months ago

its an error that should never happend w/ a normal use, nobody should do this, but maybe we can avoid panic