aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests/double_spend.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-12-26 10:21:21 +0200
committerRiccardo Spagni <ric@spagni.net>2015-12-26 10:23:17 +0200
commit95ceb715dc875823f56f930d12a08c349874ce19 (patch)
treec37d90d5085f3ae0e727490f5ca2700d678898e3 /tests/core_tests/double_spend.h
parentMerge pull request #564 (diff)
parenttests: fix various tests by using parameters better suited to monero (diff)
downloadmonero-95ceb715dc875823f56f930d12a08c349874ce19.tar.xz
Merge pull request #565
79beed2 tests: fix various tests by using parameters better suited to monero (moneromooo-monero) d0a8362 tests: fix some double spending tests (moneromooo-monero) 2358d0d tests: use 255 as a "too high" block version (moneromooo-monero) f33a88c blockchain: fix a few block addition bugs (moneromooo-monero) a9ff11c blockchain: fix an off by one error in unlocked time check (moneromooo-monero) f294be3 blockchain: reinstate double spending checks in check_tx_inputs (moneromooo-monero) 737b6d6 blockchain: make some flag twiddling code closer to the original (moneromooo-monero) 81cb0fc blockchain: fix bitflipping test with quantized block rewards (moneromooo-monero) 22ddf09 blockchain: add missing m_tx_pool.on_blockchain_dec (moneromooo-monero) d837c0c blockchain: fix switch to alternative blockchain for more than one block (moneromooo-monero) 5cec076 blockchain: add a missing validity check to rollback_blockchain_switching (moneromooo-monero) 3cabdb5 core: catch exceptions from get_output_key (moneromooo-monero) 5eef645 db: throw when given a non txout_to_key output to add (moneromooo-monero)
Diffstat (limited to 'tests/core_tests/double_spend.h')
-rw-r--r--tests/core_tests/double_spend.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/core_tests/double_spend.h b/tests/core_tests/double_spend.h
index 0a2e60575..467435598 100644
--- a/tests/core_tests/double_spend.h
+++ b/tests/core_tests/double_spend.h
@@ -32,13 +32,14 @@
#include "chaingen.h"
const size_t invalid_index_value = std::numeric_limits<size_t>::max();
+const uint64_t FIRST_BLOCK_REWARD = 17592186044415;
template<class concrete_test>
class gen_double_spend_base : public test_chain_unit_base
{
public:
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
gen_double_spend_base();
@@ -60,7 +61,7 @@ private:
template<bool txs_keeped_by_block>
struct gen_double_spend_in_tx : public gen_double_spend_base< gen_double_spend_in_tx<txs_keeped_by_block> >
{
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
static const bool has_invalid_tx = true;
static const size_t expected_pool_txs_count = 0;
static const uint64_t expected_bob_balance = send_amount;
@@ -73,7 +74,7 @@ struct gen_double_spend_in_tx : public gen_double_spend_base< gen_double_spend_i
template<bool txs_keeped_by_block>
struct gen_double_spend_in_the_same_block : public gen_double_spend_base< gen_double_spend_in_the_same_block<txs_keeped_by_block> >
{
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
static const bool has_invalid_tx = !txs_keeped_by_block;
static const size_t expected_pool_txs_count = has_invalid_tx ? 1 : 2;
static const uint64_t expected_bob_balance = send_amount;
@@ -86,7 +87,7 @@ struct gen_double_spend_in_the_same_block : public gen_double_spend_base< gen_do
template<bool txs_keeped_by_block>
struct gen_double_spend_in_different_blocks : public gen_double_spend_base< gen_double_spend_in_different_blocks<txs_keeped_by_block> >
{
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
static const bool has_invalid_tx = !txs_keeped_by_block;
static const size_t expected_pool_txs_count = has_invalid_tx ? 0 : 1;
static const uint64_t expected_bob_balance = 0;
@@ -99,7 +100,7 @@ struct gen_double_spend_in_different_blocks : public gen_double_spend_base< gen_
template<bool txs_keeped_by_block>
struct gen_double_spend_in_alt_chain_in_the_same_block : public gen_double_spend_base< gen_double_spend_in_alt_chain_in_the_same_block<txs_keeped_by_block> >
{
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
static const bool has_invalid_tx = !txs_keeped_by_block;
static const size_t expected_pool_txs_count = has_invalid_tx ? 1 : 2;
static const uint64_t expected_bob_balance = send_amount;
@@ -112,7 +113,7 @@ struct gen_double_spend_in_alt_chain_in_the_same_block : public gen_double_spend
template<bool txs_keeped_by_block>
struct gen_double_spend_in_alt_chain_in_different_blocks : public gen_double_spend_base< gen_double_spend_in_alt_chain_in_different_blocks<txs_keeped_by_block> >
{
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
static const bool has_invalid_tx = !txs_keeped_by_block;
static const size_t expected_pool_txs_count = has_invalid_tx ? 1 : 2;
static const uint64_t expected_bob_balance = send_amount;
@@ -125,7 +126,7 @@ struct gen_double_spend_in_alt_chain_in_different_blocks : public gen_double_spe
class gen_double_spend_in_different_chains : public test_chain_unit_base
{
public:
- static const uint64_t send_amount = MK_COINS(17);
+ static const uint64_t send_amount = FIRST_BLOCK_REWARD - TESTS_DEFAULT_FEE;
static const size_t expected_blockchain_height = 4 + 2 * CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW;
gen_double_spend_in_different_chains();