mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
Satochip: remove debug logs, trailing whitespaces & clean code
This commit is contained in:
parent
cbcb40c973
commit
6f028d720b
13 changed files with 531 additions and 598 deletions
|
|
@ -1074,13 +1074,6 @@ public class DevicePane extends TitledDescriptionPane {
|
|||
initializeButton.setDefaultButton(true);
|
||||
initializeButton.setOnAction(event -> {
|
||||
initializeButton.setDisable(true);
|
||||
/*
|
||||
log.trace("SATOCHIP DevicePane getCardInitializationPanel() pin.get(): " + pin.get());
|
||||
log.trace("SATOCHIP DevicePane getCardInitializationPanel() repeatedPin.getText(): " + repeatedPin.getText());
|
||||
log.trace("SATOCHIP DevicePane getCardInitializationPanel() mnemonic.getText(): "+ mnemonic.getText());
|
||||
log.trace("SATOCHIP DevicePane getCardInitializationPanel() passphrase.getText(): "+ passphrase.getText());
|
||||
*/
|
||||
|
||||
byte[] seedBytes;
|
||||
// check that pin and previous pin match
|
||||
if ( !pin.get().equals(repeatedPin.getText()) ){
|
||||
|
|
@ -1098,7 +1091,6 @@ public class DevicePane extends TitledDescriptionPane {
|
|||
messageProperty.set("Failed to parse the seed with error: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
Service<Void> cardInitializationService = cardApi.getInitializationService(seedBytes, messageProperty);
|
||||
cardInitializationService.setOnSucceeded(successEvent -> {
|
||||
log.debug("SATOCHIP DevicePane getCardInitializationPanel() Card initialized!");
|
||||
|
|
@ -1112,17 +1104,9 @@ public class DevicePane extends TitledDescriptionPane {
|
|||
setExpanded(false);
|
||||
});
|
||||
cardInitializationService.setOnFailed(failEvent -> {
|
||||
log.error("SATOCHIP DevicePane getCardInitializationPanel() failed to initialize card!");
|
||||
/*Throwable rootCause = Throwables.getRootCause(failEvent.getSource().getException());
|
||||
if(rootCause instanceof CardAuthorizationException) {
|
||||
setError(rootCause.getMessage(), null);
|
||||
setContent(getCardPinEntry(operationButton));
|
||||
operationButton.setDisable(false);
|
||||
} else {*/
|
||||
log.error("Error initializing card", failEvent.getSource().getException());
|
||||
AppServices.showErrorDialog("Card Initialization Failed", "The card was not initialized.\n\n" + failEvent.getSource().getException().getMessage());
|
||||
initializeButton.setDisable(false);
|
||||
//}
|
||||
});
|
||||
cardInitializationService.start();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -207,35 +207,6 @@ public class SatoCardApi extends CardApi {
|
|||
log.debug("SATOCHIP SatoCardApi sign() wallet: " + wallet);
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt: " + psbt);
|
||||
|
||||
// debug psbt
|
||||
/*log.debug("SATOCHIP SatoCardApi sign() psbt.hasSignatures(): " + psbt.hasSignatures());
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.isSigned(): " + psbt.isSigned());
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.isFinalized(): " + psbt.isFinalized());
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.verifySignatures:");*/
|
||||
/*try{
|
||||
psbt.verifySignatures();
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt signature verified!");
|
||||
} catch(Exception e) {
|
||||
log.debug("SATOCHIP SatoCardApi sign() failed to verify signatures with error: " + e);
|
||||
}
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.parse(false):");
|
||||
try{
|
||||
psbt.parse(false);
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.parse(false) finished!");
|
||||
} catch(Exception e) {
|
||||
log.debug("SATOCHIP SatoCardApi sign() failed psbt.parse(false) with error: " + e);
|
||||
}
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.parse(false) end:");
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.parse(true):");
|
||||
try{
|
||||
psbt.parse(true);
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.parse(true) finished!");
|
||||
} catch(Exception e) {
|
||||
log.debug("SATOCHIP SatoCardApi sign() failed psbt.parse(true) with error: " + e);
|
||||
}
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbt.parse(true) end:");*/
|
||||
// endbug psbt
|
||||
|
||||
Map<PSBTInput, WalletNode> signingNodes = wallet.getSigningNodes(psbt);
|
||||
//log.debug("SATOCHIP SatoCardApi sign() signingNodes: " + signingNodes);
|
||||
for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
|
||||
|
|
@ -244,19 +215,6 @@ public class SatoCardApi extends CardApi {
|
|||
log.debug("SATOCHIP SatoCardApi sign() signingNode: " + signingNode);
|
||||
log.debug("SATOCHIP SatoCardApi sign() signingNode.getDerivationPath(): " + signingNode.getDerivationPath()); // m/0/0
|
||||
try {
|
||||
/*// debug
|
||||
Map<ECKey, KeyDerivation> mapPubKey = psbtInput.getDerivedPublicKeys();
|
||||
log.debug("SATOCHIP SatoCardApi sign() mapPubKey.size(): " + mapPubKey.size());
|
||||
log.debug("SATOCHIP SatoCardApi sign() mapPubKey: " + mapPubKey);
|
||||
for (Map.Entry<ECKey, KeyDerivation> entry : mapPubKey.entrySet()) {
|
||||
ECKey key = entry.getKey();
|
||||
KeyDerivation value = entry.getValue();
|
||||
log.debug("SATOCHIP SatoCardApi sign() mapPubKey pubkey: " + Utils.bytesToHex(key.getPubKey()));
|
||||
log.debug("SATOCHIP SatoCardApi sign() mapPubKey derivation: " + value.getDerivationPath());
|
||||
}
|
||||
log.debug("SATOCHIP SatoCardApi sign() mapPubKey END");
|
||||
// endbug*/
|
||||
|
||||
String fullPath= null;
|
||||
List<Keystore> keystores = wallet.getKeystores();
|
||||
log.debug("SATOCHIP SatoCardApi sign() keystores.size(): " + keystores.size());
|
||||
|
|
@ -282,17 +240,13 @@ public class SatoCardApi extends CardApi {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//psbtInput.printDebugInfo();
|
||||
psbtInput.sign(new CardPSBTInputSigner(signingNode, fullPath));
|
||||
//psbtInput.printDebugInfo();
|
||||
|
||||
} finally {
|
||||
}
|
||||
}// endif
|
||||
else {
|
||||
log.debug("SATOCHIP SatoCardApi sign() psbtInput already signed!");
|
||||
//psbtInput.printDebugInfo();
|
||||
}
|
||||
} // endfor
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ public class HwAirgappedController extends KeystoreImportDetailController {
|
|||
private Accordion importAccordion;
|
||||
|
||||
public void initializeView() {
|
||||
log.debug("SATOCHIP HwAirgappedController START");
|
||||
List<KeystoreFileImport> fileImporters = Collections.emptyList();
|
||||
if(getMasterController().getWallet().getPolicyType().equals(PolicyType.SINGLE)) {
|
||||
fileImporters = List.of(new ColdcardSinglesig(), new CoboVaultSinglesig(), new Jade(), new KeystoneSinglesig(), new PassportSinglesig(), new SeedSigner(), new GordianSeedTool(), new SpecterDIY());
|
||||
|
|
@ -40,7 +39,6 @@ public class HwAirgappedController extends KeystoreImportDetailController {
|
|||
}
|
||||
}
|
||||
|
||||
log.debug("SATOCHIP HwAirgappedController initializeView() - BEFORE cardImporters");
|
||||
List<KeystoreCardImport> cardImporters = List.of(new Tapsigner(), new Satochip());
|
||||
for(KeystoreCardImport importer : cardImporters) {
|
||||
if(!importer.isDeprecated() || Config.get().isShowDeprecatedImportExport()) {
|
||||
|
|
@ -50,7 +48,6 @@ public class HwAirgappedController extends KeystoreImportDetailController {
|
|||
}
|
||||
}
|
||||
}
|
||||
log.debug("SATOCHIP HwAirgappedController initializeView() - AFTER cardImporters");
|
||||
|
||||
importAccordion.getPanes().sort(Comparator.comparing(o -> ((TitledDescriptionPane) o).getTitle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ public class HwUsbDevicesController extends KeystoreImportDetailController {
|
|||
private Accordion deviceAccordion;
|
||||
|
||||
public void initializeView(List<Device> devices) {
|
||||
//log.debug("SATOCHIP HwUsbDevicesController initializeView START");
|
||||
for(Device device : devices) {
|
||||
//log.debug("SATOCHIP HwUsbDevicesController initializeView device: " + device);
|
||||
DevicePane devicePane = new DevicePane(getMasterController().getWallet(), device, devices.size() == 1, getMasterController().getRequiredDerivation());
|
||||
if(getMasterController().getRequiredModel() == null || getMasterController().getRequiredModel() == device.getModel()) {
|
||||
deviceAccordion.getPanes().add(devicePane);
|
||||
|
|
|
|||
Loading…
Reference in a new issue