Skip to content

ReceiptStoreOperations.list_receipts_since returns wrong list #3

Description

@rohitmp

The list_receipts_since returns wrong list;
this is because, the WHERE clause instead of comparing the transaction_receipt::idx.gt(idx) is comparing the transaction_receipt::transaction_id.gt(id)

let transaction_receipt_models: Vec = match id {
Some(id) => query
.filter(transaction_receipt::transaction_id.gt(id)) // THIS IS THE BUG
.select(transaction_receipt::all_columns)
.load(self.conn)

Solution: i think we should get the transaction_receipt's idx for the give 'id'; and then filter the other receipts which have idx greater that the given idx.

I ran the splinter in a debug mode and can see the list fetched;
the idx of the last_seen_event is 10, but if we see the returned list, there are entries whose idx value are less than 10.

Screenshot from 2024-02-17 19-27-13

The side effect of this is. In the gridd, we keep getting below kind of errors. Since these events are already synced in the girdd.

DEBUG [gridd::event::db_handler] Received commit event: (50da128a8d3ced5168955e8ec4d33faadc407b2ed1f54e7261f70bf419e439db7b8abfca26a5ab913da63c54cc90db3be60d6daf8751c8f67a7a600fde9ed279, 3hFh4-6LGgZ::ssBB, #changes: 1)
INFO [gridd::event::db_handler] Received new commit 50da128a8d3ced5168955e8ec4d33faadc407b2ed1f54e7261f70bf419e439db7b8abfca26a5ab913da63c54cc90db3be60d6daf8751c8f67a7a600fde9ed279
ERROR [gridd::splinter::run] Event Error: Unique constraint violated
DEBUG [gridd::event::db_handler] Received commit event: (e43acc8e1c0c954ab9eb56e1ac18570f293e9913f8ceddf1177619dc9534460001e16b59cc8babca494786bca9ed37c4ee2e31340b088f9d2114f4fc05de20be, LE1hF-Yk0c5::gsBB, #changes: 2)
INFO [gridd::event::db_handler] Received new commit e43acc8e1c0c954ab9eb56e1ac18570f293e9913f8ceddf1177619dc9534460001e16b59cc8babca494786bca9ed37c4ee2e31340b088f9d2114f4fc05de20be
ERROR [gridd::splinter::run] Event Error: Unique constraint violated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions