-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
} | ||
|
||
// Mine at least 50,000 SC | ||
// acquire at least 50,000 SC | ||
desiredbalance := types.NewCurrency64(50000).Mul(types.SiacoinPrecision) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more concise is types.SiacoinPrecision.Mul64(50000)
log.Printf("[%v balanceMaintainer ERROR]: %v\n", j.siaDirectory, err) | ||
} | ||
if walletInfo.ConfirmedSiacoinBalance.Cmp(desiredBalance) < 0 { | ||
log.Printf("[%v balanceMaintainer INFO]: not enough currency, starting the miner\n", j.siaDirectory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be printed every 20s until enough currency is mined. Maybe check the current miner state and do nothing if it is already mining?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good call.
if !minerRunning { | ||
log.Printf("[%v balanceMaintainer INFO]: not enough currency, starting the miner\n", j.siaDirectory) | ||
minerRunning = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still calls /miner/start
if the miner is running. Better would be:
haveDesiredBalance := walletInfo.ConfirmedSiacoinBalanace.Cmp(desiredBalance) > 0
if !minerRunning && !haveDesiredBalance {
// log, start miner
} else if minerRunning && haveDesiredBalance {
// log, stop miner
}
it appears that this will stop the |
ok, I changed this so that if a |
d0597c0
to
70e851e
Compare
This PR has been rebased off the sia-ant refactor. It's much simpler now as well: |
if err != nil { | ||
log.Printf("[%v blockMining ERROR]: %v\n", j.siaDirectory, err) | ||
// If desiredBalance is zero, just return, leaving the miner running. | ||
runForever := desiredBalance.Cmp(types.ZeroCurrency) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I understand correctly, it's still possible to avoid mining entirely by not passing -miner
, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct. by not including miner in the Jobs
, the miner never gets run, regardless of DesiredCurrency
.
Based on feedback from @DavidVorick, balance maintainer is its own job again and is mutually exclusive with |
This PR adds a config option,
"DesiredCurrency": int (SC)
, which is input to abalanceMaintainer
job insia-ant
. This job will mine until theDesiredCurrency
amount exists in the wallet, after which point it stops the miner. If the wallet balance drops belowDesiredCurrency
,balanceMaintainer
will start the miner again. This should greatly reduce the performance impact of running several renters and hosts.