Skip to content

Commit 3b2b233

Browse files
committed
docs: importance of receipt's SERIAL id in DB
Signed-off-by: Alexis Asseman <alexis@semiotic.ai>
1 parent c4ac00c commit 3b2b233

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

migrations/20230912220523_tap_receipts.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE TABLE IF NOT EXISTS scalar_tap_receipts (
2-
id BIGSERIAL PRIMARY KEY,
2+
id BIGSERIAL PRIMARY KEY, -- id being SERIAL is important for the function of tap-agent
33
allocation_id CHAR(40) NOT NULL,
44
sender_address CHAR(40) NOT NULL,
55
timestamp_ns NUMERIC(20) NOT NULL,

tap-agent/src/tap/sender_allocation_relationship.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ type TapManager = tap_core::tap_manager::Manager<
4343
#[derive(Default, Debug)]
4444
struct UnaggregatedFees {
4545
pub value: u128,
46+
/// The ID of the last receipt value added to the unaggregated fees value.
47+
/// This is used to make sure we don't process the same receipt twice. Relies on the fact that
48+
/// the receipts IDs are SERIAL in the database.
4649
pub last_id: u64,
4750
}
4851

0 commit comments

Comments
 (0)