1
0
Fork 0
forked from lthn/blockchain

fixed compilation issues

This commit is contained in:
cryptozoidberg 2019-07-24 00:37:24 +02:00
parent b708df10ba
commit 292437c05c
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
11 changed files with 82 additions and 59 deletions

View file

@ -252,10 +252,9 @@ DISABLE_VS_WARNINGS(4100)
}
#define CATCH_ENTRY_WITH_FORWARDING_EXCEPTION() \
#define CATCH_ENTRY_WITH_FORWARDING_EXCEPTION() } \
catch(const std::exception& ex) \
{ \
(void)(ex); \
LOG_ERROR("Exception at [" << LOCATION_SS << "], what=" << ex.what()); \
throw std::runtime_error(std::string("[EXCEPTION FORWARDED]: ") + ex.what()); \
} \

View file

@ -36,7 +36,7 @@ namespace currency
//------------------------------------------------------------------
int ethash_height_to_epoch(uint64_t height)
{
return height / ETHASH_EPOCH_LENGTH;
return static_cast<int>(height / ETHASH_EPOCH_LENGTH);
}
//--------------------------------------------------------------
crypto::hash ethash_epoch_to_seed(int epoch)
@ -51,7 +51,7 @@ namespace currency
{
int epoch = ethash_height_to_epoch(height);
const auto& context = progpow::get_global_epoch_context_full(static_cast<int>(epoch));
auto res_eth = progpow::hash(context, height, *(ethash::hash256*)&block_header_hash, nonce);
auto res_eth = progpow::hash(context, static_cast<int>(height), *(ethash::hash256*)&block_header_hash, nonce);
crypto::hash result = currency::null_hash;
memcpy(&result.data, &res_eth.final_hash, sizeof(res_eth.final_hash));
return result;

View file

@ -3738,6 +3738,12 @@ bool blockchain_storage::have_tx_keyimges_as_spent(const transaction &tx) const
return false;
}
//------------------------------------------------------------------
bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash) const
{
uint64_t stub = 0;
return check_tx_inputs(tx, tx_prefix_hash, stub);
}
//------------------------------------------------------------------
bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash, uint64_t& max_used_block_height) const
{
size_t sig_index = 0;

View file

@ -223,7 +223,7 @@ namespace currency
std::shared_ptr<transaction> get_tx(const crypto::hash &id) const;
template<class visitor_t>
bool scan_outputkeys_for_indexes(const transaction &validated_tx, const txin_to_key& tx_in_to_key, visitor_t& vis, uint64_t& max_related_block_height = NULL) const ;
bool scan_outputkeys_for_indexes(const transaction &validated_tx, const txin_to_key& tx_in_to_key, visitor_t& vis, uint64_t& max_related_block_height) const ;
uint64_t get_current_blockchain_size() const;
uint64_t get_top_block_height() const;
@ -264,6 +264,7 @@ namespace currency
bool check_tx_input(const transaction& tx, size_t in_index, const txin_to_key& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, uint64_t& max_related_block_height, uint64_t& max_unlock_time)const;
bool check_tx_input(const transaction& tx, size_t in_index, const txin_multisig& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, uint64_t& max_related_block_height)const;
bool check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash, uint64_t& max_used_block_height)const;
bool check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash) const;
bool check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash, uint64_t& max_used_block_height, crypto::hash& max_used_block_id)const;
bool check_ms_input(const transaction& tx, size_t in_index, const txin_multisig& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, const transaction& source_tx, size_t out_n) const;
bool get_output_keys_for_input_with_checks(const transaction& tx, const txin_to_key& txin, std::vector<crypto::public_key>& output_keys, uint64_t& max_related_block_height, uint64_t& max_unlock_time) const;

View file

@ -351,7 +351,7 @@ namespace currency
{
std::vector<uint64_t> unlock_time_array;
BEGIN_SERIALIZE()
VARINT_FIELD(unlock_time_array)
FIELD(unlock_time_array)
END_SERIALIZE()
};
@ -371,7 +371,7 @@ namespace currency
uint64_t v;
BEGIN_SERIALIZE()
VARINT_FIELD(v)
END_SERIALIZE()
END_SERIALIZE()
};
struct etc_tx_details_flags

View file

@ -210,9 +210,9 @@
//hard forks section
#define BLOCK_MAJOR_VERSION_INITAL 1
#ifndef TESTNET
#define ZANO_HARDFORK_1_AFTER_HEIGHT ??
#define ZANO_HARDFORK_1_AFTER_HEIGHT 120000
#else
#define ZANO_HARDFORK_1_AFTER_HEIGHT ??
#define ZANO_HARDFORK_1_AFTER_HEIGHT ???
#endif

View file

@ -2072,6 +2072,20 @@ namespace currency
return true;
}
bool operator()(const etc_tx_details_unlock_time2& ee)
{
tv.type = "unlock_time";
std::stringstream ss;
ss << "[";
for (auto v : ee.unlock_time_array)
{
ss << " " << v;
}
ss << "]";
tv.short_view = ss.str();
return true;
}
bool operator()(const etc_tx_details_expiration_time& ee)
{
tv.type = "expiration_time";

View file

@ -59,55 +59,7 @@ namespace currency
typedef boost::multiprecision::uint128_t uint128_tl;
struct tx_source_entry
{
typedef serializable_pair<txout_v, crypto::public_key> output_entry; // txout_v is either global output index or ref_by_id; public_key - is output ephemeral pub key
std::vector<output_entry> outputs; //index + key
uint64_t real_output; //index in outputs vector of real output_entry
crypto::public_key real_out_tx_key; //real output's transaction's public key
size_t real_output_in_tx_index; //index in transaction outputs vector
uint64_t amount; //money
uint64_t transfer_index; //money
crypto::hash multisig_id; //if txin_multisig: multisig output id
size_t ms_sigs_count; //if txin_multisig: must be equal to output's minimum_sigs
size_t ms_keys_count; //if txin_multisig: must be equal to size of output's keys container
bool separately_signed_tx_complete; //for separately signed tx only: denotes the last source entry in complete tx to explicitly mark the final step of tx creation
bool is_multisig() const { return ms_sigs_count > 0; }
BEGIN_SERIALIZE_OBJECT()
FIELD(outputs)
FIELD(real_output)
FIELD(real_out_tx_key)
FIELD(real_output_in_tx_index)
FIELD(amount)
FIELD(transfer_index)
FIELD(multisig_id)
FIELD(ms_sigs_count)
FIELD(ms_keys_count)
FIELD(separately_signed_tx_complete)
END_SERIALIZE()
};
struct tx_destination_entry
{
uint64_t amount; //money
std::list<account_public_address> addr; //destination address, in case of 1 address - txout_to_key, in case of more - txout_multisig
size_t minimum_sigs; // if txout_multisig: minimum signatures that are required to spend this output (minimum_sigs <= addr.size()) IF txout_to_key - not used
uint64_t amount_to_provide; //amount money that provided by initial creator of tx, used with partially created transactions
tx_destination_entry() : amount(0), minimum_sigs(0), amount_to_provide(0){}
tx_destination_entry(uint64_t a, const account_public_address& ad) : amount(a), addr(1, ad), minimum_sigs(0), amount_to_provide(0){}
tx_destination_entry(uint64_t a, const std::list<account_public_address>& addr) : amount(a), addr(addr), minimum_sigs(addr.size()), amount_to_provide(0){}
BEGIN_SERIALIZE_OBJECT()
FIELD(amount)
FIELD(addr)
FIELD(minimum_sigs)
FIELD(amount_to_provide)
END_SERIALIZE()
};
struct tx_extra_info
{

View file

@ -6,6 +6,7 @@
#include "currency_format_utils_blocks.h"
#include "serialization/serialization.h"
#include "currency_format_utils.h"
#include "currency_format_utils_abstract.h"
#include "currency_format_utils_transactions.h"
namespace currency

View file

@ -6,8 +6,8 @@
#include "currency_format_utils_transactions.h"
#include "serialization/serialization.h"
#include "currency_format_utils_abstract.h"
#include "currency_format_utils.h"
#include "currency_format_utils_abstract.h"
namespace currency
{

View file

@ -9,10 +9,60 @@
#include "crypto/crypto.h"
#include "currency_core/currency_basic.h"
#include "currency_protocol/blobdatatype.h"
#include "currency_core/account.h"
namespace currency
{
struct tx_source_entry
{
typedef serializable_pair<txout_v, crypto::public_key> output_entry; // txout_v is either global output index or ref_by_id; public_key - is output ephemeral pub key
std::vector<output_entry> outputs; //index + key
uint64_t real_output; //index in outputs vector of real output_entry
crypto::public_key real_out_tx_key; //real output's transaction's public key
size_t real_output_in_tx_index; //index in transaction outputs vector
uint64_t amount; //money
uint64_t transfer_index; //money
crypto::hash multisig_id; //if txin_multisig: multisig output id
size_t ms_sigs_count; //if txin_multisig: must be equal to output's minimum_sigs
size_t ms_keys_count; //if txin_multisig: must be equal to size of output's keys container
bool separately_signed_tx_complete; //for separately signed tx only: denotes the last source entry in complete tx to explicitly mark the final step of tx creation
bool is_multisig() const { return ms_sigs_count > 0; }
BEGIN_SERIALIZE_OBJECT()
FIELD(outputs)
FIELD(real_output)
FIELD(real_out_tx_key)
FIELD(real_output_in_tx_index)
FIELD(amount)
FIELD(transfer_index)
FIELD(multisig_id)
FIELD(ms_sigs_count)
FIELD(ms_keys_count)
FIELD(separately_signed_tx_complete)
END_SERIALIZE()
};
struct tx_destination_entry
{
uint64_t amount; //money
std::list<account_public_address> addr; //destination address, in case of 1 address - txout_to_key, in case of more - txout_multisig
size_t minimum_sigs; // if txout_multisig: minimum signatures that are required to spend this output (minimum_sigs <= addr.size()) IF txout_to_key - not used
uint64_t amount_to_provide; //amount money that provided by initial creator of tx, used with partially created transactions
tx_destination_entry() : amount(0), minimum_sigs(0), amount_to_provide(0) {}
tx_destination_entry(uint64_t a, const account_public_address& ad) : amount(a), addr(1, ad), minimum_sigs(0), amount_to_provide(0) {}
tx_destination_entry(uint64_t a, const std::list<account_public_address>& addr) : amount(a), addr(addr), minimum_sigs(addr.size()), amount_to_provide(0) {}
BEGIN_SERIALIZE_OBJECT()
FIELD(amount)
FIELD(addr)
FIELD(minimum_sigs)
FIELD(amount_to_provide)
END_SERIALIZE()
};
template<class extra_type_t>
uint64_t get_tx_x_detail(const transaction& tx)