Electroneum
Loading...
Searching...
No Matches
push_core_event_visitor< t_test_class > Struct Template Reference

#include <chaingen.h>

Inheritance diagram for push_core_event_visitor< t_test_class >:
Collaboration diagram for push_core_event_visitor< t_test_class >:

Public Member Functions

 push_core_event_visitor (cryptonote::core &c, const std::vector< test_event_entry > &events, t_test_class &validator)
void event_index (size_t ev_index)
bool operator() (const event_replay_settings &settings)
bool operator() (const event_visitor_settings &settings)
bool operator() (const cryptonote::transaction &tx) const
bool operator() (const std::vector< cryptonote::transaction > &txs) const
bool operator() (const cryptonote::block &b) const
bool operator() (const callback_entry &cb) const
bool operator() (const cryptonote::account_base &ab) const
bool operator() (const serialized_block &sr_block) const
bool operator() (const serialized_transaction &sr_tx) const

Detailed Description

template<class t_test_class>
struct push_core_event_visitor< t_test_class >

Definition at line 499 of file chaingen.h.

Constructor & Destructor Documentation

◆ push_core_event_visitor()

template<class t_test_class>
push_core_event_visitor< t_test_class >::push_core_event_visitor ( cryptonote::core & c,
const std::vector< test_event_entry > & events,
t_test_class & validator )
inline

Definition at line 510 of file chaingen.h.

511 : m_c(c)
512 , m_events(events)
513 , m_validator(validator)
514 , m_ev_index(0)
515 , m_txs_keeped_by_block(false)
516 {
517 }

Member Function Documentation

◆ event_index()

template<class t_test_class>
void push_core_event_visitor< t_test_class >::event_index ( size_t ev_index)
inline

Definition at line 519 of file chaingen.h.

520 {
521 m_ev_index = ev_index;
522 }
Here is the caller graph for this function:

◆ operator()() [1/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const callback_entry & cb) const
inline

Definition at line 594 of file chaingen.h.

595 {
596 log_event(std::string("callback_entry ") + cb.callback_name);
597 return m_validator.verify(cb.callback_name, m_c, m_ev_index, m_events);
598 }

◆ operator()() [2/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const cryptonote::account_base & ab) const
inline

Definition at line 600 of file chaingen.h.

601 {
602 log_event("cryptonote::account_base");
603 return true;
604 }

◆ operator()() [3/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const cryptonote::block & b) const
inline

Definition at line 575 of file chaingen.h.

576 {
577 log_event("cryptonote::block");
578
582 if (m_c.prepare_handle_incoming_blocks(std::vector<cryptonote::block_complete_entry>(1, {bd, {}}), pblocks))
583 {
584 m_c.handle_incoming_block(bd, &b, bvc);
585 m_c.cleanup_handle_incoming_blocks();
586 }
587 else
588 bvc.m_verification_failed = true;
589 bool r = m_validator.check_block_verification_context(bvc, m_ev_index, b);
590 CHECK_AND_NO_ASSERT_MES(r, false, "block verification context check failed");
591 return r;
592 }
#define AUTO_VAL_INIT(v)
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message)

◆ operator()() [4/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const cryptonote::transaction & tx) const
inline

Definition at line 542 of file chaingen.h.

543 {
544 log_event("cryptonote::transaction");
545
547 size_t pool_size = m_c.get_pool_transactions_count();
548 m_c.handle_incoming_tx(t_serializable_object_to_blob(tx), tvc, m_txs_keeped_by_block, false, false);
549 bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
550 bool r = m_validator.check_tx_verification_context(tvc, tx_added, m_ev_index, tx);
551 CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
552 return true;
553 }

◆ operator()() [5/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const event_replay_settings & settings)
inline

Definition at line 524 of file chaingen.h.

525 {
526 log_event("event_replay_settings");
527 return true;
528 }

◆ operator()() [6/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const event_visitor_settings & settings)
inline

Definition at line 530 of file chaingen.h.

531 {
532 log_event("event_visitor_settings");
533
535 {
536 m_txs_keeped_by_block = settings.txs_keeped_by_block;
537 }
538
539 return true;
540 }

◆ operator()() [7/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const serialized_block & sr_block) const
inline

Definition at line 606 of file chaingen.h.

607 {
608 log_event("serialized_block");
609
612 if (m_c.prepare_handle_incoming_blocks(std::vector<cryptonote::block_complete_entry>(1, {sr_block.data, {}}), pblocks))
613 {
614 m_c.handle_incoming_block(sr_block.data, NULL, bvc);
615 m_c.cleanup_handle_incoming_blocks();
616 }
617 else
618 bvc.m_verification_failed = true;
619
622 ss << sr_block.data;
625 if (!ss.good())
626 {
628 }
629 bool r = m_validator.check_block_verification_context(bvc, m_ev_index, blk);
630 CHECK_AND_NO_ASSERT_MES(r, false, "block verification context check failed");
631 return true;
632 }
bool serialize(Archive &ar, T &v)

◆ operator()() [8/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const serialized_transaction & sr_tx) const
inline

Definition at line 634 of file chaingen.h.

635 {
636 log_event("serialized_transaction");
637
639 size_t pool_size = m_c.get_pool_transactions_count();
640 m_c.handle_incoming_tx(sr_tx.data, tvc, m_txs_keeped_by_block, false, false);
641 bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
642
645 ss << sr_tx.data;
648 if (!ss.good())
649 {
651 }
652
653 bool r = m_validator.check_tx_verification_context(tvc, tx_added, m_ev_index, tx);
654 CHECK_AND_NO_ASSERT_MES(r, false, "transaction verification context check failed");
655 return true;
656 }
Here is the call graph for this function:

◆ operator()() [9/9]

template<class t_test_class>
bool push_core_event_visitor< t_test_class >::operator() ( const std::vector< cryptonote::transaction > & txs) const
inline

Definition at line 555 of file chaingen.h.

556 {
557 log_event("cryptonote::transaction");
558
562 for (const auto &tx: txs)
563 {
565 tvcs.push_back(tvc0);
566 }
567 size_t pool_size = m_c.get_pool_transactions_count();
568 m_c.handle_incoming_txs(tx_blobs, tvcs, m_txs_keeped_by_block, false, false);
569 size_t tx_added = m_c.get_pool_transactions_count() - pool_size;
570 bool r = m_validator.check_tx_verification_context_array(tvcs, tx_added, m_ev_index, txs);
571 CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
572 return true;
573 }

The documentation for this struct was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/tests/core_tests/chaingen.h