aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests/chaingen.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2019-11-02 20:36:03 +0000
committerLee Clagett <code@leeclagett.com>2019-11-02 20:36:03 +0000
commit5d7ae2d2791c0244a221872a7ac62627abb81896 (patch)
tree137094b030f22157b6c9290a10ed32ef8d1b5d0e /tests/core_tests/chaingen.h
parentMerge pull request #6117 (diff)
downloadmonero-5d7ae2d2791c0244a221872a7ac62627abb81896.tar.xz
Adding support for hidden (anonymity) txpool
Diffstat (limited to 'tests/core_tests/chaingen.h')
-rw-r--r--tests/core_tests/chaingen.h44
1 files changed, 28 insertions, 16 deletions
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index b78640dc9..bc0e61365 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -53,6 +53,7 @@
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_core/cryptonote_core.h"
+#include "cryptonote_protocol/enums.h"
#include "cryptonote_basic/cryptonote_boost_serialization.h"
#include "misc_language.h"
@@ -108,17 +109,17 @@ typedef serialized_object<cryptonote::transaction> serialized_transaction;
struct event_visitor_settings
{
- int valid_mask;
- bool txs_keeped_by_block;
+ int mask;
enum settings
{
- set_txs_keeped_by_block = 1 << 0
+ set_txs_keeped_by_block = 1 << 0,
+ set_txs_do_not_relay = 1 << 1,
+ set_local_relay = 1 << 2
};
- event_visitor_settings(int a_valid_mask = 0, bool a_txs_keeped_by_block = false)
- : valid_mask(a_valid_mask)
- , txs_keeped_by_block(a_txs_keeped_by_block)
+ event_visitor_settings(int a_mask = 0)
+ : mask(a_mask)
{
}
@@ -128,8 +129,7 @@ private:
template<class Archive>
void serialize(Archive & ar, const unsigned int /*version*/)
{
- ar & valid_mask;
- ar & txs_keeped_by_block;
+ ar & mask;
}
};
@@ -503,7 +503,7 @@ private:
t_test_class& m_validator;
size_t m_ev_index;
- bool m_txs_keeped_by_block;
+ cryptonote::relay_method m_tx_relay;
public:
push_core_event_visitor(cryptonote::core& c, const std::vector<test_event_entry>& events, t_test_class& validator)
@@ -511,7 +511,7 @@ public:
, m_events(events)
, m_validator(validator)
, m_ev_index(0)
- , m_txs_keeped_by_block(false)
+ , m_tx_relay(cryptonote::relay_method::flood)
{
}
@@ -530,9 +530,21 @@ public:
{
log_event("event_visitor_settings");
- if (settings.valid_mask & event_visitor_settings::set_txs_keeped_by_block)
+ if (settings.mask & event_visitor_settings::set_txs_keeped_by_block)
{
- m_txs_keeped_by_block = settings.txs_keeped_by_block;
+ m_tx_relay = cryptonote::relay_method::block;
+ }
+ else if (settings.mask & event_visitor_settings::set_local_relay)
+ {
+ m_tx_relay = cryptonote::relay_method::local;
+ }
+ else if (settings.mask & event_visitor_settings::set_txs_do_not_relay)
+ {
+ m_tx_relay = cryptonote::relay_method::none;
+ }
+ else
+ {
+ m_tx_relay = cryptonote::relay_method::flood;
}
return true;
@@ -544,7 +556,7 @@ public:
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
size_t pool_size = m_c.get_pool_transactions_count();
- m_c.handle_incoming_tx({t_serializable_object_to_blob(tx), crypto::null_hash}, tvc, m_txs_keeped_by_block, false, false);
+ m_c.handle_incoming_tx({t_serializable_object_to_blob(tx), crypto::null_hash}, tvc, m_tx_relay, false);
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
bool r = m_validator.check_tx_verification_context(tvc, tx_added, m_ev_index, tx);
CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
@@ -564,7 +576,7 @@ public:
tvcs.push_back(tvc0);
}
size_t pool_size = m_c.get_pool_transactions_count();
- m_c.handle_incoming_txs(tx_blobs, tvcs, m_txs_keeped_by_block, false, false);
+ m_c.handle_incoming_txs(tx_blobs, tvcs, m_tx_relay, false);
size_t tx_added = m_c.get_pool_transactions_count() - pool_size;
bool r = m_validator.check_tx_verification_context_array(tvcs, tx_added, m_ev_index, txs);
CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
@@ -644,7 +656,7 @@ public:
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
size_t pool_size = m_c.get_pool_transactions_count();
- m_c.handle_incoming_tx(sr_tx.data, tvc, m_txs_keeped_by_block, false, false);
+ m_c.handle_incoming_tx(sr_tx.data, tvc, m_tx_relay, false);
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
cryptonote::transaction tx;
@@ -955,7 +967,7 @@ inline bool do_replay_file(const std::string& filename)
#define MAKE_MINER_TX_MANUALLY(TX, BLK) MAKE_MINER_TX_AND_KEY_MANUALLY(TX, BLK, 0)
-#define SET_EVENT_VISITOR_SETT(VEC_EVENTS, SETT, VAL) VEC_EVENTS.push_back(event_visitor_settings(SETT, VAL));
+#define SET_EVENT_VISITOR_SETT(VEC_EVENTS, SETT) VEC_EVENTS.push_back(event_visitor_settings(SETT));
#define GENERATE(filename, genclass) \
{ \