forked from lthn/blockchain
Merge remote-tracking branch 'origin/multiassets' into cryptoassets
This commit is contained in:
commit
24851d10c6
6 changed files with 55 additions and 12 deletions
|
|
@ -71,6 +71,37 @@ namespace epee
|
|||
// Create a context that uses the default paths for
|
||||
// finding CA certificates.
|
||||
m_ssl_context.set_default_verify_paths();
|
||||
/*m_socket.set_verify_mode(boost::asio::ssl::verify_peer);
|
||||
m_socket.set_verify_callback(
|
||||
boost::bind(&socket_backend::verify_certificate, this, _1, _2));*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
bool verify_certificate(bool preverified,
|
||||
boost::asio::ssl::verify_context& ctx)
|
||||
{
|
||||
std::cout << "verify_certificate (preverified " << preverified << " ) ...\n";
|
||||
// The verify callback can be used to check whether the certificate that is
|
||||
// being presented is valid for the peer. For example, RFC 2818 describes
|
||||
// the steps involved in doing this for HTTPS. Consult the OpenSSL
|
||||
// documentation for more details. Note that the callback is called once
|
||||
// for each certificate in the certificate chain, starting from the root
|
||||
// certificate authority.
|
||||
|
||||
// In this example we will simply print the certificate's subject name.
|
||||
char subject_name[256];
|
||||
X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
|
||||
X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256);
|
||||
std::cout << "Verifying " << subject_name << "\n";
|
||||
|
||||
// dummy verification
|
||||
return true;
|
||||
}*/
|
||||
|
||||
void set_domain(const std::string& domain_name)
|
||||
{
|
||||
SSL_set_tlsext_host_name(m_socket.native_handle(), domain_name.c_str());
|
||||
}
|
||||
|
||||
boost::asio::ip::tcp::socket& get_socket()
|
||||
|
|
@ -104,6 +135,11 @@ namespace epee
|
|||
return m_socket;
|
||||
}
|
||||
|
||||
void set_domain(const std::string& domain_name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
boost::asio::ip::tcp::socket& get_stream()
|
||||
{
|
||||
return m_socket;
|
||||
|
|
@ -216,7 +252,7 @@ namespace epee
|
|||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
m_sct_back.set_domain(addr);
|
||||
|
||||
//boost::asio::ip::tcp::endpoint remote_endpoint(boost::asio::ip::address::from_string(addr.c_str()), port);
|
||||
boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
|
||||
|
|
|
|||
|
|
@ -277,9 +277,9 @@ static_assert(PREMINE_AMOUNT / WALLET_MAX_ALLOWED_OUTPUT_AMOUNT < CURRENCY_MINER
|
|||
#define CURRENCY_RELAY_TXS_MAX_COUNT 5
|
||||
|
||||
#ifndef TESTNET
|
||||
#define WALLET_ASSETS_WHITELIST_URL "https://zano.org/assets_whitelist.json"
|
||||
#define WALLET_ASSETS_WHITELIST_URL "https://api.zano.org/assets_whitelist.json"
|
||||
#else
|
||||
#define WALLET_ASSETS_WHITELIST_URL "https://zano.org/assets_whitelist_testnet.json"
|
||||
#define WALLET_ASSETS_WHITELIST_URL "https://api.zano.org/assets_whitelist_testnet.json"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1468,9 +1468,9 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
|
|||
if (!m_wallet->is_watch_only())
|
||||
{
|
||||
if(wrapped_transaction)
|
||||
success_msg_writer(true) << "Money successfully sent to wZano custody wallet, transaction " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
|
||||
success_msg_writer(true) << "Transaction successfully sent to wZano custody wallet, id: " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
|
||||
else
|
||||
success_msg_writer(true) << "Money successfully sent, transaction " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
|
||||
success_msg_writer(true) << "Transaction successfully sent, id: " << get_transaction_hash(tx) << ", " << get_object_blobsize(tx) << " bytes";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2394,6 +2394,8 @@ int main(int argc, char* argv[])
|
|||
if (command_line::get_arg(vm, arg_generate_new_wallet).size() || command_line::get_arg(vm, arg_generate_new_auditable_wallet).size())
|
||||
return EXIT_FAILURE;
|
||||
|
||||
wal.m_use_assets_whitelisting(true);
|
||||
|
||||
if (!offline_mode)
|
||||
wal.refresh();
|
||||
LOG_PRINT_GREEN("Loaded ok", LOG_LEVEL_0);
|
||||
|
|
|
|||
|
|
@ -3102,6 +3102,12 @@ void wallet2::set_use_deffered_global_outputs(bool use)
|
|||
m_use_deffered_global_outputs = use;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::set_use_assets_whitelisting(bool use)
|
||||
{
|
||||
LOG_PRINT_L0("[ASSET_WHITELISTING_MODE]: " << use);
|
||||
m_use_assets_whitelisting = use;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::store_watch_only(const std::wstring& path_to_save, const std::string& password) const
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(path_to_save != m_wallet_file, "trying to save watch-only wallet to the same wallet file!");
|
||||
|
|
@ -3325,13 +3331,10 @@ bool wallet2::delete_custom_asset_id(const crypto::public_key& asset_id)
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::load_whitelisted_tokens() const
|
||||
{
|
||||
// Temporary disable by sowle:
|
||||
// 1. seems to be not working due to cloudflare issues
|
||||
// 2. this should not access web when the tests are running
|
||||
if(!m_use_assets_whitelisting)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
|
||||
/*
|
||||
|
||||
|
||||
m_whitelisted_assets.clear();
|
||||
std::string body;
|
||||
|
|
@ -3344,7 +3347,6 @@ bool wallet2::load_whitelisted_tokens() const
|
|||
}
|
||||
}
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::load_whitelisted_tokens_if_not_loaded() const
|
||||
|
|
|
|||
|
|
@ -944,6 +944,7 @@ namespace tools
|
|||
uint64_t get_sync_progress();
|
||||
uint64_t get_wallet_file_size()const;
|
||||
void set_use_deffered_global_outputs(bool use);
|
||||
void set_use_assets_whitelisting(bool use);
|
||||
construct_tx_param get_default_construct_tx_param_inital();
|
||||
void set_disable_tor_relay(bool disable);
|
||||
uint64_t get_default_fee() {return TX_DEFAULT_FEE;}
|
||||
|
|
@ -1189,6 +1190,7 @@ private:
|
|||
mutable uint64_t m_current_wallet_file_size;
|
||||
bool m_use_deffered_global_outputs;
|
||||
bool m_disable_tor_relay;
|
||||
bool m_use_assets_whitelisting = false;
|
||||
|
||||
mutable current_operation_context m_current_context;
|
||||
//this needed to access wallets state in coretests, for creating abnormal blocks and tranmsactions
|
||||
|
|
|
|||
|
|
@ -1021,6 +1021,7 @@ std::string wallets_manager::open_wallet(const std::wstring& path, const std::st
|
|||
|
||||
std::shared_ptr<tools::wallet2> w(new tools::wallet2());
|
||||
w->set_use_deffered_global_outputs(m_use_deffered_global_outputs);
|
||||
w->set_use_assets_whitelisting(true);
|
||||
owr.wallet_id = m_wallet_id_counter++;
|
||||
|
||||
w->callback(std::shared_ptr<tools::i_wallet2_callback>(new i_wallet_to_i_backend_adapter(this, owr.wallet_id)));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue