Electroneum
Loading...
Searching...
No Matches
gen_tx_signatures_are_invalid Struct Reference

#include <tx_validation.h>

Inheritance diagram for gen_tx_signatures_are_invalid:
Collaboration diagram for gen_tx_signatures_are_invalid:

Public Member Functions

bool generate (std::vector< test_event_entry > &events) const
Public Member Functions inherited from get_tx_validation_base
 get_tx_validation_base ()
bool check_tx_verification_context (const cryptonote::tx_verification_context &tvc, bool tx_added, size_t event_idx, const cryptonote::transaction &)
bool check_block_verification_context (const cryptonote::block_verification_context &bvc, size_t event_idx, const cryptonote::block &)
bool mark_invalid_block (cryptonote::core &, size_t ev_index, const std::vector< test_event_entry > &)
bool mark_invalid_tx (cryptonote::core &, size_t ev_index, const std::vector< test_event_entry > &)
Public Member Functions inherited from test_chain_unit_base
void register_callback (const std::string &cb_name, verify_callback cb)
bool verify (const std::string &cb_name, cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
bool check_block_verification_context (const cryptonote::block_verification_context &bvc, size_t event_idx, const cryptonote::block &)
bool check_tx_verification_context (const cryptonote::tx_verification_context &tvc, bool, size_t, const cryptonote::transaction &)
bool check_tx_verification_context_array (const std::vector< cryptonote::tx_verification_context > &tvcs, size_t, size_t, const std::vector< cryptonote::transaction > &)

Additional Inherited Members

Public Types inherited from test_chain_unit_base
typedef boost::function< bool(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)> verify_callback
typedef std::map< std::string, verify_callbackcallbacks_map

Detailed Description

Definition at line 163 of file tx_validation.h.

Member Function Documentation

◆ generate()

bool gen_tx_signatures_are_invalid::generate ( std::vector< test_event_entry > & events) const

Definition at line 734 of file tx_validation.cpp.

735{
736 uint64_t ts_start = 1338224400;
737
738 GENERATE_ACCOUNT(miner_account);
739 MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
740 MAKE_NEXT_BLOCK(events, blk_1, blk_0, miner_account);
741 REWIND_BLOCKS(events, blk_1r, blk_1, miner_account);
742 MAKE_ACCOUNT(events, alice_account);
743 MAKE_ACCOUNT(events, bob_account);
744 MAKE_TX_LIST_START(events, txs_0, miner_account, bob_account, MK_COINS(1) + TESTS_DEFAULT_FEE, blk_1);
745 MAKE_TX_LIST(events, txs_0, miner_account, alice_account, MK_COINS(1) + TESTS_DEFAULT_FEE, blk_1);
746 MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1r, miner_account, txs_0);
747
748 MAKE_TX(events, tx_0, miner_account, miner_account, MK_COINS(60), blk_2);
749 events.pop_back();
750
751 MAKE_TX_MIX(events, tx_1, bob_account, miner_account, MK_COINS(1), 1, blk_2);
752 events.pop_back();
753
754 // Tx with nmix = 0 without signatures
755 DO_CALLBACK(events, "mark_invalid_tx");
756 blobdata sr_tx = t_serializable_object_to_blob(static_cast<transaction_prefix>(tx_0));
757 events.push_back(serialized_transaction(sr_tx));
758
759 // Tx with nmix = 0 have a few inputs, and not enough signatures
760 DO_CALLBACK(events, "mark_invalid_tx");
761 sr_tx = t_serializable_object_to_blob(tx_0);
762 sr_tx.resize(sr_tx.size() - sizeof(crypto::signature));
763 events.push_back(serialized_transaction(sr_tx));
764
765 // Tx with nmix = 0 have a few inputs, and too many signatures
766 DO_CALLBACK(events, "mark_invalid_tx");
767 sr_tx = t_serializable_object_to_blob(tx_0);
768 sr_tx.insert(sr_tx.end(), sr_tx.end() - sizeof(crypto::signature), sr_tx.end());
769 events.push_back(serialized_transaction(sr_tx));
770
771 // Tx with nmix = 1 without signatures
772 DO_CALLBACK(events, "mark_invalid_tx");
773 sr_tx = t_serializable_object_to_blob(static_cast<transaction_prefix>(tx_1));
774 events.push_back(serialized_transaction(sr_tx));
775
776 // Tx with nmix = 1 have not enough signatures
777 DO_CALLBACK(events, "mark_invalid_tx");
778 sr_tx = t_serializable_object_to_blob(tx_1);
779 sr_tx.resize(sr_tx.size() - sizeof(crypto::signature));
780 events.push_back(serialized_transaction(sr_tx));
781
782 // Tx with nmix = 1 have too many signatures
783 DO_CALLBACK(events, "mark_invalid_tx");
784 sr_tx = t_serializable_object_to_blob(tx_1);
785 sr_tx.insert(sr_tx.end(), sr_tx.end() - sizeof(crypto::signature), sr_tx.end());
786 events.push_back(serialized_transaction(sr_tx));
787
788 return true;
789}
#define MAKE_NEXT_BLOCK(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition chaingen.h:839
#define REWIND_BLOCKS(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition chaingen.h:890
#define MAKE_TX_LIST_START(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:935
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
Definition chaingen.h:833
serialized_object< cryptonote::transaction > serialized_transaction
Definition chaingen.h:108
#define MAKE_NEXT_BLOCK_TX_LIST(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST)
Definition chaingen.h:867
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition chaingen.h:820
#define MAKE_TX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:933
#define MK_COINS(amount)
Definition chaingen.h:1060
#define TESTS_DEFAULT_FEE
Definition chaingen.h:1061
#define MAKE_ACCOUNT(VEC_EVENTS, account)
Definition chaingen.h:815
#define MAKE_TX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:903
#define GENERATE_ACCOUNT(account)
Definition chaingen.h:801
#define MAKE_TX_MIX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
Definition chaingen.h:893
POD_CLASS signature
Definition crypto.h:108
std::string blobdata
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
unsigned __int64 uint64_t
Definition stdint.h:136
Here is the call graph for this function:

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