Skip to content

Commit

Permalink
Showing 2 changed files with 28 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/main/java/btdex/ui/MiningPanel.java
Original file line number Diff line number Diff line change
@@ -751,6 +751,17 @@ public void actionPerformed(ActionEvent e) {
}

if(addCommitmentButton == e.getSource() || removeCommitmentButton == e.getSource()) {

MiningInfo miningInfo = BurstNode.getInstance().getMiningInfo();
if(miningInfo != null && miningInfo.getAverageCommitmentNQT() == 0) {
JOptionPane.showMessageDialog(getParent(),
tr("mine_commitment_not_available"),
tr(addCommitmentButton == e.getSource() ? "send_add_commitment" : "send_remove_commitment"),
JOptionPane.INFORMATION_MESSAGE);

return;
}

SendDialog dlg = new SendDialog((JFrame) SwingUtilities.getWindowAncestor(this),
null, addCommitmentButton == e.getSource() ? SendDialog.TYPE_ADD_COMMITMENT :
SendDialog.TYPE_REMOVE_COMMITMENT, null);
@@ -823,7 +834,7 @@ public void stateChanged(ChangeEvent e) {
if(path == null)
continue;

long freeSpace = path.getFreeSpace();
long freeSpace = path.getUsableSpace();

long toUseWithPlots = (freeSpace/100 * fractionToPlotSliders.get(i).getValue());
totalToPlot += toUseWithPlots;
@@ -890,7 +901,7 @@ private void startPlotting() {
if(path == null)
continue;

long freeSpace = path.getFreeSpace();
long freeSpace = path.getUsableSpace();

long toUseWithPlots = freeSpace/100 * fractionToPlotSliders.get(i).getValue();

@@ -939,10 +950,11 @@ public void run() {
long noncesFinished = 0;
addToConsole(PLOT_APP, "Plotting started for a total of " + formatSpace(totalToPlot) + ", this can be a long process...");

// Cache will use 45% of the free space, so we can have 2 (one moving and one plotting) and do not get a disk full
// Cache will use 40% of the free space, so we can have 2 (one moving and one plotting) and do not get a disk full
long noncesCache = 0;
if(ssdPath != null)
noncesCache = ssdPath.getFreeSpace() * 45 / 100 / BYTES_OF_A_NONCE;
if(ssdPath != null) {
noncesCache = ssdPath.getUsableSpace() * 40 / (100 * BYTES_OF_A_NONCE);
}

ArrayList<File> filesToPlot = new ArrayList<>();
filesToPlot.addAll(resumePlotFiles);
@@ -960,7 +972,7 @@ public void run() {
File fileBeingPlot = plot;

if(ssdPath != null) {
long freeCacheSpaceNow = ssdPath.getFreeSpace()/BYTES_OF_A_NONCE;
long freeCacheSpaceNow = ssdPath.getUsableSpace()/BYTES_OF_A_NONCE;
while(freeCacheSpaceNow < noncesCache) {
addToConsole(PLOT_APP, "Waiting for enough space on your cache disk...");
try {
@@ -973,7 +985,7 @@ public void run() {
addToConsole(PLOT_APP, "Stopped");
return;
}
freeCacheSpaceNow = ssdPath.getFreeSpace()/BYTES_OF_A_NONCE;
freeCacheSpaceNow = ssdPath.getUsableSpace()/BYTES_OF_A_NONCE;
}

noncesBeingPlot = Math.min(noncesCache, noncesInThisPlot);
@@ -1007,7 +1019,6 @@ public void run() {
// delete the file, because we will not be able to resume it
fileBeingPlot.delete();
}

break;
}
counter++;
@@ -1017,6 +1028,14 @@ public void run() {
noncesPlotted.set(noncesFinished + partial);
}
}
if(plotting && plotterProcess.exitValue()!=0) {
addToConsole(PLOT_APP, "Error, plotter exit code: " + plotterProcess.exitValue());
plotting = false;
break;
}
if(!plotting) {
break;
}
nonceStart += noncesBeingPlot;
noncesAlreadyPlotted += noncesBeingPlot;
noncesFinished += noncesBeingPlot;
1 change: 1 addition & 0 deletions src/main/resources/locale/i18n.btdex.properties
Original file line number Diff line number Diff line change
@@ -362,3 +362,4 @@ mine_ssd_remove = Do not use a cache folder
mine_select_disk = Select a disk folder to use
mine_remove_path = Remove from list, files are not deleted
mine_disk_full = Disk full
mine_commitment_not_available = Only after PoC+ is activated.

0 comments on commit 68b95f1

Please sign in to comment.