Skip to content

Unhandled exception leads to app crash. #125

Open
@awaik

Description

@awaik

When I create a transaction with the wrong utxo's - app crashes on the line

final TxBuilderResult txBuilderResultPreRes = await txBuilderPre.finish(wallet);

      final txBuilderPre = TxBuilder();

      List<(dynamic, int)> outputs = [];
      for (final fundOutput in fundOutputs) {
        final Address addressModel = await Address.create(address: fundOutput.address);
        final script = await addressModel.scriptPubKey();
        outputs.add((script, fundOutput.amount));
      }

      /// Pre-calculate fees amount
      TxBuilder txBuilderResultPre = txBuilderPre.feeRate(feeRate).manuallySelectedOnly().addUtxos(utxos);
      for (final output in outputs) {
        txBuilderResultPre = txBuilderResultPre.addRecipient(output.$1, output.$2);
      }

      final TxBuilderResult txBuilderResultPreRes = await txBuilderPre.finish(wallet);

with the message

thread 'frb_workerpool' panicked at src/r_api.rs:196:41:
called `Result::unwrap()` on an `Err` value: UnknownUtxo
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
* thread #42, name = 'frb_workerpool', stop reason = signal SIGABRT
    frame #0: 0x00000001eabdc200 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1eabdc200 <+8>:  b.lo   0x1eabdc220               ; <+40>
    0x1eabdc204 <+12>: pacibsp 
    0x1eabdc208 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1eabdc20c <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.

With correct utxo's this code works well.

  1. iOS 16.1.2
  2. bdk_flutter: ^0.30.0

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.2, on macOS 14.4 23E214 darwin-arm64, locale
en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions