Merge pull request #4894

aee7a4e3 wallet_rpc_server: do not use RPC data if the call failed (moneromooo-monero)
1a0733e5 windows_service: fix memory leak (moneromooo-monero)
0dac3c64 unit_tests: do not rethrow a copy of an exception (moneromooo-monero)
5d9915ab cryptonote: fix get_unit for non default settings (moneromooo-monero)
d4f50cb1 remove some unused code (moneromooo-monero)
61163971 a few minor (but easy) performance tweaks (moneromooo-monero)
30023074 tests: slow_memmem now returns size_t (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-12-04 17:33:18 +02:00
commit 81418cb281
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
30 changed files with 41 additions and 145 deletions

View File

@ -764,7 +764,7 @@ int main(int argc, char* argv[])
#else #else
const GetCheckpointsCallback& get_checkpoints = nullptr; const GetCheckpointsCallback& get_checkpoints = nullptr;
#endif #endif
if (!core.init(vm, nullptr, nullptr, get_checkpoints)) if (!core.init(vm, nullptr, get_checkpoints))
{ {
std::cerr << "Failed to initialize core" << ENDL; std::cerr << "Failed to initialize core" << ENDL;
return 1; return 1;

View File

@ -234,7 +234,7 @@ namespace tools
return encode(buf); return encode(buf);
} }
bool decode_addr(std::string addr, uint64_t& tag, std::string& data) bool decode_addr(const std::string &addr, uint64_t& tag, std::string& data)
{ {
std::string addr_data; std::string addr_data;
bool r = decode(addr, addr_data); bool r = decode(addr, addr_data);

View File

@ -41,6 +41,6 @@ namespace tools
bool decode(const std::string& enc, std::string& data); bool decode(const std::string& enc, std::string& data);
std::string encode_addr(uint64_t tag, const std::string& data); std::string encode_addr(uint64_t tag, const std::string& data);
bool decode_addr(std::string addr, uint64_t& tag, std::string& data); bool decode_addr(const std::string &addr, uint64_t& tag, std::string& data);
} }
} }

View File

