Skip to content

Commit 2c37dbd

Browse files
committed
fix(tap-agent): fix db insertions for collection-id
1 parent b812254 commit 2c37dbd

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

crates/service/src/tap/receipt_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl InnerContext {
200200
) SELECT * FROM UNNEST(
201201
$1::CHAR(40)[],
202202
$2::BYTEA[],
203-
$3::CHAR(40)[],
203+
$3::CHAR(64)[],
204204
$4::CHAR(40)[],
205205
$5::CHAR(40)[],
206206
$6::CHAR(40)[],

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -814,17 +814,23 @@ impl State {
814814
.expect("should be able to fetch pending V2 receipts from the database");
815815

816816
for row in receipts_signer_collections_in_db {
817-
let collection_ids = row
818-
.collection_ids
819-
.expect("all receipts V2 should have a collection_id")
820-
.iter()
821-
.map(|collection_id| {
822-
AllocationId::Horizon(
823-
CollectionId::from_str(collection_id)
824-
.expect("collection_id should be a valid collection ID"),
825-
)
826-
})
827-
.collect::<HashSet<_>>();
817+
let collection_ids =
818+
row.collection_ids
819+
.expect("all receipts V2 should have a collection_id")
820+
.iter()
821+
.map(|collection_id| {
822+
let trimmed = collection_id.trim();
823+
let hex_str = if let Some(stripped) = trimmed.strip_prefix("0x") {
824+
stripped
825+
} else {
826+
trimmed
827+
};
828+
829+
AllocationId::Horizon(CollectionId::from_str(hex_str).unwrap_or_else(|e| {
830+
panic!("Invalid collection_id '{collection_id}': {e}")
831+
}))
832+
})
833+
.collect::<HashSet<_>>();
828834
let signer_id = Address::from_str(&row.signer_address)
829835
.expect("signer_address should be a valid address");
830836
let sender_id = self

0 commit comments

Comments
 (0)