forked from lthn/blockchain
Merge branch 'develop' into wallet_crypt
This commit is contained in:
commit
8fd0ad01d0
12 changed files with 38 additions and 17 deletions
|
|
@ -1739,7 +1739,12 @@ namespace currency
|
|||
{
|
||||
CHECK_AND_ASSERT_MES(bl_entry.tx_global_outs.size() == bl_entry.txs.size(), false, "tx_global_outs count " << bl_entry.tx_global_outs.size() << " count missmatch with bl_entry.txs count " << bl_entry.txs.size());
|
||||
}
|
||||
|
||||
if (bl_entry.coinbase_global_outs.size())
|
||||
{
|
||||
std::shared_ptr<currency::transaction_chain_entry> tche_ptr(new currency::transaction_chain_entry());
|
||||
tche_ptr->m_global_output_indexes = bl_entry.coinbase_global_outs;
|
||||
bdde.coinbase_ptr = tche_ptr;
|
||||
}
|
||||
for (const auto& tx_blob : bl_entry.txs)
|
||||
{
|
||||
std::shared_ptr<currency::transaction_chain_entry> tche_ptr(new currency::transaction_chain_entry());
|
||||
|
|
|
|||
|
|
@ -29,11 +29,13 @@ namespace currency
|
|||
{
|
||||
blobdata block;
|
||||
std::list<blobdata> txs;
|
||||
std::vector<uint64_t> coinbase_global_outs;
|
||||
std::vector<struct_with_one_t_type<std::vector<uint64_t> > > tx_global_outs;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(block)
|
||||
KV_SERIALIZE(txs)
|
||||
KV_SERIALIZE(coinbase_global_outs)
|
||||
KV_SERIALIZE(tx_global_outs)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -12,7 +12,7 @@
|
|||
Watch-only
|
||||
</div>
|
||||
<div class="content auditable-watch-only" *ngIf="wallet.is_auditable && wallet.is_watch_only">
|
||||
Auditable Watch-Only
|
||||
Tracking
|
||||
</div>
|
||||
</div>
|
||||
<div class="close-wallet-wrapper">
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ namespace currency
|
|||
}
|
||||
|
||||
blockchain_storage::blocks_direct_container bs;
|
||||
if (!m_core.get_blockchain_storage().find_blockchain_supplement(req.block_ids, bs, res.current_height, res.start_height, COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT, req.minimum_height))
|
||||
if (!m_core.get_blockchain_storage().find_blockchain_supplement(req.block_ids, bs, res.current_height, res.start_height, COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT, req.minimum_height, req.need_global_indexes))
|
||||
{
|
||||
res.status = API_RETURN_CODE_FAIL;
|
||||
return false;
|
||||
|
|
@ -328,6 +328,8 @@ namespace currency
|
|||
res.blocks.back().block = block_to_blob(b.first->bl);
|
||||
if (req.need_global_indexes)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(b.third.get(), false, "Internal error on handling COMMAND_RPC_GET_BLOCKS_FAST: b.third is empty, ie coinbase info is not prepared");
|
||||
res.blocks.back().coinbase_global_outs = b.third->m_global_output_indexes;
|
||||
res.blocks.back().tx_global_outs.resize(b.second.size());
|
||||
}
|
||||
size_t i = 0;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ bool simple_wallet::restore_wallet(const std::string& wallet_file, const std::st
|
|||
|
||||
m_wallet.reset(new tools::wallet2());
|
||||
m_wallet->callback(this->shared_from_this());
|
||||
m_wallet->set_do_rise_transfer(false);
|
||||
m_wallet->set_do_rise_transfer(true);
|
||||
try
|
||||
{
|
||||
if (auditable_watch_only)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace tools
|
|||
currency::COMMAND_RPC_GET_BLOCKS_FAST::request req;
|
||||
req.block_ids = rqt.block_ids;
|
||||
req.minimum_height = rqt.minimum_height;
|
||||
req.need_global_indexes = rqt.need_global_indexes;
|
||||
currency::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
|
||||
bool r = call_COMMAND_RPC_GET_BLOCKS_FAST(req, res);
|
||||
rsp.status = res.status;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@
|
|||
#include "core_rpc_proxy.h"
|
||||
#include "storages/http_abstract_invoke.h"
|
||||
|
||||
#define WALLET_RCP_CONNECTION_TIMEOUT 3000
|
||||
#ifdef NDEBUG
|
||||
#define WALLET_RCP_CONNECTION_TIMEOUT 5000
|
||||
#else
|
||||
#define WALLET_RCP_CONNECTION_TIMEOUT 100000
|
||||
#endif
|
||||
#define WALLET_RCP_COUNT_ATTEMNTS 3
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4688,7 +4688,7 @@ void wallet2::transfer(const std::vector<currency::tx_destination_entry>& dsts,
|
|||
bool shuffle,
|
||||
uint8_t flags,
|
||||
bool send_to_network,
|
||||
std::string* p_signed_tx_blob_str)
|
||||
std::string* p_unsigned_filename_or_tx_blob_str)
|
||||
{
|
||||
//TIME_MEASURE_START(precalculation_time);
|
||||
construct_tx_param ctp = AUTO_VAL_INIT(ctp);
|
||||
|
|
@ -4707,7 +4707,7 @@ void wallet2::transfer(const std::vector<currency::tx_destination_entry>& dsts,
|
|||
ctp.tx_outs_attr = tx_outs_attr;
|
||||
ctp.unlock_time = unlock_time;
|
||||
//TIME_MEASURE_FINISH(precalculation_time);
|
||||
transfer(ctp, tx, send_to_network, p_signed_tx_blob_str);
|
||||
transfer(ctp, tx, send_to_network, p_unsigned_filename_or_tx_blob_str);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -4788,7 +4788,7 @@ void wallet2::check_and_throw_if_self_directed_tx_with_payment_id_requested(cons
|
|||
void wallet2::transfer(const construct_tx_param& ctp,
|
||||
currency::transaction &tx,
|
||||
bool send_to_network,
|
||||
std::string* p_signed_tx_blob_str)
|
||||
std::string* p_unsigned_filename_or_tx_blob_str)
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(!is_auditable() || !is_watch_only(), "You can't initiate coins transfer using an auditable watch-only wallet."); // btw, watch-only wallets can call transfer() within cold-signing process
|
||||
|
||||
|
|
@ -4801,7 +4801,7 @@ void wallet2::transfer(const construct_tx_param& ctp,
|
|||
|
||||
if (m_watch_only)
|
||||
{
|
||||
bool r = store_unsigned_tx_to_file_and_reserve_transfers(ftp, "zano_tx_unsigned", p_signed_tx_blob_str);
|
||||
bool r = store_unsigned_tx_to_file_and_reserve_transfers(ftp, (p_unsigned_filename_or_tx_blob_str != nullptr ? *p_unsigned_filename_or_tx_blob_str : "zano_tx_unsigned"), p_unsigned_filename_or_tx_blob_str);
|
||||
WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(r, "failed to store unsigned tx");
|
||||
WLT_LOG_GREEN("[wallet::transfer]" << " prepare_transaction_time: " << print_fixed_decimal_point(prepare_transaction_time, 3), LOG_LEVEL_0);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ namespace tools
|
|||
bool shuffle = true,
|
||||
uint8_t flags = 0,
|
||||
bool send_to_network = true,
|
||||
std::string* p_signed_tx_blob_str = nullptr);
|
||||
std::string* p_unsigned_filename_or_tx_blob_str = nullptr);
|
||||
|
||||
void transfer(const std::vector<currency::tx_destination_entry>& dsts,
|
||||
size_t fake_outputs_count,
|
||||
|
|
@ -565,7 +565,7 @@ namespace tools
|
|||
void transfer(const construct_tx_param& ctp,
|
||||
currency::transaction &tx,
|
||||
bool send_to_network,
|
||||
std::string* p_signed_tx_blob_str);
|
||||
std::string* p_unsigned_filename_or_tx_blob_str);
|
||||
|
||||
template<typename destination_split_strategy_t>
|
||||
void transfer_from_contract(
|
||||
|
|
|
|||
|
|
@ -239,6 +239,13 @@ namespace tools
|
|||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::on_transfer(const wallet_public::COMMAND_RPC_TRANSFER::request& req, wallet_public::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx)
|
||||
{
|
||||
if (req.fee < m_wallet.get_core_runtime_config().tx_pool_min_fee)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_WRONG_ARGUMENT;
|
||||
er.message = std::string("Given fee is too low: ") + epee::string_tools::num_to_string_fast(req.fee) + ", minimum is: " + epee::string_tools::num_to_string_fast(m_wallet.get_core_runtime_config().tx_pool_min_fee);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string payment_id;
|
||||
if (!epee::string_tools::parse_hexstr_to_binbuff(req.payment_id, payment_id))
|
||||
{
|
||||
|
|
@ -306,12 +313,12 @@ namespace tools
|
|||
|
||||
currency::transaction tx;
|
||||
|
||||
std::string signed_tx_blob_str;
|
||||
m_wallet.transfer(dsts, req.mixin, 0/*req.unlock_time*/, req.fee, extra, attachments, detail::ssi_digit, tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, CURRENCY_TO_KEY_OUT_RELAXED, true, 0, true, &signed_tx_blob_str);
|
||||
std::string unsigned_tx_blob_str;
|
||||
m_wallet.transfer(dsts, req.mixin, 0/*req.unlock_time*/, req.fee, extra, attachments, detail::ssi_digit, tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, CURRENCY_TO_KEY_OUT_RELAXED, true, 0, true, &unsigned_tx_blob_str);
|
||||
if (m_wallet.is_watch_only())
|
||||
{
|
||||
res.tx_unsigned_hex = epee::string_tools::buff_to_hex_nodelimer(signed_tx_blob_str); // watch-only wallets can't sign and relay transactions
|
||||
// leave res.tx_hash empty, because tx has will change after signing
|
||||
res.tx_unsigned_hex = epee::string_tools::buff_to_hex_nodelimer(unsigned_tx_blob_str); // watch-only wallets could not sign and relay transactions
|
||||
// leave res.tx_hash empty, because tx hash will change after signing
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue