use *mine_random as default strategy

This commit is contained in:
Radu Ioan Fericean
2014-03-18 11:09:49 +02:00
parent e8393b9bcc
commit 5322063103

View File

@@ -67,7 +67,7 @@ func (sg *SharedGroup) GetBalancesByStrategy(myBalance *Balance, bc BalanceChain
}
strategy := STRATEGY_MINE_RANDOM
if sharingParameters != nil {
if sharingParameters != nil && sharingParameters.Strategy != "" {
strategy = sharingParameters.Strategy
}
switch strategy {
@@ -79,6 +79,11 @@ func (sg *SharedGroup) GetBalancesByStrategy(myBalance *Balance, bc BalanceChain
rbc := RandomBalanceChainSorter(bc)
(&rbc).Sort()
bc = BalanceChain(rbc)
default: // use mine random for anything else
strategy = STRATEGY_MINE_RANDOM
rbc := RandomBalanceChainSorter(bc)
(&rbc).Sort()
bc = BalanceChain(rbc)
}
if strings.HasPrefix(strategy, MINE_PREFIX) {
// find index of my balance