mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
improve deposit.GetCurrentConfirmation
This commit is contained in:
parent
0917b13b3f
commit
3eff1abba7
|
@ -369,8 +369,13 @@ func (s *Strategy) scanDepositHistory(ctx context.Context, asset string, duratio
|
|||
case types.DepositSuccess:
|
||||
logger.Infof("found pending -> success deposit: %+v", deposit)
|
||||
current, required := deposit.GetCurrentConfirmation()
|
||||
if required > 0 && deposit.UnlockConfirm > 0 && current < deposit.UnlockConfirm {
|
||||
logger.Infof("deposit %s unlock confirm %d is not reached, current: %d, required: %d, skip this round", deposit.TransactionID, deposit.UnlockConfirm, current, required)
|
||||
if deposit.UnlockConfirm > 0 {
|
||||
if current < deposit.UnlockConfirm {
|
||||
logger.Infof("deposit %s unlock confirm %d is not reached, current: %d, required: %d, skip this round", deposit.TransactionID, deposit.UnlockConfirm, current, required)
|
||||
continue
|
||||
}
|
||||
} else if required > 0 && current < required {
|
||||
logger.Infof("deposit %s confirm %d/%d is not reached", deposit.TransactionID, current, required)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,10 @@ func (d Deposit) GetCurrentConfirmation() (current int, required int) {
|
|||
}
|
||||
|
||||
strs := strings.Split(d.Confirmation, "/")
|
||||
if len(strs) < 2 {
|
||||
if len(strs) == 1 {
|
||||
current, _ = strconv.Atoi(strs[0])
|
||||
return current, 0
|
||||
} else if len(strs) < 2 {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user