@@ -93,9 +93,12 @@ auto initObservers(std::shared_ptr<FairMstProcessor> mst_processor,
93
93
*/
94
94
template <typename T>
95
95
void check (T &t) {
96
- ASSERT_TRUE (std::get<0 >(t).validate ());
97
- ASSERT_TRUE (std::get<1 >(t).validate ());
98
- ASSERT_TRUE (std::get<2 >(t).validate ());
96
+ ASSERT_TRUE (std::get<0 >(t).validate ())
97
+ << " onStateUpdate" << std::get<0 >(t).reason ();
98
+ ASSERT_TRUE (std::get<1 >(t).validate ())
99
+ << " onPreparedBatches" << std::get<1 >(t).reason ();
100
+ ASSERT_TRUE (std::get<2 >(t).validate ())
101
+ << " onExpiredBatches" << std::get<2 >(t).reason ();
99
102
}
100
103
101
104
/* *
@@ -346,3 +349,28 @@ TEST_F(MstProcessorTest, receivedOutdatedState) {
346
349
EXPECT_FALSE (storage->batchInStorage (expired_batch));
347
350
check (observers);
348
351
}
352
+
353
+ /* *
354
+ * @given initialized mst processor with two incomplete transactions in the
355
+ * state
356
+ *
357
+ * @when one of them is received from another peer
358
+ *
359
+ * @then no observables are triggered
360
+ */
361
+ TEST_F (MstProcessorTest, receivedOneOfExistingTxs) {
362
+ const auto batch = addSignaturesFromKeyPairs (
363
+ makeTestBatch (txBuilder (1 , time_now, 2 )), 0 , makeKey ());
364
+ mst_processor->propagateBatch (batch);
365
+ mst_processor->propagateBatch (addSignaturesFromKeyPairs (
366
+ makeTestBatch (txBuilder (2 , time_now, 2 )), 0 , makeKey ()));
367
+
368
+ auto received_state = MstState::empty (getTestLogger (" MstState" ),
369
+ std::make_shared<TestCompleter>());
370
+ received_state += batch;
371
+ auto observers = initObservers (mst_processor, 0 , 0 , 0 );
372
+ shared_model::crypto::PublicKey another_peer_key (" another_pubkey" );
373
+ mst_processor->onNewState (another_peer_key, received_state);
374
+
375
+ check (observers);
376
+ }
0 commit comments