Skip to content

Commit

Permalink
Merge pull request #4 from zelcash/AcadiaReindex
Browse files Browse the repository at this point in the history
Acadia reindex
  • Loading branch information
TheTrunk authored Dec 25, 2018
2 parents 8b35ba0 + 5edf51c commit bba0093
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 39 deletions.
10 changes: 10 additions & 0 deletions src/java/com/cabecinha84/zelcashui/AppLock.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.vaklinov.zcashui.Log;
import com.vaklinov.zcashui.OSUtil;
import com.vaklinov.zcashui.ZCashClientCaller;


public class AppLock {
Expand Down Expand Up @@ -40,6 +41,15 @@ public static void unlock() {
lock.release();
channel.close();
f.delete();
try {
//if daemon is running for any reason we try to stop it here because wallet is closing.
ZCashClientCaller initialClientCallerA = new ZCashClientCaller(OSUtil.getProgramDirectory());
initialClientCallerA.stopDaemon();
}
catch (Exception ex) {
Log.warning("Error stopping daemon due to: {0} {1}",
ex.getClass().getName(), ex.getMessage());
}
}
} catch(IOException e) {
Log.warning("Error ounlocking wallet lock due to: {0} {1}",
Expand Down
12 changes: 3 additions & 9 deletions src/java/com/cabecinha84/zelcashui/ZelCashUIEditDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ public void actionPerformed(ActionEvent e)
tierThreeColor.setBackground(color3);
textColorTextField.setForeground(colorText);
messageSentTextField.setForeground(colorMessageSent);
messageReceivedTextField.setForeground(colorMessageReceived);
ZelCashUIEditDialog.this.saveZelCashUISettings();
messageReceivedTextField.setForeground(colorMessageReceived);
saveSettings();
whiteThemeButton.setSelected(false);
whiteThemeButton.setFocusable(false);
Expand Down Expand Up @@ -291,8 +290,7 @@ public void actionPerformed(ActionEvent e)
tierThreeColor.setBackground(color3);
textColorTextField.setForeground(colorText);
messageSentTextField.setForeground(colorMessageSent);
messageReceivedTextField.setForeground(colorMessageReceived);
ZelCashUIEditDialog.this.saveZelCashUISettings();
messageReceivedTextField.setForeground(colorMessageReceived);
saveSettings();
orangeThemeButton.setSelected(false);
orangeThemeButton.setFocusable(false);
Expand Down Expand Up @@ -321,8 +319,7 @@ public void actionPerformed(ActionEvent e)
tierThreeColor.setBackground(color3);
textColorTextField.setForeground(colorText);
messageSentTextField.setForeground(colorMessageSent);
messageReceivedTextField.setForeground(colorMessageReceived);
ZelCashUIEditDialog.this.saveZelCashUISettings();
messageReceivedTextField.setForeground(colorMessageReceived);
saveSettings();
greenThemeButton.setSelected(false);
greenThemeButton.setFocusable(false);
Expand Down Expand Up @@ -352,7 +349,6 @@ public void actionPerformed(ActionEvent e)
textColorTextField.setForeground(colorText);
messageSentTextField.setForeground(colorMessageSent);
messageReceivedTextField.setForeground(colorMessageReceived);
ZelCashUIEditDialog.this.saveZelCashUISettings();
saveSettings();
redThemeButton.setSelected(false);
redThemeButton.setFocusable(false);
Expand Down Expand Up @@ -382,7 +378,6 @@ public void actionPerformed(ActionEvent e)
textColorTextField.setForeground(colorText);
messageSentTextField.setForeground(colorMessageSent);
messageReceivedTextField.setForeground(colorMessageReceived);
ZelCashUIEditDialog.this.saveZelCashUISettings();
saveSettings();
blueThemeButton.setSelected(false);
blueThemeButton.setFocusable(false);
Expand Down Expand Up @@ -412,7 +407,6 @@ public void actionPerformed(ActionEvent e)
textColorTextField.setForeground(colorText);
messageSentTextField.setForeground(colorMessageSent);
messageReceivedTextField.setForeground(colorMessageReceived);
ZelCashUIEditDialog.this.saveZelCashUISettings();
saveSettings();
greyThemeButton.setSelected(false);
greyThemeButton.setFocusable(false);
Expand Down
4 changes: 2 additions & 2 deletions src/java/com/vaklinov/zcashui/StartupProgressDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class StartupProgressDialog extends ZelCashJFrame {


private static final int POLL_PERIOD = 1500;
private static final int POLL_PERIOD = 2000;
private static final int STARTUP_ERROR_CODE = -28;

private BorderLayout borderLayout1 = new BorderLayout();
Expand Down Expand Up @@ -111,7 +111,7 @@ public void waitForStartup() throws IOException,
}

final Process daemonProcess =
shouldStartZCashd ? clientCaller.startDaemon() : null;
shouldStartZCashd ? clientCaller.startDaemon(false) : null;

Thread.sleep(POLL_PERIOD); // just a little extra

Expand Down
16 changes: 14 additions & 2 deletions src/java/com/vaklinov/zcashui/ZCashClientCaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,31 @@ public ZCashClientCaller(String installDir)
}


public synchronized Process startDaemon()
public synchronized Process startDaemon(boolean reindex)
throws IOException, InterruptedException
{
String exportDir = OSUtil.getUserHomeDirectory().getCanonicalPath();

if (reindex == true) {
CommandExecutor starter = new CommandExecutor(
new String[]
{
zcashd.getCanonicalPath(),
"-exportdir=" + wrapStringParameter(exportDir),
"-reindex"
});

return starter.startChildProcess();
} else {
CommandExecutor starter = new CommandExecutor(
new String[]
{
zcashd.getCanonicalPath(),
"-exportdir=" + wrapStringParameter(exportDir)
});

return starter.startChildProcess();
}

}


Expand Down
Loading

0 comments on commit bba0093

Please sign in to comment.