cashcrab icon indicating copy to clipboard operation
cashcrab copied to clipboard

receive_token error

Open shanelau opened this issue 1 year ago • 1 comments

Thank you for working on this project, it has been very inspiring for my own project. However, I have encountered some issues.

If try to execute receive_token function twice, always get an error.

My code

    let encoded_token: &str = "cashuAeyJ0b2tlbiI6W3sicHJvb2ZzIjpbeyJpZCI6IkkyeU4raVJZZmt6VCIsImFtb3VudCI6MSwiQyI6IjAzOGFjZDI2ZGExZTFlYzc0M2E4NmIxNTkwM2FiYjIyNzdjNDAwMDlkZDM2ZGMxZGJhOGQ0MjM5MWE2YjcyMmEwYSIsInNlY3JldCI6IlNXa0lnbDNIYXhOTUcxL1REbk9qazVqVEI1cVc0MzRYV1ZldUE2cmNSb1E9In1dLCJtaW50IjoiaHR0cHM6Ly84MzMzLnNwYWNlOjMzMzgifV19";
    let r6 = api::receive_token(encoded_token.to_string());
    let r6 = api::receive_token(encoded_token.to_string());
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/liuxing/.cargo/git/checkouts/cashu-crab-236eaaf426c3a3cb/eb31150/src/wallet.rs:121:40
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:117:5
   3: core::option::Option<T>::unwrap
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/option.rs:935:21
   4: cashu_crab::wallet::Wallet::receive::{{closure}}
             at /Users/liuxing/.cargo/git/checkouts/cashu-crab-236eaaf426c3a3cb/eb31150/src/wallet.rs:121:21
   5: rust::cashu::receive_token::{{closure}}

Flutter ffi call

In the Flutter project, the process gets stuck and the cannot get lock. Any function call results in an error.

FfiException (FfiException(RESULT_ERROR, Failed to lock the runtime mutex: poisoned lock: another task failed inside, null))

shanelau avatar Aug 19 '23 05:08 shanelau