From 107b5ba36c83d80940eb33688b135ab292063c30 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 7 Mar 2023 13:17:33 +0200 Subject: [PATCH] show psbt qrs without non witness utxo entries for segwit signing wallets --- drongo | 2 +- src/main/java/com/sparrowwallet/sparrow/AppController.java | 2 +- .../sparrowwallet/sparrow/transaction/HeadersController.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drongo b/drongo index 0f78efc3..7eab644c 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 0f78efc373e99cf48a749ced25cd112ca083b88f +Subproject commit 7eab644cecc71e591ba805cff1a408b9f31a9303 diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index a558fe57..48d4a941 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -753,7 +753,7 @@ public class AppController implements Initializable { writer.print(transactionTabData.getPsbt().toBase64String(includeXpubs)); writer.flush(); } else { - outputStream.write(transactionTabData.getPsbt().serialize(includeXpubs)); + outputStream.write(transactionTabData.getPsbt().serialize(includeXpubs, true)); } } catch(IOException e) { log.error("Error saving PSBT", e); diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index f9eef160..98dddd76 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -864,7 +864,9 @@ public class HeadersController extends TransactionFormController implements Init //TODO: Remove once Cobo Vault has upgraded to UR2.0 boolean addLegacyEncodingOption = headersForm.getSigningWallet().getKeystores().stream().anyMatch(keystore -> keystore.getWalletModel().equals(WalletModel.COBO_VAULT)); - CryptoPSBT cryptoPSBT = new CryptoPSBT(headersForm.getPsbt().serialize()); + //Don't include non witness utxo fields for segwit wallets when displaying the PSBT as a QR - it can add greatly to the time required for scanning + boolean includeNonWitnessUtxos = !Arrays.asList(ScriptType.WITNESS_TYPES).contains(headersForm.getSigningWallet().getScriptType()); + CryptoPSBT cryptoPSBT = new CryptoPSBT(headersForm.getPsbt().serialize(true, includeNonWitnessUtxos)); QRDisplayDialog qrDisplayDialog = new QRDisplayDialog(cryptoPSBT.toUR(), addLegacyEncodingOption); qrDisplayDialog.show(); }