167 { try {
168 const auto pre_block_20_time = set_now("2022-04-04", "04:44:44.450");
172
173 using trx_deque = sysio::chain::deque< std::tuple< chain::transaction_trace_ptr, packed_transaction_ptr > >;
174
178 auto trace = make_transaction_trace( trx,
bn, bs_ptr);
179 trx_pairs.push_back(std::tuple(trace, trx));
180 status.signal_applied_transaction(trace, trx);
181 };
182
183 trx_deque trx_pairs_20;
184
185
186 status.signal_block_start(
bn);
188
189 add(trx_pairs_20, no_bs);
190 add(trx_pairs_20, no_bs);
191 add(trx_pairs_20, no_bs);
192 add(trx_pairs_20, no_bs);
193
194 auto cs = status.get_chain_state();
196 BOOST_TEST(!std::get<0>(trx_pairs_20[0])->producer_block_id.has_value());
200
201 using op_ts = std::optional<sysio::chain_apis::trx_finality_status_processing::trx_state>;
202
203 op_ts ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
204 BOOST_REQUIRE(ts);
207 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
208 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
209
210 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
211 BOOST_REQUIRE(ts);
214 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
215 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
216
217 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
218 BOOST_REQUIRE(ts);
221 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
222 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
223
224 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
225 BOOST_REQUIRE(ts);
228 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
229 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
230
231
232 trx_deque hold_pairs;
233 std::vector<chain::packed_transaction_ptr> holds;
234 hold_pairs.push_back(trx_pairs_20[2]);
235 hold_pairs.push_back(trx_pairs_20[3]);
236 trx_pairs_20.pop_back();
237 trx_pairs_20.pop_back();
238
239
240
242 status.signal_block_start(
bn);
243
244 for (const auto& trx_tuple : trx_pairs_20) {
245 const auto& trace = std::get<0>(trx_tuple);
246 const auto& txn = std::get<1>(trx_tuple);
247
248 trace->producer_block_id = bs_20->id;
249 trace->block_time = bs_20->block->timestamp;
250
251 status.signal_applied_transaction(trace, txn);
252 }
253
254
255 const auto block_20_time = set_now("2022-04-04", "04:44:44.500");
256 add(trx_pairs_20, bs_20);
257 add(trx_pairs_20, bs_20);
258 status.signal_accepted_block(bs_20);
259
260
261 cs = status.get_chain_state();
262 BOOST_CHECK(
cs.head_id == bs_20->id);
263 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_20[0])->producer_block_id);
264 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_20[1])->producer_block_id);
265 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_20[2])->producer_block_id);
266 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_20[3])->producer_block_id);
267 BOOST_CHECK(
cs.head_block_timestamp == bs_20->block->timestamp);
269 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_20->id);
270
271 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
272 BOOST_REQUIRE(ts);
273 BOOST_CHECK(ts->block_id == bs_20->id);
274 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
275 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
276 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
277
278 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
279 BOOST_REQUIRE(ts);
280 BOOST_CHECK(ts->block_id == bs_20->id);
281 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
282 BOOST_CHECK(
fc::time_point_sec(ts->expiration) == (std::get<1>(trx_pairs_20[1])->expiration()));
283 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
284 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
285
286 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
287 BOOST_REQUIRE(ts);
288 BOOST_CHECK(ts->block_id == bs_20->id);
289 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
290 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
291 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
292
293 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
294 BOOST_REQUIRE(ts);
295 BOOST_CHECK(ts->block_id == bs_20->id);
296 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
297 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
298 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
299
300 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
301 BOOST_REQUIRE(ts);
304 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
305 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
306
307 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
308 BOOST_REQUIRE(ts);
311 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
312 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
313
314
315
316
317 const auto block_21_time = set_now("2022-04-04", "04:44:45.000");
318 trx_deque trx_pairs_21;
321 status.signal_block_start(
bn);
323
324 add(trx_pairs_21, bs_21);
325 status.signal_accepted_block(bs_21);
326
327 cs = status.get_chain_state();
328 BOOST_CHECK(
cs.head_id == bs_21->id);
329 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_21[0])->producer_block_id);
330 BOOST_CHECK(
cs.head_block_timestamp == bs_21->block->timestamp);
332 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_20->id);
333
334 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
335 BOOST_REQUIRE(ts);
336 BOOST_CHECK(ts->block_id == bs_20->id);
337 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
338 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
339 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
340
341 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
342 BOOST_REQUIRE(ts);
343 BOOST_CHECK(ts->block_id == bs_20->id);
344 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
345 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
346 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
347
348 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
349 BOOST_REQUIRE(ts);
350 BOOST_CHECK(ts->block_id == bs_20->id);
351 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
352 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
353 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
354
355 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
356 BOOST_REQUIRE(ts);
357 BOOST_CHECK(ts->block_id == bs_20->id);
358 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
359 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
360 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
361
362 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
363 BOOST_REQUIRE(ts);
366 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
367 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
368
369 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
370 BOOST_REQUIRE(ts);
373 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
374 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
375
376 ts = status.get_trx_state(std::get<1>(trx_pairs_21[0])->id());
377 BOOST_REQUIRE(ts);
378 BOOST_CHECK(ts->block_id == bs_21->id);
379 BOOST_CHECK(ts->block_timestamp == bs_21->block->timestamp);
380 BOOST_CHECK_EQUAL(std::string(ts->received), block_21_time);
381 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
382
383
384
385
386 const auto block_22_time = set_now("2022-04-04", "04:44:45.500");
387 trx_deque trx_pairs_22;
389
391 status.signal_block_start(
bn);
392
393 add(trx_pairs_22, bs_22);
394 status.signal_accepted_block(bs_22);
395
396 cs = status.get_chain_state();
397 BOOST_CHECK(
cs.head_id == bs_22->id);
398 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_22[0])->producer_block_id);
399 BOOST_CHECK(
cs.head_block_timestamp == bs_22->block->timestamp);
401 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_20->id);
402
403
404 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
405 BOOST_REQUIRE(ts);
406 BOOST_CHECK(ts->block_id == bs_20->id);
407 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
408 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
409 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
410
411 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
412 BOOST_REQUIRE(ts);
413 BOOST_CHECK(ts->block_id == bs_20->id);
414 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
415 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
416 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
417
418 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
419 BOOST_REQUIRE(ts);
420 BOOST_CHECK(ts->block_id == bs_20->id);
421 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
422 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
423 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
424
425 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
426 BOOST_REQUIRE(ts);
427 BOOST_CHECK(ts->block_id == bs_20->id);
428 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
429 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
430 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
431
432 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
433 BOOST_REQUIRE(ts);
436 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
437 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
438
439 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
440 BOOST_REQUIRE(ts);
443 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
444 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
445
446 ts = status.get_trx_state(std::get<1>(trx_pairs_21[0])->id());
447 BOOST_REQUIRE(ts);
448 BOOST_CHECK(ts->block_id == bs_21->id);
449 BOOST_CHECK(ts->block_timestamp == bs_21->block->timestamp);
450 BOOST_CHECK_EQUAL(std::string(ts->received), block_21_time);
451 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
452
453 ts = status.get_trx_state(std::get<1>(trx_pairs_22[0])->id());
454 BOOST_REQUIRE(ts);
455 BOOST_CHECK(ts->block_id == bs_22->id);
456 BOOST_CHECK(ts->block_timestamp == bs_22->block->timestamp);
457 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_time);
458 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
459
460
461
462
463
464 const auto block_22_alt_time = set_now("2022-04-04", "04:44:46.000");
465 trx_deque trx_pairs_22_alt;
467
469 status.signal_block_start(
bn);
470
471 add(trx_pairs_22_alt, bs_22_alt);
472 status.signal_accepted_block(bs_22_alt);
473
474 cs = status.get_chain_state();
475 BOOST_CHECK(
cs.head_id == bs_22_alt->id);
476 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_22_alt[0])->producer_block_id);
477 BOOST_CHECK(
cs.head_block_timestamp == bs_22_alt->block->timestamp);
479 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_20->id);
480
481
482 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
483 BOOST_REQUIRE(ts);
484 BOOST_CHECK(ts->block_id == bs_20->id);
485 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
486 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
487 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
488
489 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
490 BOOST_REQUIRE(ts);
491 BOOST_CHECK(ts->block_id == bs_20->id);
492 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
493 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
494 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
495
496 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
497 BOOST_REQUIRE(ts);
498 BOOST_CHECK(ts->block_id == bs_20->id);
499 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
500 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
501 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
502
503 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
504 BOOST_REQUIRE(ts);
505 BOOST_CHECK(ts->block_id == bs_20->id);
506 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
507 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
508 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
509
510 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
511 BOOST_REQUIRE(ts);
514 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
515 BOOST_CHECK_EQUAL(ts->status, "FAILED");
516
517 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
518 BOOST_REQUIRE(ts);
521 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
522 BOOST_CHECK_EQUAL(ts->status, "FAILED");
523
524 ts = status.get_trx_state(std::get<1>(trx_pairs_21[0])->id());
525 BOOST_REQUIRE(ts);
526 BOOST_CHECK(ts->block_id == bs_21->id);
527 BOOST_CHECK(ts->block_timestamp == bs_21->block->timestamp);
528 BOOST_CHECK_EQUAL(std::string(ts->received), block_21_time);
529 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
530
531 ts = status.get_trx_state(std::get<1>(trx_pairs_22[0])->id());
532 BOOST_REQUIRE(ts);
533 BOOST_CHECK(ts->block_id == bs_22->id);
534 BOOST_CHECK(ts->block_timestamp == bs_22->block->timestamp);
535 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_time);
536 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
537
538 ts = status.get_trx_state(std::get<1>(trx_pairs_22_alt[0])->id());
539 BOOST_REQUIRE(ts);
540 BOOST_CHECK(ts->block_id == bs_22_alt->id);
541 BOOST_CHECK(ts->block_timestamp == bs_22_alt->block->timestamp);
542 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_alt_time);
543 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
544
545
546
547
548
549 const auto block_19_time = set_now("2022-04-04", "04:44:47.000");
550 trx_deque trx_pairs_19;
552
554 status.signal_block_start(
bn);
555
556 add(trx_pairs_19, bs_19);
557 status.signal_accepted_block(bs_19);
558
559 cs = status.get_chain_state();
560 BOOST_CHECK(
cs.head_id == bs_19->id);
561 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_19[0])->producer_block_id);
562 BOOST_CHECK(
cs.head_block_timestamp == bs_19->block->timestamp);
564 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_19->id);
565
566
567 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
568 BOOST_REQUIRE(ts);
569 BOOST_CHECK(ts->block_id == bs_20->id);
570 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
571 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
572 BOOST_CHECK_EQUAL(ts->status, "FAILED");
573
574 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
575 BOOST_REQUIRE(ts);
576 BOOST_CHECK(ts->block_id == bs_20->id);
577 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
578 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
579 BOOST_CHECK_EQUAL(ts->status, "FAILED");
580
581 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
582 BOOST_REQUIRE(ts);
583 BOOST_CHECK(ts->block_id == bs_20->id);
584 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
585 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
586 BOOST_CHECK_EQUAL(ts->status, "FAILED");
587
588 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
589 BOOST_REQUIRE(ts);
590 BOOST_CHECK(ts->block_id == bs_20->id);
591 BOOST_CHECK(ts->block_timestamp == bs_20->block->timestamp);
592 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
593 BOOST_CHECK_EQUAL(ts->status, "FAILED");
594
595 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
596 BOOST_REQUIRE(ts);
599 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
600 BOOST_CHECK_EQUAL(ts->status, "FAILED");
601
602 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
603 BOOST_REQUIRE(ts);
606 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
607 BOOST_CHECK_EQUAL(ts->status, "FAILED");
608
609 ts = status.get_trx_state(std::get<1>(trx_pairs_21[0])->id());
610 BOOST_REQUIRE(ts);
611 BOOST_CHECK(ts->block_id == bs_21->id);
612 BOOST_CHECK(ts->block_timestamp == bs_21->block->timestamp);
613 BOOST_CHECK_EQUAL(std::string(ts->received), block_21_time);
614 BOOST_CHECK_EQUAL(ts->status, "FAILED");
615
617 ts = status.get_trx_state(std::get<1>(trx_pairs_22[0])->id());
618 BOOST_REQUIRE(ts);
619 BOOST_CHECK(ts->block_id == bs_22->id);
620 BOOST_CHECK(ts->block_timestamp == bs_22->block->timestamp);
621 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_time);
622 BOOST_CHECK_EQUAL(ts->status, "FAILED");
623
624 ts = status.get_trx_state(std::get<1>(trx_pairs_22_alt[0])->id());
625 BOOST_REQUIRE(ts);
626 BOOST_CHECK(ts->block_id == bs_22_alt->id);
627 BOOST_CHECK(ts->block_timestamp == bs_22_alt->block->timestamp);
628 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_alt_time);
629 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
630
631 ts = status.get_trx_state(std::get<1>(trx_pairs_19[0])->id());
632 BOOST_REQUIRE(ts);
633 BOOST_CHECK(ts->block_id == bs_19->id);
634 BOOST_CHECK(ts->block_timestamp == bs_19->block->timestamp);
635 BOOST_CHECK_EQUAL(std::string(ts->received), block_19_time);
636 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
637
638
639
640
641 const auto block_19_alt_time = set_now("2022-04-04", "04:44:44.000");
642 trx_deque trx_pairs_19_alt;
644 trx_pairs_19_alt.push_back(trx_pairs_19[0]);
645 trx_pairs_19_alt.push_back(trx_pairs_20[0]);
646 trx_pairs_19_alt.push_back(trx_pairs_20[1]);
647 trx_pairs_19_alt.push_back(trx_pairs_20[2]);
648 trx_pairs_19_alt.push_back(trx_pairs_20[3]);
649 trx_pairs_19_alt.push_back(hold_pairs[0]);
650
652
653 status.signal_block_start(
bn);
654
655 for (const auto& trx_tuple : trx_pairs_19_alt) {
656 const auto& trace = std::get<0>(trx_tuple);
657 const auto& txn = std::get<1>(trx_tuple);
658
659 trace->producer_block_id = bs_19_alt->id;
660 trace->block_time = bs_19_alt->block->timestamp;
661
662 status.signal_applied_transaction(trace, txn);
663 }
664
665 status.signal_accepted_block(bs_19_alt);
666
667 cs = status.get_chain_state();
668 BOOST_CHECK(
cs.head_id == bs_19_alt->id);
669 BOOST_CHECK(
cs.head_id == *std::get<0>(trx_pairs_19[0])->producer_block_id);
670 BOOST_CHECK(
cs.head_block_timestamp == bs_19_alt->block->timestamp);
672 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_19_alt->id);
673
674
675 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
676 BOOST_REQUIRE(ts);
677 BOOST_CHECK(ts->block_id == bs_19_alt->id);
678 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
679 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
680 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
681
682 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
683 BOOST_REQUIRE(ts);
684 BOOST_CHECK(ts->block_id == bs_19_alt->id);
685 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
686 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
687 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
688
689 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
690 BOOST_REQUIRE(ts);
691 BOOST_CHECK(ts->block_id == bs_19_alt->id);
692 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
693 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
694 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
695
696 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
697 BOOST_REQUIRE(ts);
698 BOOST_CHECK(ts->block_id == bs_19_alt->id);
699 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
700 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
701 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
702
703 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
704 BOOST_REQUIRE(ts);
705 BOOST_CHECK(ts->block_id == bs_19_alt->id);
706 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
707 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
708 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
709
710 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
711 BOOST_REQUIRE(ts);
714 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
715 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
716
717 ts = status.get_trx_state(std::get<1>(trx_pairs_21[0])->id());
718 BOOST_REQUIRE(ts);
719 BOOST_CHECK(ts->block_id == bs_21->id);
720 BOOST_CHECK(ts->block_timestamp == bs_21->block->timestamp);
721 BOOST_CHECK_EQUAL(std::string(ts->received), block_21_time);
722 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
723
725 ts = status.get_trx_state(std::get<1>(trx_pairs_22[0])->id());
726 BOOST_REQUIRE(ts);
727 BOOST_CHECK(ts->block_id == bs_22->id);
728 BOOST_CHECK(ts->block_timestamp == bs_22->block->timestamp);
729 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_time);
730 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
731
732 ts = status.get_trx_state(std::get<1>(trx_pairs_22_alt[0])->id());
733 BOOST_REQUIRE(ts);
734 BOOST_CHECK(ts->block_id == bs_22_alt->id);
735 BOOST_CHECK(ts->block_timestamp == bs_22_alt->block->timestamp);
736 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_alt_time);
737 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
738
739 ts = status.get_trx_state(std::get<1>(trx_pairs_19[0])->id());
740 BOOST_REQUIRE(ts);
741 BOOST_CHECK(ts->block_id == bs_19_alt->id);
742 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
743 BOOST_CHECK_EQUAL(std::string(ts->received), block_19_time);
744 BOOST_CHECK_EQUAL(ts->status, "IN_BLOCK");
745
746
747
749
750 ts = status.get_trx_state(trx->id());
751 BOOST_REQUIRE(!ts);
752
753
754 status.signal_irreversible_block(bs_19_alt);
755
756 cs = status.get_chain_state();
757 BOOST_CHECK(
cs.head_id == bs_19_alt->id);
758 BOOST_CHECK(
cs.irr_id == bs_19_alt->id);
759 BOOST_CHECK(
cs.irr_block_timestamp == bs_19_alt->block->timestamp);
760 BOOST_CHECK(
cs.earliest_tracked_block_id == bs_19_alt->id);
761
762
763 ts = status.get_trx_state(std::get<1>(trx_pairs_20[0])->id());
764 BOOST_REQUIRE(ts);
765 BOOST_CHECK(ts->block_id == bs_19_alt->id);
766 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
767 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
768 BOOST_CHECK_EQUAL(ts->status, "IRREVERSIBLE");
769
770 ts = status.get_trx_state(std::get<1>(trx_pairs_20[1])->id());
771 BOOST_REQUIRE(ts);
772 BOOST_CHECK(ts->block_id == bs_19_alt->id);
773 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
774 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
775 BOOST_CHECK_EQUAL(ts->status, "IRREVERSIBLE");
776
777 ts = status.get_trx_state(std::get<1>(trx_pairs_20[2])->id());
778 BOOST_REQUIRE(ts);
779 BOOST_CHECK(ts->block_id == bs_19_alt->id);
780 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
781 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
782 BOOST_CHECK_EQUAL(ts->status, "IRREVERSIBLE");
783
784 ts = status.get_trx_state(std::get<1>(trx_pairs_20[3])->id());
785 BOOST_REQUIRE(ts);
786 BOOST_CHECK(ts->block_id == bs_19_alt->id);
787 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
788 BOOST_CHECK_EQUAL(std::string(ts->received), block_20_time);
789 BOOST_CHECK_EQUAL(ts->status, "IRREVERSIBLE");
790
791 ts = status.get_trx_state(std::get<1>(hold_pairs[0])->id());
792 BOOST_REQUIRE(ts);
793 BOOST_CHECK(ts->block_id == bs_19_alt->id);
794 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
795 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
796 BOOST_CHECK_EQUAL(ts->status, "IRREVERSIBLE");
797
798 ts = status.get_trx_state(std::get<1>(hold_pairs[1])->id());
799 BOOST_REQUIRE(ts);
802 BOOST_CHECK_EQUAL(std::string(ts->received), pre_block_20_time);
803 BOOST_CHECK_EQUAL(ts->status, "LOCALLY_APPLIED");
804
805 ts = status.get_trx_state(std::get<1>(trx_pairs_21[0])->id());
806 BOOST_REQUIRE(ts);
807 BOOST_CHECK(ts->block_id == bs_21->id);
808 BOOST_CHECK(ts->block_timestamp == bs_21->block->timestamp);
809 BOOST_CHECK_EQUAL(std::string(ts->received), block_21_time);
810 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
811
813 ts = status.get_trx_state(std::get<1>(trx_pairs_22[0])->id());
814 BOOST_REQUIRE(ts);
815 BOOST_CHECK(ts->block_id == bs_22->id);
816 BOOST_CHECK(ts->block_timestamp == bs_22->block->timestamp);
817 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_time);
818 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
819
820 ts = status.get_trx_state(std::get<1>(trx_pairs_22_alt[0])->id());
821 BOOST_REQUIRE(ts);
822 BOOST_CHECK(ts->block_id == bs_22_alt->id);
823 BOOST_CHECK(ts->block_timestamp == bs_22_alt->block->timestamp);
824 BOOST_CHECK_EQUAL(std::string(ts->received), block_22_alt_time);
825 BOOST_CHECK_EQUAL(ts->status, "FORKED_OUT");
826
827 ts = status.get_trx_state(std::get<1>(trx_pairs_19[0])->id());
828 BOOST_REQUIRE(ts);
829 BOOST_CHECK(ts->block_id == bs_19_alt->id);
830 BOOST_CHECK(ts->block_timestamp == bs_19_alt->block->timestamp);
831 BOOST_CHECK_EQUAL(std::string(ts->received), block_19_time);
832 BOOST_CHECK_EQUAL(ts->status, "IRREVERSIBLE");
833
logger & set_log_level(log_level e)
static logger get(const fc::string &name=DEFAULT_LOGGER)
std::shared_ptr< block_state > block_state_ptr
auto make_block_state(chain::block_id_type previous, uint32_t height, uint32_t slot, chain::name producer, std::vector< chain::packed_transaction > trxs)