Skip to content

Commit

Permalink
fix(db): fix compound transaction_id_index (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
grtlr authored Jun 15, 2022
1 parent d28c946 commit afc9dbb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/db/collections/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ impl MongoDb {
.keys(doc! { "block.payload.transaction_id": 1, "metadata.inclusion_state": 1 })
.options(
IndexOptions::builder()
.unique(true)
// There can be multiple blocks that have the same transaction id and a _conflicting_
// inclusion state.
.unique(false)
.name("transaction_id_index".to_string())
.partial_filter_expression(doc! { "block.payload.transaction_id": { "$exists": true } })
.build(),
Expand Down

0 comments on commit afc9dbb

Please sign in to comment.