aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-05-30 21:12:44 +0200
committerRiccardo Spagni <ric@spagni.net>2017-05-30 21:12:44 +0200
commit545e2b003c6a4930e9f18e6d5696c2cd85a5cb22 (patch)
tree3c156bab193a4d1c01ef20a2764b4439f01e3699 /tests
parentMerge pull request #2015 (diff)
parentMove txpool to the database (diff)
downloadmonero-545e2b003c6a4930e9f18e6d5696c2cd85a5cb22.tar.xz
Merge pull request #1982
b52abd13 Move txpool to the database (moneromooo-monero)
Diffstat (limited to 'tests')
-rw-r--r--tests/core_proxy/core_proxy.h3
-rw-r--r--tests/core_tests/chaingen.h10
-rw-r--r--tests/unit_tests/ban.cpp3
-rw-r--r--tests/unit_tests/hardfork.cpp9
4 files changed, 23 insertions, 2 deletions
diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h
index 106c62f23..58645edb5 100644
--- a/tests/core_proxy/core_proxy.h
+++ b/tests/core_proxy/core_proxy.h
@@ -90,7 +90,8 @@ namespace tests
size_t get_block_sync_size() const { return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; }
virtual void on_transaction_relayed(const cryptonote::blobdata& tx) {}
bool get_testnet() const { return false; }
- bool get_pool_transaction(const crypto::hash& id, cryptonote::transaction& tx) const { return false; }
+ bool get_pool_transaction(const crypto::hash& id, cryptonote::blobdata& tx_blob) const { return false; }
+ bool pool_has_tx(const crypto::hash &txid) const { return false; }
bool get_blocks(uint64_t start_offset, size_t count, std::list<std::pair<cryptonote::blobdata, cryptonote::block>>& blocks, std::list<cryptonote::blobdata>& txs) const { return false; }
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<cryptonote::transaction>& txs, std::list<crypto::hash>& missed_txs) const { return false; }
bool get_block_by_hash(const crypto::hash &h, cryptonote::block &blk, bool *orphan = NULL) const { return false; }
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index eef10312d..add48eebe 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -472,6 +472,16 @@ inline bool do_replay_events(std::vector<test_event_entry>& events)
MERROR("Failed to init core");
return false;
}
+
+ // start with a clean pool
+ std::vector<crypto::hash> pool_txs;
+ if (!c.get_pool_transaction_hashes(pool_txs))
+ {
+ MERROR("Failed to flush txpool");
+ return false;
+ }
+ c.get_blockchain_storage().flush_txes_from_pool(std::list<crypto::hash>(pool_txs.begin(), pool_txs.end()));
+
t_test_class validator;
bool ret = replay_events_through_core<t_test_class>(c, events, validator);
c.deinit();
diff --git a/tests/unit_tests/ban.cpp b/tests/unit_tests/ban.cpp
index 595085d7d..9816adb94 100644
--- a/tests/unit_tests/ban.cpp
+++ b/tests/unit_tests/ban.cpp
@@ -65,7 +65,8 @@ public:
size_t get_block_sync_size() const { return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; }
virtual void on_transaction_relayed(const cryptonote::blobdata& tx) {}
bool get_testnet() const { return false; }
- bool get_pool_transaction(const crypto::hash& id, cryptonote::transaction& tx) const { return false; }
+ bool get_pool_transaction(const crypto::hash& id, cryptonote::blobdata& tx_blob) const { return false; }
+ bool pool_has_tx(const crypto::hash &txid) const { return false; }
bool get_blocks(uint64_t start_offset, size_t count, std::list<std::pair<cryptonote::blobdata, cryptonote::block>>& blocks, std::list<cryptonote::blobdata>& txs) const { return false; }
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<cryptonote::transaction>& txs, std::list<crypto::hash>& missed_txs) const { return false; }
bool get_block_by_hash(const crypto::hash &h, cryptonote::block &blk, bool *orphan = NULL) const { return false; }
diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp
index 08c4276c8..e29919e8f 100644
--- a/tests/unit_tests/hardfork.cpp
+++ b/tests/unit_tests/hardfork.cpp
@@ -112,6 +112,15 @@ public:
virtual bool is_read_only() const { return false; }
virtual std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> get_output_histogram(const std::vector<uint64_t> &amounts, bool unlocked, uint64_t recent_cutoff) const { return std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>>(); }
+ virtual void add_txpool_tx(const transaction &tx, const txpool_tx_meta_t& details) {}
+ virtual void update_txpool_tx(const crypto::hash &txid, const txpool_tx_meta_t& details) {}
+ virtual uint64_t get_txpool_tx_count() const { return 0; }
+ virtual bool txpool_has_tx(const crypto::hash &txid) const { return false; }
+ virtual void remove_txpool_tx(const crypto::hash& txid) {}
+ virtual txpool_tx_meta_t get_txpool_tx_meta(const crypto::hash& txid) const { return txpool_tx_meta_t(); }
+ virtual cryptonote::blobdata get_txpool_tx_blob(const crypto::hash& txid) const { return ""; }
+ virtual bool for_all_txpool_txes(std::function<bool(const crypto::hash&, const txpool_tx_meta_t&, const cryptonote::blobdata*)>, bool include_blob = false) const { return false; }
+
virtual void add_block( const block& blk
, const size_t& block_size
, const difficulty_type& cumulative_difficulty