LtbLightning / bdk-flutter

Bitcoin Development Kit - Flutter Package
MIT License
60 stars 27 forks source link

BdkException.unExpected(e: Unable to sign transaction) #80

Closed awaik closed 1 year ago

awaik commented 1 year ago

Description

  1. If I create a regular wallet I can create and sign a transaction.
  2. The bug appears when I create a multis wallet.
  3. In this case I can create a transaction.
  4. I can get transaction details.
  5. But when I tried to sign it I get a error BdkException.unExpected(e: Unable to sign transaction)

Code

  final txBuilder = TxBuilder();
  final Address addressModel = await Address.create(address: buyerAddress);
  final Script script = await addressModel.scriptPubKey();
  final txToBuyer = await txBuilder.feeRate(10.0).addRecipient(script, toBuyerSatoshies).finish(wallet);

  final sbt = await wallet.sign(txToBuyer.psbt);

Transaction details

flutter: txid: a020a310b9ff3e2c54123b0f30000d03ef77fb87b02fd3883bce2603ed9da5db
flutter: serializedTx: [1, 0, 0, 0, 2, 190, 31, 197, 236, 131, 172, 129, 168, 132, 30, 42, 94, 30, 78, 195, 89, 133, 195, 183, 185, 121, 98, 132, 189, 9, 94, 144, 201, 37, 249, 186, 24, 0, 0, 0, 0, 0, 254, 255, 255, 255, 12, 91, 163, 192, 30, 122, 80, 6, 133, 168, 170, 73, 52, 200, 96, 93, 53, 201, 99, 249, 139, 116, 43, 14, 124, 90, 11, 170, 57, 103, 18, 91, 0, 0, 0, 0, 0, 254, 255, 255, 255, 2, 40, 35, 0, 0, 0, 0, 0, 0, 25, 118, 169, 20, 41, 102, 26, 205, 27, 232, 106, 174, 220, 27, 248, 222, 103, 202, 65, 222, 174, 196, 37, 180, 136, 172, 80, 20, 0, 0, 0, 0, 0, 0, 34, 0, 32, 98, 76, 118, 157, 40, 115, 188, 116, 229, 235, 104, 137, 232, 198, 45, 93, 152, 212, 182, 45, 79, 23, 49, 41, 74, 186, 115, 158, 137, 84, 60, 165, 157, 14, 12, 0]
flutter: ===================
flutter: received: 5200
flutter: send: 17000
flutter: confirmation time: null
flutter: fee: 2800
awaik commented 1 year ago

I tried to sign a tx with a watch-only wallet. Maybe it is worth adding an error message about this.