@ -303,7 +303,7 @@ std::vector<std::string> DNSResolver::get_record(const std::string& url, int rec
// call DNS resolver, blocking. if return value not zero, something went wrong // call DNS resolver, blocking. if return value not zero, something went wrong
if (!ub_resolve(m_data->m_ub_context, string_copy(url.c_str()), record_type, DNS_CLASS_IN, &result)) if (!ub_resolve(m_data->m_ub_context, string_copy(url.c_str()), record_type, DNS_CLASS_IN, &result))
{ {
dnssec_available = (result->secure || (!result->secure && result->bogus)); dnssec_available = (result->secure || result->bogus);
dnssec_valid = result->secure && !result->bogus; dnssec_valid = result->secure && !result->bogus;
if (result->havedata) if (result->havedata)
{ {

View File

@ -322,7 +322,7 @@ namespace cryptonote {
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
bool parse_hash256(const std::string str_hash, crypto::hash& hash) bool parse_hash256(const std::string &str_hash, crypto::hash& hash)
{ {
std::string buf; std::string buf;
bool res = epee::string_tools::parse_hexstr_to_binbuff(str_hash, buf); bool res = epee::string_tools::parse_hexstr_to_binbuff(str_hash, buf);

View File

@ -124,5 +124,5 @@ namespace cryptonote {
bool operator ==(const cryptonote::block& a, const cryptonote::block& b); bool operator ==(const cryptonote::block& a, const cryptonote::block& b);
} }
bool parse_hash256(const std::string str_hash, crypto::hash& hash); bool parse_hash256(const std::string &str_hash, crypto::hash& hash);

View File

@ -882,7 +882,7 @@ namespace cryptonote
{ {
if (decimal_point == (unsigned int)-1) if (decimal_point == (unsigned int)-1)
decimal_point = default_decimal_point; decimal_point = default_decimal_point;
switch (std::atomic_load(&default_decimal_point)) switch (decimal_point)
{ {
case 12: case 12:
return "monero"; return "monero";
@ -895,7 +895,7 @@ namespace cryptonote
case 0: case 0:
return "piconero"; return "piconero";
default: default:
ASSERT_MES_AND_THROW("Invalid decimal point specification: " << default_decimal_point); ASSERT_MES_AND_THROW("Invalid decimal point specification: " << decimal_point);
} }
} }
//--------------------------------------------------------------- //---------------------------------------------------------------

View File

@ -929,7 +929,7 @@ bool Blockchain::rollback_blockchain_switching(std::list<block>& original_chain,
m_hardfork->reorganize_from_chain_height(rollback_height); m_hardfork->reorganize_from_chain_height(rollback_height);
MINFO("Rollback to height " << rollback_height << " was successful."); MINFO("Rollback to height " << rollback_height << " was successful.");
if (original_chain.size()) if (!original_chain.empty())
{ {
MINFO("Restoration to previous blockchain successful as well."); MINFO("Restoration to previous blockchain successful as well.");
} }
@ -1484,7 +1484,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
// if block to be added connects to known blocks that aren't part of the // if block to be added connects to known blocks that aren't part of the
// main chain -- that is, if we're adding on to an alternate chain // main chain -- that is, if we're adding on to an alternate chain
if(alt_chain.size()) if(!alt_chain.empty())
{ {
// make sure alt chain doesn't somehow start past the end of the main chain // make sure alt chain doesn't somehow start past the end of the main chain
CHECK_AND_ASSERT_MES(m_db->height() > alt_chain.front()->second.height, false, "main blockchain wrong height"); CHECK_AND_ASSERT_MES(m_db->height() > alt_chain.front()->second.height, false, "main blockchain wrong height");
@ -1875,7 +1875,7 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& qbloc
// make sure the request includes at least the genesis block, otherwise // make sure the request includes at least the genesis block, otherwise
// how can we expect to sync from the client that the block list came from? // how can we expect to sync from the client that the block list came from?
if(!qblock_ids.size()) if(qblock_ids.empty())
{ {
MCERROR("net.p2p", "Client sent wrong NOTIFY_REQUEST_CHAIN: m_block_ids.size()=" << qblock_ids.size() << ", dropping connection"); MCERROR("net.p2p", "Client sent wrong NOTIFY_REQUEST_CHAIN: m_block_ids.size()=" << qblock_ids.size() << ", dropping connection");
return false; return false;

View File

@ -386,7 +386,7 @@ namespace cryptonote
return m_blockchain_storage.get_alternative_blocks_count(); return m_blockchain_storage.get_alternative_blocks_count();
} }
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
bool core::init(const boost::program_options::variables_map& vm, const char *config_subdir, const cryptonote::test_options *test_options, const GetCheckpointsCallback& get_checkpoints/* = nullptr */) bool core::init(const boost::program_options::variables_map& vm, const cryptonote::test_options *test_options, const GetCheckpointsCallback& get_checkpoints/* = nullptr */)
{ {
start_time = std::time(nullptr); start_time = std::time(nullptr);
@ -396,10 +396,6 @@ namespace cryptonote
m_nettype = FAKECHAIN; m_nettype = FAKECHAIN;
} }
bool r = handle_command_line(vm); bool r = handle_command_line(vm);
std::string m_config_folder_mempool = m_config_folder;
if (config_subdir)
m_config_folder_mempool = m_config_folder_mempool + "/" + config_subdir;
std::string db_type = command_line::get_arg(vm, cryptonote::arg_db_type); std::string db_type = command_line::get_arg(vm, cryptonote::arg_db_type);
std::string db_sync_mode = command_line::get_arg(vm, cryptonote::arg_db_sync_mode); std::string db_sync_mode = command_line::get_arg(vm, cryptonote::arg_db_sync_mode);
@ -831,7 +827,7 @@ namespace cryptonote
TRY_ENTRY(); TRY_ENTRY();
CRITICAL_REGION_LOCAL(m_incoming_tx_lock); CRITICAL_REGION_LOCAL(m_incoming_tx_lock);
struct result { bool res; cryptonote::transaction tx; crypto::hash hash; crypto::hash prefix_hash; bool in_txpool; bool in_blockchain; }; struct result { bool res; cryptonote::transaction tx; crypto::hash hash; crypto::hash prefix_hash; };
std::vector<result> results(tx_blobs.size()); std::vector<result> results(tx_blobs.size());
tvc.resize(tx_blobs.size()); tvc.resize(tx_blobs.size());

View File

@ -241,13 +241,12 @@ namespace cryptonote
* a miner instance with parameters given on the command line (or defaults) * a miner instance with parameters given on the command line (or defaults)
* *
* @param vm command line parameters * @param vm command line parameters
* @param config_subdir subdirectory for config storage
* @param test_options configuration options for testing * @param test_options configuration options for testing
* @param get_checkpoints if set, will be called to get checkpoints data, must return checkpoints data pointer and size or nullptr if there ain't any checkpoints for specific network type * @param get_checkpoints if set, will be called to get checkpoints data, must return checkpoints data pointer and size or nullptr if there ain't any checkpoints for specific network type
* *
* @return false if one of the init steps fails, otherwise true * @return false if one of the init steps fails, otherwise true
*/ */
bool init(const boost::program_options::variables_map& vm, const char *config_subdir = NULL, const test_options *test_options = NULL, const GetCheckpointsCallback& get_checkpoints = nullptr); bool init(const boost::program_options::variables_map& vm, const test_options *test_options = NULL, const GetCheckpointsCallback& get_checkpoints = nullptr);
/** /**
* @copydoc Blockchain::reset_and_set_genesis_block * @copydoc Blockchain::reset_and_set_genesis_block

View File

@ -198,7 +198,7 @@ namespace cryptonote
return addr.m_view_public_key; return addr.m_view_public_key;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
bool construct_tx_with_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, bool rct, rct::RangeProofType range_proof_type, rct::multisig_out *msout, bool shuffle_outs) bool construct_tx_with_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, bool rct, rct::RangeProofType range_proof_type, rct::multisig_out *msout, bool shuffle_outs)
{ {
hw::device &hwdev = sender_account_keys.get_device(); hw::device &hwdev = sender_account_keys.get_device();
@ -610,7 +610,7 @@ namespace cryptonote
return true; return true;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct, rct::RangeProofType range_proof_type, rct::multisig_out *msout) bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct, rct::RangeProofType range_proof_type, rct::multisig_out *msout)
{ {
hw::device &hwdev = sender_account_keys.get_device(); hw::device &hwdev = sender_account_keys.get_device();
hwdev.open_tx(tx_key); hwdev.open_tx(tx_key);
@ -633,7 +633,7 @@ namespace cryptonote
return r; return r;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time) bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time)
{ {
std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses; std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
subaddresses[sender_account_keys.m_account_address.m_spend_public_key] = {0,0}; subaddresses[sender_account_keys.m_account_address.m_spend_public_key] = {0,0};

View File

@ -89,9 +89,9 @@ namespace cryptonote
//--------------------------------------------------------------- //---------------------------------------------------------------
crypto::public_key get_destination_view_key_pub(const std::vector<tx_destination_entry> &destinations, const boost::optional<cryptonote::account_public_address>& change_addr); crypto::public_key get_destination_view_key_pub(const std::vector<tx_destination_entry> &destinations, const boost::optional<cryptonote::account_public_address>& change_addr);
bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry> &sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time); bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry> &sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time);
bool construct_tx_with_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, bool rct = false, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, rct::multisig_out *msout = NULL, bool shuffle_outs = true); bool construct_tx_with_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, bool rct = false, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, rct::multisig_out *msout = NULL, bool shuffle_outs = true);
bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, std::vector<uint8_t> extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct = false, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, rct::multisig_out *msout = NULL); bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map<crypto::public_key, subaddress_index>& subaddresses, std::vector<tx_source_entry>& sources, std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct = false, rct::RangeProofType range_proof_type = rct::RangeProofBorromean, rct::multisig_out *msout = NULL);
bool generate_genesis_block( bool generate_genesis_block(
block& bl block& bl

View File

@ -67,31 +67,16 @@ public:
m_core.set_cryptonote_protocol(&protocol); m_core.set_cryptonote_protocol(&protocol);
} }
std::string get_config_subdir() const
{
bool testnet = command_line::get_arg(m_vm_HACK, cryptonote::arg_testnet_on);
bool stagenet = command_line::get_arg(m_vm_HACK, cryptonote::arg_stagenet_on);
bool mainnet = !testnet && !stagenet;
std::string port = command_line::get_arg(m_vm_HACK, nodetool::arg_p2p_bind_port);
if ((mainnet && port != std::to_string(::config::P2P_DEFAULT_PORT))
|| (testnet && port != std::to_string(::config::testnet::P2P_DEFAULT_PORT))
|| (stagenet && port != std::to_string(::config::stagenet::P2P_DEFAULT_PORT))) {
return port;
}
return std::string();
}
bool run() bool run()
{ {
//initialize core here //initialize core here
MGINFO("Initializing core..."); MGINFO("Initializing core...");
std::string config_subdir = get_config_subdir();
#if defined(PER_BLOCK_CHECKPOINT) #if defined(PER_BLOCK_CHECKPOINT)
const cryptonote::GetCheckpointsCallback& get_checkpoints = blocks::GetCheckpointsData; const cryptonote::GetCheckpointsCallback& get_checkpoints = blocks::GetCheckpointsData;
#else #else
const cryptonote::GetCheckpointsCallback& get_checkpoints = nullptr; const cryptonote::GetCheckpointsCallback& get_checkpoints = nullptr;
#endif #endif
if (!m_core.init(m_vm_HACK, config_subdir.empty() ? NULL : config_subdir.c_str(), nullptr, get_checkpoints)) if (!m_core.init(m_vm_HACK, nullptr, get_checkpoints))
{ {
return false; return false;
} }

View File

@ -70,8 +70,9 @@ namespace {
} }
else else
{ {
return std::string{p_error_text}; std::string ret{p_error_text};
LocalFree(p_error_text); LocalFree(p_error_text);
return ret;
} }
} }

View File

@ -789,8 +789,6 @@ namespace hw {
} }
#ifdef DEBUG_HWDEVICE #ifdef DEBUG_HWDEVICE
bool recover_x = recover;
const crypto::secret_key recovery_key_x = recovery_key;
crypto::public_key pub_x; crypto::public_key pub_x;
crypto::secret_key sec_x; crypto::secret_key sec_x;
#endif #endif

View File

@ -444,7 +444,7 @@ namespace rct {
// this shows that sum inputs = sum outputs // this shows that sum inputs = sum outputs
//Ver: //Ver:
// verifies the above sig is created corretly // verifies the above sig is created corretly
mgSig proveRctMG(const key &message, const ctkeyM & pubs, const ctkeyV & inSk, const ctkeyV &outSk, const ctkeyV & outPk, const multisig_kLRki *kLRki, key *mscout, unsigned int index, key txnFeeKey, hw::device &hwdev) { mgSig proveRctMG(const key &message, const ctkeyM & pubs, const ctkeyV & inSk, const ctkeyV &outSk, const ctkeyV & outPk, const multisig_kLRki *kLRki, key *mscout, unsigned int index, const key &txnFeeKey, hw::device &hwdev) {
mgSig mg; mgSig mg;
//setup vars //setup vars
size_t cols = pubs.size(); size_t cols = pubs.size();
@ -534,7 +534,7 @@ namespace rct {
// this shows that sum inputs = sum outputs // this shows that sum inputs = sum outputs
//Ver: //Ver:
// verifies the above sig is created corretly // verifies the above sig is created corretly
bool verRctMG(const mgSig &mg, const ctkeyM & pubs, const ctkeyV & outPk, key txnFeeKey, const key &message) { bool verRctMG(const mgSig &mg, const ctkeyM & pubs, const ctkeyV & outPk, const key &txnFeeKey, const key &message) {
PERF_TIMER(verRctMG); PERF_TIMER(verRctMG);
//setup vars //setup vars
size_t cols = pubs.size(); size_t cols = pubs.size();

View File

@ -96,9 +96,9 @@ namespace rct {
// this shows that sum inputs = sum outputs // this shows that sum inputs = sum outputs
//Ver: //Ver:
// verifies the above sig is created corretly // verifies the above sig is created corretly
mgSig proveRctMG(const ctkeyM & pubs, const ctkeyV & inSk, const keyV &outMasks, const ctkeyV & outPk, const multisig_kLRki *kLRki, key *mscout, unsigned int index, key txnFee, const key &message, hw::device &hwdev); mgSig proveRctMG(const ctkeyM & pubs, const ctkeyV & inSk, const keyV &outMasks, const ctkeyV & outPk, const multisig_kLRki *kLRki, key *mscout, unsigned int index, const key &txnFee, const key &message, hw::device &hwdev);
mgSig proveRctMGSimple(const key & message, const ctkeyV & pubs, const ctkey & inSk, const key &a , const key &Cout, const multisig_kLRki *kLRki, key *mscout, unsigned int index, hw::device &hwdev); mgSig proveRctMGSimple(const key & message, const ctkeyV & pubs, const ctkey & inSk, const key &a , const key &Cout, const multisig_kLRki *kLRki, key *mscout, unsigned int index, hw::device &hwdev);
bool verRctMG(const mgSig &mg, const ctkeyM & pubs, const ctkeyV & outPk, key txnFee, const key &message); bool verRctMG(const mgSig &mg, const ctkeyM & pubs, const ctkeyV & outPk, const key &txnFee, const key &message);
bool verRctMGSimple(const key &message, const mgSig &mg, const ctkeyV & pubs, const key & C); bool verRctMGSimple(const key &message, const mgSig &mg, const ctkeyV & pubs, const key & C);
//These functions get keys from blockchain //These functions get keys from blockchain

View File

@ -1028,7 +1028,7 @@ namespace cryptonote
//------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------
// equivalent of strstr, but with arbitrary bytes (ie, NULs) // equivalent of strstr, but with arbitrary bytes (ie, NULs)
// This does not differentiate between "not found" and "found at offset 0" // This does not differentiate between "not found" and "found at offset 0"
uint64_t slow_memmem(const void* start_buff, size_t buflen,const void* pat,size_t patlen) size_t slow_memmem(const void* start_buff, size_t buflen,const void* pat,size_t patlen)
{ {
const void* buf = start_buff; const void* buf = start_buff;
const void* end=(const char*)buf+buflen; const void* end=(const char*)buf+buflen;

View File

@ -177,8 +177,6 @@ rapidjson::Value GetTransactions::Request::toJson(rapidjson::Document& doc) cons
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, tx_hashes, tx_hashes); INSERT_INTO_JSON_OBJECT(val, doc, tx_hashes, tx_hashes);
return val; return val;
@ -193,8 +191,6 @@ rapidjson::Value GetTransactions::Response::toJson(rapidjson::Document& doc) con
{ {
rapidjson::Value val(rapidjson::kObjectType); rapidjson::Value val(rapidjson::kObjectType);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, txs, txs); INSERT_INTO_JSON_OBJECT(val, doc, txs, txs);
INSERT_INTO_JSON_OBJECT(val, doc, missed_hashes, missed_hashes); INSERT_INTO_JSON_OBJECT(val, doc, missed_hashes, missed_hashes);
@ -212,8 +208,6 @@ rapidjson::Value KeyImagesSpent::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images); INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);
return val; return val;
@ -228,8 +222,6 @@ rapidjson::Value KeyImagesSpent::Response::toJson(rapidjson::Document& doc) cons
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, spent_status, spent_status); INSERT_INTO_JSON_OBJECT(val, doc, spent_status, spent_status);
return val; return val;
@ -245,8 +237,6 @@ rapidjson::Value GetTxGlobalOutputIndices::Request::toJson(rapidjson::Document&
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, tx_hash); INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, tx_hash);
return val; return val;
@ -261,8 +251,6 @@ rapidjson::Value GetTxGlobalOutputIndices::Response::toJson(rapidjson::Document&
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices); INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices);
return val; return val;
@ -277,8 +265,6 @@ rapidjson::Value SendRawTx::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, tx, tx); INSERT_INTO_JSON_OBJECT(val, doc, tx, tx);
INSERT_INTO_JSON_OBJECT(val, doc, relay, relay); INSERT_INTO_JSON_OBJECT(val, doc, relay, relay);
@ -295,8 +281,6 @@ rapidjson::Value SendRawTx::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, relayed, relayed); INSERT_INTO_JSON_OBJECT(val, doc, relayed, relayed);
return val; return val;
@ -312,8 +296,6 @@ rapidjson::Value StartMining::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, miner_address, miner_address); INSERT_INTO_JSON_OBJECT(val, doc, miner_address, miner_address);
INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count); INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
INSERT_INTO_JSON_OBJECT(val, doc, do_background_mining, do_background_mining); INSERT_INTO_JSON_OBJECT(val, doc, do_background_mining, do_background_mining);
@ -372,8 +354,6 @@ rapidjson::Value MiningStatus::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, active, active); INSERT_INTO_JSON_OBJECT(val, doc, active, active);
INSERT_INTO_JSON_OBJECT(val, doc, speed, speed); INSERT_INTO_JSON_OBJECT(val, doc, speed, speed);
INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count); INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
@ -406,8 +386,6 @@ rapidjson::Value GetInfo::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, info, info); INSERT_INTO_JSON_OBJECT(val, doc, info, info);
return val; return val;
@ -423,8 +401,6 @@ rapidjson::Value SaveBC::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
return val; return val;
} }
@ -436,8 +412,6 @@ rapidjson::Value SaveBC::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
return val; return val;
} }
@ -450,8 +424,6 @@ rapidjson::Value GetBlockHash::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, height, height); INSERT_INTO_JSON_OBJECT(val, doc, height, height);
return val; return val;
@ -466,8 +438,6 @@ rapidjson::Value GetBlockHash::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, hash, hash); INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);
return val; return val;
@ -483,8 +453,6 @@ rapidjson::Value GetLastBlockHeader::Request::toJson(rapidjson::Document& doc) c
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
return val; return val;
} }
@ -496,8 +464,6 @@ rapidjson::Value GetLastBlockHeader::Response::toJson(rapidjson::Document& doc)
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, header, header); INSERT_INTO_JSON_OBJECT(val, doc, header, header);
return val; return val;
@ -513,8 +479,6 @@ rapidjson::Value GetBlockHeaderByHash::Request::toJson(rapidjson::Document& doc)
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, hash, hash); INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);
return val; return val;
@ -529,8 +493,6 @@ rapidjson::Value GetBlockHeaderByHash::Response::toJson(rapidjson::Document& doc
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, header, header); INSERT_INTO_JSON_OBJECT(val, doc, header, header);
return val; return val;
@ -546,8 +508,6 @@ rapidjson::Value GetBlockHeaderByHeight::Request::toJson(rapidjson::Document& do
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, height, height); INSERT_INTO_JSON_OBJECT(val, doc, height, height);
return val; return val;
@ -562,8 +522,6 @@ rapidjson::Value GetBlockHeaderByHeight::Response::toJson(rapidjson::Document& d
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, header, header); INSERT_INTO_JSON_OBJECT(val, doc, header, header);
return val; return val;
@ -579,8 +537,6 @@ rapidjson::Value GetBlockHeadersByHeight::Request::toJson(rapidjson::Document& d
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, heights, heights); INSERT_INTO_JSON_OBJECT(val, doc, heights, heights);
return val; return val;
@ -595,8 +551,6 @@ rapidjson::Value GetBlockHeadersByHeight::Response::toJson(rapidjson::Document&
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, headers, headers); INSERT_INTO_JSON_OBJECT(val, doc, headers, headers);
return val; return val;
@ -612,8 +566,6 @@ rapidjson::Value GetPeerList::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
return val; return val;
} }
@ -625,8 +577,6 @@ rapidjson::Value GetPeerList::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, white_list, white_list); INSERT_INTO_JSON_OBJECT(val, doc, white_list, white_list);
INSERT_INTO_JSON_OBJECT(val, doc, gray_list, gray_list); INSERT_INTO_JSON_OBJECT(val, doc, gray_list, gray_list);
@ -679,8 +629,6 @@ rapidjson::Value GetTransactionPool::Response::toJson(rapidjson::Document& doc)
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, transactions, transactions); INSERT_INTO_JSON_OBJECT(val, doc, transactions, transactions);
INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images); INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);
@ -698,8 +646,6 @@ rapidjson::Value HardForkInfo::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, version, version); INSERT_INTO_JSON_OBJECT(val, doc, version, version);
return val; return val;
@ -714,8 +660,6 @@ rapidjson::Value HardForkInfo::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, info, info); INSERT_INTO_JSON_OBJECT(val, doc, info, info);
return val; return val;
@ -731,8 +675,6 @@ rapidjson::Value GetOutputHistogram::Request::toJson(rapidjson::Document& doc) c
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts); INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
INSERT_INTO_JSON_OBJECT(val, doc, min_count, min_count); INSERT_INTO_JSON_OBJECT(val, doc, min_count, min_count);
INSERT_INTO_JSON_OBJECT(val, doc, max_count, max_count); INSERT_INTO_JSON_OBJECT(val, doc, max_count, max_count);
@ -755,8 +697,6 @@ rapidjson::Value GetOutputHistogram::Response::toJson(rapidjson::Document& doc)
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, histogram, histogram); INSERT_INTO_JSON_OBJECT(val, doc, histogram, histogram);
return val; return val;
@ -772,8 +712,6 @@ rapidjson::Value GetOutputKeys::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, outputs, outputs); INSERT_INTO_JSON_OBJECT(val, doc, outputs, outputs);
return val; return val;
@ -788,8 +726,6 @@ rapidjson::Value GetOutputKeys::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, keys, keys); INSERT_INTO_JSON_OBJECT(val, doc, keys, keys);
return val; return val;
@ -814,8 +750,6 @@ rapidjson::Value GetRPCVersion::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, version, version); INSERT_INTO_JSON_OBJECT(val, doc, version, version);
return val; return val;
@ -830,8 +764,6 @@ rapidjson::Value GetFeeEstimate::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, num_grace_blocks, num_grace_blocks); INSERT_INTO_JSON_OBJECT(val, doc, num_grace_blocks, num_grace_blocks);
return val; return val;
@ -846,8 +778,6 @@ rapidjson::Value GetFeeEstimate::Response::toJson(rapidjson::Document& doc) cons
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, estimated_base_fee, estimated_base_fee); INSERT_INTO_JSON_OBJECT(val, doc, estimated_base_fee, estimated_base_fee);
INSERT_INTO_JSON_OBJECT(val, doc, fee_mask, fee_mask); INSERT_INTO_JSON_OBJECT(val, doc, fee_mask, fee_mask);
INSERT_INTO_JSON_OBJECT(val, doc, size_scale, size_scale); INSERT_INTO_JSON_OBJECT(val, doc, size_scale, size_scale);
@ -867,7 +797,6 @@ void GetFeeEstimate::Response::fromJson(rapidjson::Value& val)
rapidjson::Value GetOutputDistribution::Request::toJson(rapidjson::Document& doc) const rapidjson::Value GetOutputDistribution::Request::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts); INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
INSERT_INTO_JSON_OBJECT(val, doc, from_height, from_height); INSERT_INTO_JSON_OBJECT(val, doc, from_height, from_height);
@ -888,7 +817,6 @@ void GetOutputDistribution::Request::fromJson(rapidjson::Value& val)
rapidjson::Value GetOutputDistribution::Response::toJson(rapidjson::Document& doc) const rapidjson::Value GetOutputDistribution::Response::toJson(rapidjson::Document& doc) const
{ {
auto val = Message::toJson(doc); auto val = Message::toJson(doc);
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, status, status); INSERT_INTO_JSON_OBJECT(val, doc, status, status);
INSERT_INTO_JSON_OBJECT(val, doc, distributions, distributions); INSERT_INTO_JSON_OBJECT(val, doc, distributions, distributions);

View File

@ -6733,7 +6733,6 @@ static std::string get_human_readable_timestamp(uint64_t ts)
struct tm tm; struct tm tm;
epee::misc_utils::get_gmt_time(tt, tm); epee::misc_utils::get_gmt_time(tt, tm);
uint64_t now = time(NULL); uint64_t now = time(NULL);
uint64_t diff = ts > now ? ts - now : now - ts;
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tm); strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tm);
return std::string(buffer); return std::string(buffer);
} }

View File

@ -1376,8 +1376,6 @@ void wallet2::scan_output(const cryptonote::transaction &tx, const crypto::publi
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
void wallet2::cache_tx_data(const cryptonote::transaction& tx, const crypto::hash &txid, tx_cache_data &tx_cache_data) const void wallet2::cache_tx_data(const cryptonote::transaction& tx, const crypto::hash &txid, tx_cache_data &tx_cache_data) const
{ {
const cryptonote::account_keys& keys = m_account.get_keys();
if(!parse_tx_extra(tx.extra, tx_cache_data.tx_extra_fields)) if(!parse_tx_extra(tx.extra, tx_cache_data.tx_extra_fields))
{ {
// Extra may only be partially parsed, it's OK if tx_extra_fields contains public key // Extra may only be partially parsed, it's OK if tx_extra_fields contains public key
@ -4314,7 +4312,7 @@ std::string wallet2::make_multisig(const epee::wipeable_string &password,
return make_multisig(password, secret_keys, public_keys, threshold); return make_multisig(password, secret_keys, public_keys, threshold);
} }
bool wallet2::finalize_multisig(const epee::wipeable_string &password, std::unordered_set<crypto::public_key> pkeys, std::vector<crypto::public_key> signers) bool wallet2::finalize_multisig(const epee::wipeable_string &password, const std::unordered_set<crypto::public_key> &pkeys, std::vector<crypto::public_key> signers)
{ {
exchange_multisig_keys(password, pkeys, signers); exchange_multisig_keys(password, pkeys, signers);
return true; return true;
@ -8154,7 +8152,6 @@ void wallet2::light_wallet_get_address_txs()
// for balance calculation // for balance calculation
uint64_t wallet_total_sent = 0; uint64_t wallet_total_sent = 0;
uint64_t wallet_total_unlocked_sent = 0;
// txs in pool // txs in pool
std::vector<crypto::hash> pool_txs; std::vector<crypto::hash> pool_txs;
@ -10469,7 +10466,7 @@ const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& w
return m_account_tags; return m_account_tags;
} }
void wallet2::set_account_tag(const std::set<uint32_t> account_indices, const std::string& tag) void wallet2::set_account_tag(const std::set<uint32_t> &account_indices, const std::string& tag)
{ {
for (uint32_t account_index : account_indices) for (uint32_t account_index : account_indices)
{ {
@ -11377,7 +11374,6 @@ cryptonote::blobdata wallet2::export_multisig()
for (size_t n = 0; n < m_transfers.size(); ++n) for (size_t n = 0; n < m_transfers.size(); ++n)
{ {
transfer_details &td = m_transfers[n]; transfer_details &td = m_transfers[n];
const std::vector<crypto::public_key> additional_tx_pub_keys = get_additional_tx_pub_keys_from_extra(td.m_tx);
crypto::key_image ki; crypto::key_image ki;
td.m_multisig_k.clear(); td.m_multisig_k.clear();
info[n].m_LR.clear(); info[n].m_LR.clear();
@ -11409,7 +11405,6 @@ cryptonote::blobdata wallet2::export_multisig()
boost::archive::portable_binary_oarchive ar(oss); boost::archive::portable_binary_oarchive ar(oss);
ar << info; ar << info;
std::string magic(MULTISIG_EXPORT_FILE_MAGIC, strlen(MULTISIG_EXPORT_FILE_MAGIC));
const cryptonote::account_public_address &keys = get_account().get_keys().m_account_address; const cryptonote::account_public_address &keys = get_account().get_keys().m_account_address;
std::string header; std::string header;
header += std::string((const char *)&keys.m_spend_public_key, sizeof(crypto::public_key)); header += std::string((const char *)&keys.m_spend_public_key, sizeof(crypto::public_key));

View File

@ -594,7 +594,7 @@ namespace tools
/*! /*!
* \brief Finalizes creation of a multisig wallet * \brief Finalizes creation of a multisig wallet
*/ */
bool finalize_multisig(const epee::wipeable_string &password, std::unordered_set<crypto::public_key> pkeys, std::vector<crypto::public_key> signers); bool finalize_multisig(const epee::wipeable_string &password, const std::unordered_set<crypto::public_key> &pkeys, std::vector<crypto::public_key> signers);
/*! /*!
* Get a packaged multisig information string * Get a packaged multisig information string
*/ */
@ -1047,7 +1047,7 @@ namespace tools
* \param account_indices Indices of accounts. * \param account_indices Indices of accounts.
* \param tag Tag's name. If empty, the accounts become untagged. * \param tag Tag's name. If empty, the accounts become untagged.
*/ */
void set_account_tag(const std::set<uint32_t> account_indices, const std::string& tag); void set_account_tag(const std::set<uint32_t> &account_indices, const std::string& tag);
/*! /*!
* \brief Set the label of the given tag. * \brief Set the label of the given tag.
* \param tag Tag's name (which must be non-empty). * \param tag Tag's name (which must be non-empty).

View File

@ -2891,6 +2891,7 @@ namespace tools
cryptonote::COMMAND_RPC_GET_HEIGHT::response hres; cryptonote::COMMAND_RPC_GET_HEIGHT::response hres;
hres.height = 0; hres.height = 0;
bool r = wal->invoke_http_json("/getheight", hreq, hres); bool r = wal->invoke_http_json("/getheight", hreq, hres);
if (r)
wal->set_refresh_from_block_height(hres.height); wal->set_refresh_from_block_height(hres.height);
crypto::secret_key dummy_key; crypto::secret_key dummy_key;
try { try {

View File

@ -511,7 +511,7 @@ inline bool do_replay_events(std::vector<test_event_entry>& events)
// FIXME: make sure that vm has arg_testnet_on set to true or false if // FIXME: make sure that vm has arg_testnet_on set to true or false if
// this test needs for it to be so. // this test needs for it to be so.
get_test_options<t_test_class> gto; get_test_options<t_test_class> gto;
if (!c.init(vm, NULL, &gto.test_options)) if (!c.init(vm, &gto.test_options))
{ {
MERROR("Failed to init core"); MERROR("Failed to init core");
return false; return false;

View File

@ -54,9 +54,6 @@ bool test_transaction_generation_and_ring_signature()
account_base miner_acc6; account_base miner_acc6;
miner_acc6.generate(); miner_acc6.generate();
std::string add_str = miner_acc3.get_public_address_str(MAINNET);
account_base rv_acc; account_base rv_acc;
rv_acc.generate(); rv_acc.generate();
account_base rv_acc2; account_base rv_acc2;

View File

@ -75,7 +75,6 @@ namespace
*/ */
void test_language(const Language::Base &language) void test_language(const Language::Base &language)
{ {
const std::vector<std::string> &word_list = language.get_word_list();
epee::wipeable_string w_seed = "", w_return_seed = ""; epee::wipeable_string w_seed = "", w_return_seed = "";
std::string seed, return_seed; std::string seed, return_seed;
// Generate a random seed without checksum // Generate a random seed without checksum

View File

@ -112,7 +112,7 @@ static void make_wallets(std::vector<tools::wallet2>& wallets, unsigned int M)
} }
for (auto& wallet: wallets) { for (auto& wallet: wallets) {
ASSERT_FALSE(wallet.multisig() || wallet.multisig() || wallet.multisig()); ASSERT_FALSE(wallet.multisig());
} }
std::vector<std::string> mxis; std::vector<std::string> mxis;

View File

@ -968,8 +968,6 @@ static rctSig make_sig()
#define TEST_rctSig_elements(name, op) \ #define TEST_rctSig_elements(name, op) \
TEST(ringct, rctSig_##name) \ TEST(ringct, rctSig_##name) \
{ \ { \
const uint64_t inputs[] = {1000, 1000}; \
const uint64_t outputs[] = {1000, 1000}; \
rct::rctSig sig = make_sig(); \ rct::rctSig sig = make_sig(); \
ASSERT_TRUE(rct::verRct(sig)); \ ASSERT_TRUE(rct::verRct(sig)); \
op; \ op; \

View File

@ -45,7 +45,7 @@
//#define VERBOSE //#define VERBOSE
#ifdef TEST_ORIGINAL #ifdef TEST_ORIGINAL
uint64_t slow_memmem_original(void* start_buff, size_t buflen,void* pat,size_t patlen) size_t slow_memmem_original(void* start_buff, size_t buflen,void* pat,size_t patlen)
{ {
void* buf = start_buff; void* buf = start_buff;
void* end=(char*)buf+buflen-patlen; void* end=(char*)buf+buflen-patlen;
@ -63,7 +63,7 @@ uint64_t slow_memmem_original(void* start_buff, size_t buflen,void* pat,size_t p
#define slow_memmem slow_memmem_original #define slow_memmem slow_memmem_original
#else #else
namespace cryptonote { namespace cryptonote {
uint64_t slow_memmem(const void* start_buff, size_t buflen,const void* pat,size_t patlen); size_t slow_memmem(const void* start_buff, size_t buflen,const void* pat,size_t patlen);
} }
using namespace cryptonote; using namespace cryptonote;
#endif #endif
@ -73,7 +73,7 @@ static const struct {
const char *buf; const char *buf;
size_t patlen; size_t patlen;
const char *pat; const char *pat;
uint64_t res; size_t res;
} T[]={ } T[]={
{0,"",0,"",0}, {0,"",0,"",0},
{1,"",0,"",0}, {1,"",0,"",0},
@ -117,7 +117,7 @@ TEST(slowmem,Success)
memcpy(buf,T[n].buf,T[n].buflen); memcpy(buf,T[n].buf,T[n].buflen);
void *pat=malloc(T[n].patlen); void *pat=malloc(T[n].patlen);
memcpy(pat,T[n].pat,T[n].patlen); memcpy(pat,T[n].pat,T[n].patlen);
uint64_t res=slow_memmem(buf,T[n].buflen,pat,T[n].patlen); size_t res=slow_memmem(buf,T[n].buflen,pat,T[n].patlen);
free(pat); free(pat);
free(buf); free(buf);
ASSERT_EQ(res,T[n].res); ASSERT_EQ(res,T[n].res);

View File

@ -49,7 +49,7 @@ class WalletSubaddress : public ::testing::Test
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG_ERROR("failed to generate wallet: " << e.what()); LOG_ERROR("failed to generate wallet: " << e.what());
throw e; throw;
} }
w1.add_subaddress_account(test_label); w1.add_subaddress_account(test_label);