Skip to content

Commit

Permalink
Fix: last id filter
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Jul 10, 2023
1 parent f2925c6 commit 752ae9c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/postgres/operation/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,19 @@ func (storage *Storage) OPG(address string, size, lastID int64) ([]operation.OPG
limit = 1000
)

if bcd.IsContractLazy(address) {
lastActionSet := false
if lastID > 0 {
op, err := storage.GetByID(lastID)
if err != nil {
if !storage.IsRecordNotFound(err) {
return nil, err
}
} else {
lastAction = op.Timestamp
lastActionSet = true
}
}
if !lastActionSet && bcd.IsContractLazy(address) {
if err := storage.DB.Model((*contract.Contract)(nil)).
Column("last_action").
Where("account_id = ?", accountID).
Expand Down

0 comments on commit 752ae9c

Please sign in to comment.