From 0d5e39a26d2d7d1a3811416cd4b9525d068dd6d7 Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Thu, 1 Feb 2018 19:16:46 -0500 Subject: [PATCH] Tighter tx check; comments; failing test in CI --- tests/tolstoy.rs | 4 ++-- tolstoy/src/tx_client.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/tolstoy.rs b/tests/tolstoy.rs index 2efbe542..b9fbc973 100644 --- a/tests/tolstoy.rs +++ b/tests/tolstoy.rs @@ -31,9 +31,9 @@ fn test_reader() { let txes = TxClient::all(&c).expect("bootstrap transactions"); - // Don't inspect the bootstrap, but we'd like to see it's there. + // Don't inspect the bootstrap transaction, but we'd like to see it's there. assert_eq!(1, txes.len()); - assert_eq!(76, txes[0].parts.len()); + assert_eq!(94, txes[0].parts.len()); let ids = conn.transact(&mut c, r#"[ [:db/add "s" :db/ident :foo/numba] diff --git a/tolstoy/src/tx_client.rs b/tolstoy/src/tx_client.rs index 1373146c..5c9103f0 100644 --- a/tolstoy/src/tx_client.rs +++ b/tolstoy/src/tx_client.rs @@ -96,7 +96,7 @@ impl TxReader for TxClient { let datom = datom_result?; // Datom represents a transaction. - if datom.a == entids::DB_TX_INSTANT { + if datom.a == entids::DB_TX_INSTANT && datom.tx == datom.e { // Does the Tx already exist in the map? That means we've inserted it // with an incomplete tx_instant; update it. if let Entry::Occupied(mut tx) = txes_by_tx.entry(datom.tx) { @@ -111,14 +111,14 @@ impl TxReader for TxClient { }); // Datom represents a transaction part. } else { - // Does the Tx for this part already exist in the map? - // Append this part to the parts list. let part = TxPart { e: datom.e, a: datom.a, v: datom.v, added: datom.added, }; + // Does the Tx for this part already exist in the map? + // Append this part to the parts list. if let Entry::Occupied(mut tx) = txes_by_tx.entry(datom.tx) { tx.get_mut().parts.push(part); continue;