Skip to content

Commit 7b74d42

Browse files
committed
Mask invalida length fix
1 parent fbddacf commit 7b74d42

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

core/eth_node.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func (lf *Node) GetLogs(fromBlock, toBlock int64, addr string) ([]types.Log, err
2828
if err.Error() == QueryMoreThan10000Error ||
2929
strings.Contains(err.Error(), LogFilterLenError) {
3030
middle := (fromBlock + toBlock) / 2
31-
log.Info(fromBlock, middle, toBlock)
3231
bottomHalfLogs, err := lf.GetLogs(fromBlock, middle-1, addr)
3332
if err != nil {
3433
return []types.Log{}, err

engine/index.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func (e *Engine) init() {
4646
e.repo.AddSyncAdapter(obj)
4747
e.currentlySyncedTill = obj.GetLastSync()
4848
} else {
49-
e.currentlySyncedTill = kit.First(0).GetLastSync()
49+
// it will allow syncing from sratch of least synced adapter in batches
50+
e.currentlySyncedTill = e.repo.LoadLastAdapterSync()
5051
}
5152
// debt engine initialisation
5253
e.debtEng.Init()

repository/credit_session_snapshot.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ func (repo *Repository) ConvertToBalanceWithMask(balances []mainnet.DataTypesTok
2929
jsonBalance[tokenAddr] = &core.BalanceType{
3030
BI: (*core.BigInt)(token.Balance),
3131
F: utils.GetFloat64Decimal(token.Balance, tokenObj.Decimals),
32-
Linked: maskInBits[maskLen-i-1] == '1',
32+
}
33+
if maskLen-i-1 >= 0 {
34+
jsonBalance[tokenAddr].Linked = maskInBits[maskLen-i-1] == '1'
3335
}
3436
}
3537
}

repository/debt_db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (repo *Repository) LoadLastDebtSync() int64 {
2222

2323
func (repo *Repository) LoadLastAdapterSync() int64 {
2424
data := core.DebtSync{}
25-
query := "SELECT max(last_sync) as last_calculated_at FROM sync_adapters"
25+
query := "SELECT min(last_sync) as last_calculated_at FROM sync_adapters"
2626
err := repo.db.Raw(query).Find(&data).Error
2727
if err != nil {
2828
log.Fatal(err)

0 commit comments

Comments
 (0)