aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests
diff options
context:
space:
mode:
authormydesktop <dev.mc2@gmail.com>2014-05-03 12:19:43 -0400
committermydesktop <dev.mc2@gmail.com>2014-05-03 12:19:43 -0400
commit333f975760c156727dd7408f87e937af856d8bf1 (patch)
tree1928b27eaac60f0b528f17abbc52d5ad812013d0 /tests/core_tests
parentMerge branch 'master' of github.com:monero-project/bitmonero (diff)
downloadmonero-333f975760c156727dd7408f87e937af856d8bf1.tar.xz
initial [broken] update
Diffstat (limited to 'tests/core_tests')
-rw-r--r--tests/core_tests/block_validation.cpp4
-rw-r--r--tests/core_tests/chaingen.cpp7
-rw-r--r--tests/core_tests/double_spend.inl4
-rw-r--r--tests/core_tests/integer_overflow.cpp8
-rw-r--r--tests/core_tests/transaction_tests.cpp6
5 files changed, 15 insertions, 14 deletions
diff --git a/tests/core_tests/block_validation.cpp b/tests/core_tests/block_validation.cpp
index 36e769c65..57e147133 100644
--- a/tests/core_tests/block_validation.cpp
+++ b/tests/core_tests/block_validation.cpp
@@ -323,7 +323,7 @@ bool gen_block_miner_tx_has_2_in::generate(std::vector<test_event_entry>& events
destinations.push_back(de);
transaction tmp_tx;
- if (!construct_tx(miner_account.get_keys(), sources, destinations, tmp_tx, 0))
+ if (!construct_tx(miner_account.get_keys(), sources, destinations, std::vector<uint8_t>(), tmp_tx, 0))
return false;
MAKE_MINER_TX_MANUALLY(miner_tx, blk_0);
@@ -365,7 +365,7 @@ bool gen_block_miner_tx_with_txin_to_key::generate(std::vector<test_event_entry>
destinations.push_back(de);
transaction tmp_tx;
- if (!construct_tx(miner_account.get_keys(), sources, destinations, tmp_tx, 0))
+ if (!construct_tx(miner_account.get_keys(), sources, destinations, std::vector<uint8_t>(), tmp_tx, 0))
return false;
MAKE_MINER_TX_MANUALLY(miner_tx, blk_1);
diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp
index f00323518..124800db7 100644
--- a/tests/core_tests/chaingen.cpp
+++ b/tests/core_tests/chaingen.cpp
@@ -425,9 +425,12 @@ bool fill_tx_sources(std::vector<tx_source_entry>& sources, const std::vector<te
ts.amount = oi.amount;
ts.real_output_in_tx_index = oi.out_no;
ts.real_out_tx_key = get_tx_pub_key_from_extra(*oi.p_tx); // incoming tx public key
- if (!fill_output_entries(outs[o.first], sender_out, nmix, ts.real_output, ts.outputs))
+ size_t realOutput;
+ if (!fill_output_entries(outs[o.first], sender_out, nmix, realOutput, ts.outputs))
continue;
+ ts.real_output = realOutput;
+
sources.push_back(ts);
sources_amount += ts.amount;
@@ -528,7 +531,7 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events, cryptonote
vector<tx_destination_entry> destinations;
fill_tx_sources_and_destinations(events, blk_head, from, to, amount, fee, nmix, sources, destinations);
- return construct_tx(from.get_keys(), sources, destinations, tx, 0);
+ return construct_tx(from.get_keys(), sources, destinations, std::vector<uint8_t>(), tx, 0);
}
transaction construct_tx_with_fee(std::vector<test_event_entry>& events, const block& blk_head,
diff --git a/tests/core_tests/double_spend.inl b/tests/core_tests/double_spend.inl
index 38873a8b4..2d75d994a 100644
--- a/tests/core_tests/double_spend.inl
+++ b/tests/core_tests/double_spend.inl
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
//======================================================================================================================
@@ -113,7 +113,7 @@ bool gen_double_spend_in_tx<txs_keeped_by_block>::generate(std::vector<test_even
destinations.push_back(de);
cryptonote::transaction tx_1;
- if (!construct_tx(bob_account.get_keys(), sources, destinations, tx_1, 0))
+ if (!construct_tx(bob_account.get_keys(), sources, destinations, std::vector<uint8_t>(), tx_1, 0))
return false;
SET_EVENT_VISITOR_SETT(events, event_visitor_settings::set_txs_keeped_by_block, txs_keeped_by_block);
diff --git a/tests/core_tests/integer_overflow.cpp b/tests/core_tests/integer_overflow.cpp
index 82bfb2150..5c619e97c 100644
--- a/tests/core_tests/integer_overflow.cpp
+++ b/tests/core_tests/integer_overflow.cpp
@@ -72,7 +72,7 @@ bool gen_uint_overflow_base::mark_last_valid_block(cryptonote::core& c, size_t e
bool gen_uint_overflow_1::generate(std::vector<test_event_entry>& events) const
{
- uint64_t ts_start = 1338224400;
+ uint64_t ts_start = 1338224400;
GENERATE_ACCOUNT(miner_account);
MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
@@ -116,7 +116,7 @@ bool gen_uint_overflow_1::generate(std::vector<test_event_entry>& events) const
bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
{
- uint64_t ts_start = 1338224400;
+ uint64_t ts_start = 1338224400;
GENERATE_ACCOUNT(miner_account);
MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
@@ -148,7 +148,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
destinations.push_back(tx_destination_entry(sources.front().amount - MONEY_SUPPLY - MONEY_SUPPLY + 1 - TESTS_DEFAULT_FEE, bob_addr));
cryptonote::transaction tx_1;
- if (!construct_tx(miner_account.get_keys(), sources, destinations, tx_1, 0))
+ if (!construct_tx(miner_account.get_keys(), sources, destinations, std::vector<uint8_t>(), tx_1, 0))
return false;
events.push_back(tx_1);
@@ -174,7 +174,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
destinations.push_back(de);
cryptonote::transaction tx_2;
- if (!construct_tx(bob_account.get_keys(), sources, destinations, tx_2, 0))
+ if (!construct_tx(bob_account.get_keys(), sources, destinations, std::vector<uint8_t>(), tx_2, 0))
return false;
events.push_back(tx_2);
diff --git a/tests/core_tests/transaction_tests.cpp b/tests/core_tests/transaction_tests.cpp
index 07e6661d8..635c41503 100644
--- a/tests/core_tests/transaction_tests.cpp
+++ b/tests/core_tests/transaction_tests.cpp
@@ -81,9 +81,7 @@ bool test_transaction_generation_and_ring_signature()
oe.second = boost::get<txout_to_key>(tx_mine_6.vout[0].target).key;
src.outputs.push_back(oe);
- crypto::public_key tx_pub_key = null_pkey;
- cryptonote::parse_and_validate_tx_extra(tx_mine_2, tx_pub_key);
- src.real_out_tx_key = tx_pub_key;
+ src.real_out_tx_key = cryptonote::get_tx_pub_key_from_extra(tx_mine_2);
src.real_output = 1;
src.real_output_in_tx_index = 0;
}
@@ -95,7 +93,7 @@ bool test_transaction_generation_and_ring_signature()
destinations.push_back(td);
transaction tx_rc1;
- bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, tx_rc1, 0);
+ bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, std::vector<uint8_t>(), tx_rc1, 0);
CHECK_AND_ASSERT_MES(r, false, "failed to construct transaction");
crypto::hash pref_hash = get_transaction_prefix_hash(tx_rc1);