forked from lthn/blockchain
Merge branch 'develop' into mobile
This commit is contained in:
commit
834e679b8c
8 changed files with 41 additions and 14 deletions
|
|
@ -3908,7 +3908,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
|
|||
const std::vector<crypto::signature>* psig = &sig_stub;
|
||||
|
||||
TIME_MEASURE_START_PD(tx_check_inputs_loop);
|
||||
BOOST_FOREACH(const auto& txin, tx.vin)
|
||||
for(const auto& txin : tx.vin)
|
||||
{
|
||||
if (!m_is_in_checkpoint_zone)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1605,7 +1605,7 @@ namespace currency
|
|||
return true;
|
||||
|
||||
size_t i = 0;
|
||||
BOOST_FOREACH(const tx_out& o, tx.vout)
|
||||
for(const tx_out& o : tx.vout)
|
||||
{
|
||||
if (o.target.type() == typeid(txout_to_key))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -880,10 +880,10 @@ namespace currency
|
|||
}
|
||||
//@#@
|
||||
//temporary double check timestamp
|
||||
if (time(NULL) - get_actual_timestamp(b) > 5)
|
||||
if (time(NULL) - static_cast<int64_t>(get_actual_timestamp(b)) > 5)
|
||||
{
|
||||
LOG_PRINT_RED_L0("Found block (" << get_block_hash(b) << ") timestamp (" << get_actual_timestamp(b)
|
||||
<< ") is suspiciously less (" << time(NULL) - get_actual_timestamp(b) << ") then curren time( " << time(NULL) << ")");
|
||||
<< ") is suspiciously less (" << time(NULL) - static_cast<int64_t>(get_actual_timestamp(b)) << ") than current time ( " << time(NULL) << ")");
|
||||
//mark node to make it easier to find it via scanner
|
||||
m_core.get_blockchain_storage().get_performnce_data().epic_failure_happend = true;
|
||||
}
|
||||
|
|
@ -937,10 +937,10 @@ namespace currency
|
|||
}
|
||||
//@#@
|
||||
//temporary double check timestamp
|
||||
if (time(NULL) - get_actual_timestamp(b) > 5)
|
||||
if (time(NULL) - static_cast<int64_t>(get_actual_timestamp(b)) > 5)
|
||||
{
|
||||
LOG_PRINT_RED_L0("Found block (" << get_block_hash(b) << ") timestamp (" << get_actual_timestamp(b)
|
||||
<< ") is suspiciously less (" << time(NULL) - get_actual_timestamp(b) << ") then curren time( " << time(NULL) << ")");
|
||||
<< ") is suspiciously less (" << time(NULL) - static_cast<int64_t>(get_actual_timestamp(b)) << ") than current time ( " << time(NULL) << ")");
|
||||
//mark node to make it easier to find it via scanner
|
||||
m_core.get_blockchain_storage().get_performnce_data().epic_failure_happend = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1195,7 +1195,7 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
|
|||
|
||||
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!set_payment_id_to_tx(attachments, payment_id))
|
||||
if (!payment_id.empty() && !set_payment_id_to_tx(attachments, payment_id))
|
||||
{
|
||||
fail_msg_writer() << "provided (or embedded) payment id can't be set: \"" << payment_id << "\"";
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#define PROJECT_MAJOR_VERSION "1"
|
||||
#define PROJECT_MINOR_VERSION "1"
|
||||
#define PROJECT_REVISION "4"
|
||||
#define PROJECT_REVISION "5"
|
||||
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
|
||||
|
||||
#define PROJECT_VERSION_BUILD_NO 77
|
||||
#define PROJECT_VERSION_BUILD_NO 78
|
||||
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
|
||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
|
||||
|
|
|
|||
|
|
@ -2909,10 +2909,10 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
m_wcallback->on_pos_block_found(b);
|
||||
//@#@
|
||||
//double check timestamp
|
||||
if (time(NULL) - get_actual_timestamp(b) > 5)
|
||||
if (time(NULL) - static_cast<int64_t>(get_actual_timestamp(b)) > 5)
|
||||
{
|
||||
WLT_LOG_RED("Found block (" << get_block_hash(b) << ") timestamp (" << get_actual_timestamp(b)
|
||||
<< ") is suspiciously less (" << time(NULL) - get_actual_timestamp(b) << ") then curren time( " << time(NULL) << ")", LOG_LEVEL_0);
|
||||
<< ") is suspiciously less (" << time(NULL) - static_cast<int64_t>(get_actual_timestamp(b)) << ") than current time ( " << time(NULL) << ")", LOG_LEVEL_0);
|
||||
}
|
||||
//
|
||||
return true;
|
||||
|
|
@ -4358,11 +4358,38 @@ bool wallet2::store_unsigned_tx_to_file_and_reserve_transfers(const finalize_tx_
|
|||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::check_and_throw_if_self_directed_tx_with_payment_id_requested(const construct_tx_param& ctp)
|
||||
{
|
||||
// If someone sends coins to his own address, all tx outputs will be detected as own outputs.
|
||||
// It's totally okay unless payment id is used, because it would be impossible to distinguish
|
||||
// between change outs and transfer outs. Thus, such tx with a payment id can't be correctly
|
||||
// obtained via RPC by the given payment id. It could be a problem for an exchange or other
|
||||
// service when a user, identifyied by payment id sends coins to another user on the same
|
||||
// exchange/service. Coins will be received but RPCs like get_payments won't give the transfer.
|
||||
// To avoid such issues we prohibit such txs with a soft rule on sender side.
|
||||
|
||||
for (auto& d : ctp.dsts)
|
||||
{
|
||||
for (auto& addr : d.addr)
|
||||
{
|
||||
if (addr != m_account.get_public_address())
|
||||
return; // at least one destination address is not our address -- it's not self-directed tx
|
||||
}
|
||||
}
|
||||
|
||||
// it's self-directed tx
|
||||
payment_id_t pid;
|
||||
bool has_payment_id = get_payment_id_from_tx(ctp.attachments, pid) && !pid.empty();
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(!has_payment_id, "sending funds to yourself with payment id is not allowed");
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::transfer(const construct_tx_param& ctp,
|
||||
currency::transaction &tx,
|
||||
bool send_to_network,
|
||||
std::string* p_signed_tx_blob_str)
|
||||
{
|
||||
check_and_throw_if_self_directed_tx_with_payment_id_requested(ctp);
|
||||
|
||||
TIME_MEASURE_START(prepare_transaction_time);
|
||||
finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
prepare_transaction(ctp, ftp);
|
||||
|
|
@ -4555,7 +4582,7 @@ void wallet2::sweep_below(size_t fake_outs_count, const currency::account_public
|
|||
{
|
||||
finalize_transaction(ftp, tx, tx_key, false, false);
|
||||
}
|
||||
catch (error::tx_too_big)
|
||||
catch (error::tx_too_big&)
|
||||
{
|
||||
return rc_too_many_outputs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -864,7 +864,7 @@ private:
|
|||
void check_for_free_space_and_throw_if_it_lacks(const std::wstring& path, uint64_t exact_size_needed_if_known = UINT64_MAX);
|
||||
bool generate_packing_transaction_if_needed(currency::transaction& tx, uint64_t fake_outputs_number);
|
||||
bool store_unsigned_tx_to_file_and_reserve_transfers(const finalize_tx_param& ftp, const std::string& filename, std::string* p_unsigned_tx_blob_str = nullptr);
|
||||
|
||||
void check_and_throw_if_self_directed_tx_with_payment_id_requested(const construct_tx_param& ctp);
|
||||
|
||||
currency::account_base m_account;
|
||||
bool m_watch_only;
|
||||
|
|
|
|||
|
|
@ -1622,7 +1622,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
|
|||
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
currency::checkpoints checkpoints;
|
||||
checkpoints.add_checkpoint(15, "a8e535abb31cd2c07ebd65dbb8d4160954677a0cebcd3dadf81642297cc557af");
|
||||
checkpoints.add_checkpoint(15, "72d63d6500c62d6783108f5a2e2c9f1dc1f0aae57011cf123583eec679a52cf9");
|
||||
c.set_checkpoints(std::move(checkpoints));
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue