1
0
Fork 0
forked from lthn/blockchain

coretests: generic improvements in chaingen

This commit is contained in:
sowle 2019-08-09 07:34:27 +03:00
parent 393bf525d6
commit 6f5762f0c1
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 4 additions and 4 deletions

View file

@ -1504,14 +1504,14 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
if (!fill_tx_sources(sources, events, blk_head, from.get_keys(), spending_amount, nmix, check_for_spends, check_for_unlocktime, use_ref_by_id))
return false;
int64_t change = get_sources_total_amount(sources);
boost::multiprecision::int128_t change = get_sources_total_amount(sources);
change -= spending_amount;
if (change < 0)
return false; // should never happen if fill_tx_sources succeded
if (change == 0)
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, sk, 0, mix_attr);
std::vector<tx_destination_entry> local_dst = destinations;
local_dst.push_back(tx_destination_entry(change, from.get_public_address()));
local_dst.push_back(tx_destination_entry(change.convert_to<uint64_t>(), from.get_public_address()));
return construct_tx(from.get_keys(), sources, local_dst, extr, att, tx, sk, 0, mix_attr);
}

View file

@ -247,7 +247,7 @@ struct offers_count_param
size_t offers_count_raw;
};
class test_chain_unit_enchanced : public test_chain_unit_base
class test_chain_unit_enchanced : virtual public test_chain_unit_base
{
public:
test_chain_unit_enchanced();

View file

@ -7,7 +7,7 @@
#include "chaingen.h"
#include "random_helper.h"
struct checkpoints_test : public test_chain_unit_enchanced
struct checkpoints_test : virtual public test_chain_unit_enchanced
{
checkpoints_test();