@@ -1316,7 +1316,6 @@ def GetStake(self, account, args=None):
13161316 # Limit stake to maximum available amount minus 10 (for transaction fees)
13171317 if stake > account .balance - 10 :
13181318 stake = account .balance - 10
1319- #end if
13201319
13211320 pool_version = self .GetVersionFromCodeHash (account .codeHash )
13221321 is_single_nominator = pool_version is not None and 'spool' in pool_version
@@ -1331,9 +1330,10 @@ def GetStake(self, account, args=None):
13311330 self .local .add_log ("Wrong stakePercent value. Using default stake." , "warning" )
13321331 elif len (vconfig .validators ) == 0 :
13331332 stake = int (account .balance * sp / 2 )
1333+ if stake < config17 ["minStake" ]: # not enough funds to divide them by 2
1334+ stake = int (account .balance * sp )
13341335 elif len (vconfig .validators ) > 0 :
13351336 stake = int (account .balance * sp )
1336- #end if
13371337
13381338 # Check if we have enough coins
13391339 if stake > config17 ["maxStake" ]:
@@ -1348,10 +1348,8 @@ def GetStake(self, account, args=None):
13481348 text = "Don't have enough coins. stake: {stake}, account balance: {balance}" .format (stake = stake , balance = account .balance )
13491349 # self.local.add_log(text, "error")
13501350 raise Exception (text )
1351- #end if
13521351
13531352 return stake
1354- #end define
13551353
13561354 def GetMaxFactor (self ):
13571355 # Either use defined maxFactor, or set maximal allowed by config17
0 commit comments