From 752ae9cb3816bae1557ae9f749ca06611360b638 Mon Sep 17 00:00:00 2001 From: Artem Date: Mon, 10 Jul 2023 17:34:06 +0100 Subject: [PATCH] Fix: last id filter --- internal/postgres/operation/storage.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/postgres/operation/storage.go b/internal/postgres/operation/storage.go index 19947335d..56d332196 100644 --- a/internal/postgres/operation/storage.go +++ b/internal/postgres/operation/storage.go @@ -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).