Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aa6850c71d | |||
| e18cb33e08 | |||
| f1cdcba95e | |||
| ed273a88d2 | |||
| c79fe98b71 | |||
| e05a17f1ea | |||
| 9205bba38a | |||
| 9bde29cb23 | |||
| b25c9ee183 | |||
| 252e834800 | |||
| ace614612b | |||
| 23edf8901f | |||
| 91de2f812f | |||
| 2a1a208b2b | |||
| df688e0ec5 | |||
| 770c0189d0 | |||
| 38ef5f8b51 | |||
| aabe3eedb8 | |||
| ffe9d8821a | |||
| 7f33e07da3 | |||
| 13184bc41e | |||
| d6074be56b | |||
| 41cb11b211 | |||
| 96405bcaa0 | |||
| 86c63b8e15 | |||
| fac173d831 | |||
| 9ccd84b271 | |||
| cc9dd7a64a | |||
| 80b673dcad | |||
| e452e57a39 | |||
| f24c970f96 | |||
| bab5bbfc19 | |||
| 20ef37bbca | |||
| 40070a661f | |||
| 00dd93971a | |||
| fa958d4b4b | |||
| ede213f65c | |||
| 4980d3c0c9 | |||
| e8e2bd5212 | |||
| 2ade8dfb02 | |||
| 2e336347ec | |||
| af6febaa83 | |||
| 715754d7fd | |||
| bb8c0f62be | |||
| 16b2022991 | |||
| 409bf2d642 | |||
| 333c7edeb9 | |||
| 78011db913 | |||
| ec439a9376 | |||
| 6d8498be1f | |||
| b085e11b52 | |||
| 123c0d7d4c | |||
| a48658017b | |||
| 8636599654 | |||
| 31b31effc2 | |||
| 57a1bcb6b9 | |||
| fde2a31964 | |||
| 2b16afedf9 | |||
| 3384b0f0f4 | |||
| 44b3c9bd55 | |||
| f09edc9fad | |||
| 6fec5f9fdc | |||
| 4b89d877d7 | |||
| c0e22ebcca | |||
| 76817605bd | |||
| e2b72da4ed | |||
| c677421594 | |||
| 1e20d705e7 | |||
| 9e1f8bfaa3 | |||
| c7b66d3d8c | |||
| 80dc5d2110 | |||
| 9670c917d1 | |||
| d003f07c59 | |||
| df9d59caff | |||
| e962216678 | |||
| 5ef4bf05c5 | |||
| e561a0c329 | |||
| 0299d36e76 | |||
| 26dc764ab0 | |||
| fe427170b9 | |||
| 41b95ad40e | |||
| 7d0505c85d | |||
| 96370488c0 | |||
| 9dc67af187 | |||
| bc4d53bece | |||
| 41a66bf05b | |||
| 3edef51d70 | |||
| 4a9794e033 | |||
| a9e2993258 | |||
| 5b8afd43ac | |||
| 9ae9f6ada6 | |||
| a4feeb4238 | |||
| e89f33634d | |||
| dd527d9369 | |||
| 1e792c3e26 | |||
| 3c7d7bc324 | |||
| 51a4cc0fad | |||
| 7bd9b62db6 | |||
| 178c11f4a4 | |||
| 5eeeec39f6 | |||
| 91a61fea55 | |||
| 8daba22f92 | |||
| d481410bff | |||
| 58f6607382 | |||
| 2897c269de | |||
| cdf9ecfd0f | |||
| d400b4d360 | |||
| 4c6ff21cc6 | |||
| 2012cbe9b5 | |||
| 7090121b13 | |||
| 9fce7614c1 | |||
| 35e205cc13 | |||
| 892500549a | |||
| 0f3ff8ce2c | |||
| da5de484f2 | |||
| 4c0545cc41 | |||
| a71e4dabe8 | |||
| 8ff2cc751d | |||
| c29890c2c0 | |||
| 32bd639b4b | |||
| 202b6519a3 | |||
| 4396ff8501 | |||
| 68118645e6 | |||
| 8ce0cfc73a | |||
| d27f86041c | |||
| 5e7dbe01b0 | |||
| fb21032a7d | |||
| c31780678e | |||
| c1e16fdffa | |||
| d4d1afd688 |
@@ -452,9 +452,12 @@ link_directories(${LIBUNWIND_LIBRARY_DIRS})
|
||||
|
||||
# Final setup for libpcsc
|
||||
if (PCSC_FOUND)
|
||||
message(STATUS "Using PCSC include dir at ${PCSC_INCLUDE_DIR}")
|
||||
add_definitions(-DHAVE_PCSC)
|
||||
include_directories(${PCSC_INCLUDE_DIR})
|
||||
link_directories(${LIBPCSC_LIBRARY_DIRS})
|
||||
else (PCSC_FOUND)
|
||||
message(STATUS "Could not find PCSC")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
||||
@@ -16,6 +16,11 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
|
||||
- Our [Vulnerability Response Process](https://github.com/monero-project/meta/blob/master/VULNERABILITY_RESPONSE_PROCESS.md) encourages responsible disclosure
|
||||
- We are also available via [HackerOne](https://hackerone.com/monero)
|
||||
|
||||
|
||||
## Announcements
|
||||
|
||||
You can subscribe to an [announcement listserv](https://lists.getmonero.org) to get critical announcements from the Monero core team. The announcement list can be very helpful for knowing when software updates are needed.
|
||||
|
||||
## Build
|
||||
|
||||
| Operating System | Processor | Status |
|
||||
|
||||
@@ -18,6 +18,9 @@ ENDIF (NOT WIN32)
|
||||
|
||||
FIND_PATH(PCSC_INCLUDE_DIR winscard.h
|
||||
HINTS
|
||||
IF (WIN32)
|
||||
${MSYS2_FOLDER}/mingw64/x86_64-w64-mingw32/include
|
||||
ENDIF (WIN32)
|
||||
/usr/include/PCSC
|
||||
${PC_PCSC_INCLUDEDIR}
|
||||
${PC_PCSC_INCLUDE_DIRS}
|
||||
@@ -26,6 +29,9 @@ FIND_PATH(PCSC_INCLUDE_DIR winscard.h
|
||||
|
||||
FIND_LIBRARY(PCSC_LIBRARY NAMES pcsclite libpcsclite WinSCard PCSC
|
||||
HINTS
|
||||
IF (WIN32)
|
||||
${MSYS2_FOLDER}/mingw64/x86_64-w64-mingw32/lib
|
||||
ENDIF (WIN32)
|
||||
${PC_PCSC_LIBDIR}
|
||||
${PC_PCSC_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
|
||||
function (write_static_version_header hash)
|
||||
set(VERSIONTAG "${hash}")
|
||||
configure_file("src/version.cpp.in" "version.cpp")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
|
||||
endfunction ()
|
||||
|
||||
find_package(Git QUIET)
|
||||
|
||||
Vendored
+2
-2
@@ -7231,7 +7231,7 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data,
|
||||
|
||||
dkey.mv_size = 0;
|
||||
|
||||
if (flags == MDB_CURRENT) {
|
||||
if (flags & MDB_CURRENT) {
|
||||
if (!(mc->mc_flags & C_INITIALIZED))
|
||||
return EINVAL;
|
||||
rc = MDB_SUCCESS;
|
||||
@@ -7624,7 +7624,7 @@ put_sub:
|
||||
xdata.mv_size = 0;
|
||||
xdata.mv_data = "";
|
||||
leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
|
||||
if (flags & MDB_CURRENT) {
|
||||
if (flags == MDB_CURRENT) {
|
||||
xflags = MDB_CURRENT|MDB_NOSPILL;
|
||||
} else {
|
||||
mdb_xcursor_init1(mc, leaf);
|
||||
|
||||
+8
-4
@@ -78,6 +78,7 @@ static void readhdr(void)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
flags = 0;
|
||||
while (fgets(dbuf.mv_data, dbuf.mv_size, stdin) != NULL) {
|
||||
lineno++;
|
||||
if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) {
|
||||
@@ -303,7 +304,7 @@ int main(int argc, char *argv[])
|
||||
MDB_cursor *mc;
|
||||
MDB_dbi dbi;
|
||||
char *envname;
|
||||
int envflags = 0, putflags = 0;
|
||||
int envflags = MDB_NOSYNC, putflags = 0;
|
||||
int dohdr = 0, append = 0;
|
||||
MDB_val prevk;
|
||||
|
||||
@@ -391,13 +392,11 @@ int main(int argc, char *argv[])
|
||||
kbuf.mv_data = malloc(kbuf.mv_size * 2);
|
||||
k0buf.mv_size = kbuf.mv_size;
|
||||
k0buf.mv_data = (char *)kbuf.mv_data + kbuf.mv_size;
|
||||
prevk.mv_size = 0;
|
||||
prevk.mv_data = k0buf.mv_data;
|
||||
|
||||
while(!Eof) {
|
||||
MDB_val key, data;
|
||||
int batch = 0;
|
||||
flags = 0;
|
||||
int appflag;
|
||||
|
||||
if (!dohdr) {
|
||||
@@ -416,6 +415,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "mdb_open failed, error %d %s\n", rc, mdb_strerror(rc));
|
||||
goto txn_abort;
|
||||
}
|
||||
prevk.mv_size = 0;
|
||||
if (append) {
|
||||
mdb_set_compare(txn, dbi, greater);
|
||||
if (flags & MDB_DUPSORT)
|
||||
@@ -443,7 +443,7 @@ int main(int argc, char *argv[])
|
||||
appflag = MDB_APPEND;
|
||||
if (flags & MDB_DUPSORT) {
|
||||
if (prevk.mv_size == key.mv_size && !memcmp(prevk.mv_data, key.mv_data, key.mv_size))
|
||||
appflag = MDB_APPENDDUP;
|
||||
appflag = MDB_CURRENT|MDB_APPENDDUP;
|
||||
else {
|
||||
memcpy(prevk.mv_data, key.mv_data, key.mv_size);
|
||||
prevk.mv_size = key.mv_size;
|
||||
@@ -477,6 +477,10 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
|
||||
goto txn_abort;
|
||||
}
|
||||
if (appflag & MDB_APPENDDUP) {
|
||||
MDB_val k, d;
|
||||
mdb_cursor_get(mc, &k, &d, MDB_LAST);
|
||||
}
|
||||
batch = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1496,6 +1496,8 @@ public:
|
||||
*/
|
||||
virtual std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> get_output_histogram(const std::vector<uint64_t> &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count) const = 0;
|
||||
|
||||
virtual bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector<uint64_t> &distribution, uint64_t &base) const = 0;
|
||||
|
||||
/**
|
||||
* @brief is BlockchainDB in read-only mode?
|
||||
*
|
||||
|
||||
@@ -3179,6 +3179,47 @@ std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> BlockchainLMDB::get
|
||||
return histogram;
|
||||
}
|
||||
|
||||
bool BlockchainLMDB::get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector<uint64_t> &distribution, uint64_t &base) const
|
||||
{
|
||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||
check_open();
|
||||
|
||||
TXN_PREFIX_RDONLY();
|
||||
RCURSOR(output_amounts);
|
||||
|
||||
distribution.clear();
|
||||
const uint64_t db_height = height();
|
||||
if (from_height >= db_height)
|
||||
return false;
|
||||
distribution.resize(db_height - from_height, 0);
|
||||
|
||||
bool fret = true;
|
||||
MDB_val_set(k, amount);
|
||||
MDB_val v;
|
||||
MDB_cursor_op op = MDB_SET;
|
||||
while (1)
|
||||
{
|
||||
int ret = mdb_cursor_get(m_cur_output_amounts, &k, &v, op);
|
||||
op = MDB_NEXT_DUP;
|
||||
if (ret == MDB_NOTFOUND)
|
||||
break;
|
||||
if (ret)
|
||||
throw0(DB_ERROR("Failed to enumerate outputs"));
|
||||
const outkey *ok = (const outkey *)v.mv_data;
|
||||
const uint64_t height = ok->data.height;
|
||||
if (height >= from_height)
|
||||
distribution[height - from_height]++;
|
||||
else
|
||||
base++;
|
||||
if (to_height > 0 && height > to_height)
|
||||
break;
|
||||
}
|
||||
|
||||
TXN_POSTFIX_RDONLY();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlockchainLMDB::check_hard_fork_info()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -293,6 +293,8 @@ public:
|
||||
*/
|
||||
std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> get_output_histogram(const std::vector<uint64_t> &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count) const;
|
||||
|
||||
bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector<uint64_t> &distribution, uint64_t &base) const;
|
||||
|
||||
private:
|
||||
void do_resize(uint64_t size_increase=0);
|
||||
|
||||
|
||||
Binary file not shown.
@@ -207,7 +207,7 @@ namespace cryptonote
|
||||
ADD_CHECKPOINT(1390000, "a8f5649dd4ded60eedab475f2bec8c934681c07e3cf640e9be0617554f13ff6c");
|
||||
ADD_CHECKPOINT(1450000, "ac94e8860093bc7c83e4e91215cba1d663421ecf4067a0ae609c3a8b52bcfac2");
|
||||
ADD_CHECKPOINT(1530000, "01759bce497ec38e63c78b1038892169203bb78f87e488172f6b854fcd63ba7e");
|
||||
|
||||
ADD_CHECKPOINT(1579000, "7d0d7a2346373afd41ed1e744a939fc5d474a7dbaa257be5c6fff4009e789241");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -73,14 +73,14 @@ namespace crypto {
|
||||
static_assert(sizeof(chacha_key) <= sizeof(hash), "Size of hash must be at least that of chacha_key");
|
||||
tools::scrubbed_arr<char, HASH_SIZE> pwd_hash;
|
||||
crypto::cn_slow_hash(data, size, pwd_hash.data(), 0/*variant*/, 0/*prehashed*/);
|
||||
memcpy(&key, pwd_hash.data(), sizeof(key));
|
||||
memcpy(&unwrap(key), pwd_hash.data(), sizeof(key));
|
||||
}
|
||||
|
||||
inline void generate_chacha_key_prehashed(const void *data, size_t size, chacha_key& key) {
|
||||
static_assert(sizeof(chacha_key) <= sizeof(hash), "Size of hash must be at least that of chacha_key");
|
||||
tools::scrubbed_arr<char, HASH_SIZE> pwd_hash;
|
||||
crypto::cn_slow_hash(data, size, pwd_hash.data(), 0/*variant*/, 1/*prehashed*/);
|
||||
memcpy(&key, pwd_hash.data(), sizeof(key));
|
||||
memcpy(&unwrap(key), pwd_hash.data(), sizeof(key));
|
||||
}
|
||||
|
||||
inline void generate_chacha_key(std::string password, chacha_key& key) {
|
||||
|
||||
+10
-10
@@ -124,9 +124,9 @@ namespace crypto {
|
||||
random_scalar(rng);
|
||||
}
|
||||
sec = rng;
|
||||
sc_reduce32(&sec); // reduce in case second round of keys (sendkeys)
|
||||
sc_reduce32(&unwrap(sec)); // reduce in case second round of keys (sendkeys)
|
||||
|
||||
ge_scalarmult_base(&point, &sec);
|
||||
ge_scalarmult_base(&point, &unwrap(sec));
|
||||
ge_p3_tobytes(&pub, &point);
|
||||
|
||||
return rng;
|
||||
@@ -139,10 +139,10 @@ namespace crypto {
|
||||
|
||||
bool crypto_ops::secret_key_to_public_key(const secret_key &sec, public_key &pub) {
|
||||
ge_p3 point;
|
||||
if (sc_check(&sec) != 0) {
|
||||
if (sc_check(&unwrap(sec)) != 0) {
|
||||
return false;
|
||||
}
|
||||
ge_scalarmult_base(&point, &sec);
|
||||
ge_scalarmult_base(&point, &unwrap(sec));
|
||||
ge_p3_tobytes(&pub, &point);
|
||||
return true;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace crypto {
|
||||
if (ge_frombytes_vartime(&point, &key1) != 0) {
|
||||
return false;
|
||||
}
|
||||
ge_scalarmult(&point2, &key2, &point);
|
||||
ge_scalarmult(&point2, &unwrap(key2), &point);
|
||||
ge_mul8(&point3, &point2);
|
||||
ge_p1p1_to_p2(&point2, &point3);
|
||||
ge_tobytes(&derivation, &point2);
|
||||
@@ -199,7 +199,7 @@ namespace crypto {
|
||||
ec_scalar scalar;
|
||||
assert(sc_check(&base) == 0);
|
||||
derivation_to_scalar(derivation, output_index, scalar);
|
||||
sc_add(&derived_key, &base, &scalar);
|
||||
sc_add(&unwrap(derived_key), &unwrap(base), &scalar);
|
||||
}
|
||||
|
||||
bool crypto_ops::derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &derived_key) {
|
||||
@@ -254,7 +254,7 @@ namespace crypto {
|
||||
ge_scalarmult_base(&tmp3, &k);
|
||||
ge_p3_tobytes(&buf.comm, &tmp3);
|
||||
hash_to_scalar(&buf, sizeof(s_comm), sig.c);
|
||||
sc_mulsub(&sig.r, &sig.c, &sec, &k);
|
||||
sc_mulsub(&sig.r, &sig.c, &unwrap(sec), &k);
|
||||
}
|
||||
|
||||
bool crypto_ops::check_signature(const hash &prefix_hash, const public_key &pub, const signature &sig) {
|
||||
@@ -347,7 +347,7 @@ namespace crypto {
|
||||
hash_to_scalar(&buf, sizeof(buf), sig.c);
|
||||
|
||||
// sig.r = k - sig.c*r
|
||||
sc_mulsub(&sig.r, &sig.c, &r, &k);
|
||||
sc_mulsub(&sig.r, &sig.c, &unwrap(r), &k);
|
||||
}
|
||||
|
||||
bool crypto_ops::check_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const boost::optional<public_key> &B, const public_key &D, const signature &sig) {
|
||||
@@ -451,7 +451,7 @@ namespace crypto {
|
||||
ge_p2 point2;
|
||||
assert(sc_check(&sec) == 0);
|
||||
hash_to_ec(pub, point);
|
||||
ge_scalarmult(&point2, &sec, &point);
|
||||
ge_scalarmult(&point2, &unwrap(sec), &point);
|
||||
ge_tobytes(&image, &point2);
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ POP_WARNINGS
|
||||
}
|
||||
hash_to_scalar(buf.get(), rs_comm_size(pubs_count), h);
|
||||
sc_sub(&sig[sec_index].c, &h, &sum);
|
||||
sc_mulsub(&sig[sec_index].r, &sig[sec_index].c, &sec, &k);
|
||||
sc_mulsub(&sig[sec_index].r, &sig[sec_index].c, &unwrap(sec), &k);
|
||||
}
|
||||
|
||||
bool crypto_ops::check_ring_signature(const hash &prefix_hash, const key_image &image,
|
||||
|
||||
@@ -441,6 +441,53 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline
|
||||
MINFO("Blockchain initialized. last block: " << m_db->height() - 1 << ", " << epee::misc_utils::get_time_interval_string(timestamp_diff) << " time ago, current difficulty: " << get_difficulty_for_next_block());
|
||||
m_db->block_txn_stop();
|
||||
|
||||
uint64_t num_popped_blocks = 0;
|
||||
while (true)
|
||||
{
|
||||
const uint64_t top_height = m_db->height() - 1;
|
||||
const crypto::hash top_id = m_db->top_block_hash();
|
||||
const block top_block = m_db->get_top_block();
|
||||
const uint8_t ideal_hf_version = get_ideal_hard_fork_version(top_height);
|
||||
if (ideal_hf_version <= 1 || ideal_hf_version == top_block.major_version)
|
||||
{
|
||||
if (num_popped_blocks > 0)
|
||||
MGINFO("Initial popping done, top block: " << top_id << ", top height: " << top_height << ", block version: " << (uint64_t)top_block.major_version);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_popped_blocks == 0)
|
||||
MGINFO("Current top block " << top_id << " at height " << top_height << " has version " << (uint64_t)top_block.major_version << " which disagrees with the ideal version " << (uint64_t)ideal_hf_version);
|
||||
if (num_popped_blocks % 100 == 0)
|
||||
MGINFO("Popping blocks... " << top_height);
|
||||
++num_popped_blocks;
|
||||
block popped_block;
|
||||
std::vector<transaction> popped_txs;
|
||||
try
|
||||
{
|
||||
m_db->pop_block(popped_block, popped_txs);
|
||||
}
|
||||
// anything that could cause this to throw is likely catastrophic,
|
||||
// so we re-throw
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
MERROR("Error popping block from blockchain: " << e.what());
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
MERROR("Error popping block from blockchain, throwing!");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_popped_blocks > 0)
|
||||
{
|
||||
m_timestamps_and_difficulties_height = 0;
|
||||
m_hardfork->reorganize_from_chain_height(get_current_blockchain_height());
|
||||
m_tx_pool.on_blockchain_dec(m_db->height()-1, get_tail_id());
|
||||
}
|
||||
|
||||
update_next_cumulative_size_limit();
|
||||
return true;
|
||||
}
|
||||
@@ -584,6 +631,12 @@ block Blockchain::pop_block_from_blockchain()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_blocks_longhash_table.clear();
|
||||
m_scan_table.clear();
|
||||
m_blocks_txs_check.clear();
|
||||
m_check_txin_table.clear();
|
||||
|
||||
update_next_cumulative_size_limit();
|
||||
m_tx_pool.on_blockchain_dec(m_db->height()-1, get_tail_id());
|
||||
|
||||
@@ -1903,7 +1956,7 @@ void Blockchain::get_output_key_mask_unlocked(const uint64_t& amount, const uint
|
||||
unlocked = is_tx_spendtime_unlocked(m_db->get_tx_unlock_time(toi.first));
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const
|
||||
bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const
|
||||
{
|
||||
// rct outputs don't exist before v3
|
||||
if (amount == 0)
|
||||
@@ -1924,22 +1977,7 @@ bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height,
|
||||
if (from_height > start_height)
|
||||
start_height = from_height;
|
||||
|
||||
distribution.clear();
|
||||
uint64_t db_height = m_db->height();
|
||||
if (start_height >= db_height)
|
||||
return false;
|
||||
distribution.resize(db_height - start_height, 0);
|
||||
bool r = for_all_outputs(amount, [&](uint64_t height) {
|
||||
CHECK_AND_ASSERT_MES(height >= real_start_height && height <= db_height, false, "Height not in expected range");
|
||||
if (height >= start_height)
|
||||
distribution[height - start_height]++;
|
||||
else
|
||||
base++;
|
||||
return true;
|
||||
});
|
||||
if (!r)
|
||||
return false;
|
||||
return true;
|
||||
return m_db->get_output_distribution(amount, start_height, to_height, distribution, base);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
// This function takes a list of block hashes from another node
|
||||
@@ -4365,7 +4403,7 @@ void Blockchain::cancel()
|
||||
}
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
static const char expected_block_hashes_hash[] = "1d3df1a177bd6f752d87c0d7b960e502605742721afb39953265f1e0f7f9b01f";
|
||||
static const char expected_block_hashes_hash[] = "59261c03b54bcb21bd463f9fe40a94f40840a12642e9a3b3bfb11b35839a5fe3";
|
||||
void Blockchain::load_compiled_in_block_hashes()
|
||||
{
|
||||
const bool testnet = m_nettype == TESTNET;
|
||||
|
||||
@@ -527,12 +527,13 @@ namespace cryptonote
|
||||
* @brief gets per block distribution of outputs of a given amount
|
||||
*
|
||||
* @param amount the amount to get a ditribution for
|
||||
* @param return-by-reference from_height the height before which we do not care about the data
|
||||
* @param from_height the height before which we do not care about the data
|
||||
* @param to_height the height after which we do not care about the data
|
||||
* @param return-by-reference start_height the height of the first rct output
|
||||
* @param return-by-reference distribution the start offset of the first rct output in this block (same as previous if none)
|
||||
* @param return-by-reference base how many outputs of that amount are before the stated distribution
|
||||
*/
|
||||
bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const;
|
||||
bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const;
|
||||
|
||||
/**
|
||||
* @brief gets the global indices for outputs from a given transaction
|
||||
|
||||
@@ -1073,9 +1073,9 @@ namespace cryptonote
|
||||
return m_blockchain_storage.get_random_rct_outs(req, res);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const
|
||||
bool core::get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const
|
||||
{
|
||||
return m_blockchain_storage.get_output_distribution(amount, from_height, start_height, distribution, base);
|
||||
return m_blockchain_storage.get_output_distribution(amount, from_height, to_height, start_height, distribution, base);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs) const
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace cryptonote
|
||||
*
|
||||
* @brief get per block distribution of outputs of a given amount
|
||||
*/
|
||||
bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const;
|
||||
bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const;
|
||||
|
||||
/**
|
||||
* @copydoc miner::pause
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace cryptonote
|
||||
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, 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, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, bool rct, bool bulletproof, rct::multisig_out *msout)
|
||||
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, bool bulletproof, rct::multisig_out *msout, bool shuffle_outs)
|
||||
{
|
||||
hw::device &hwdev = sender_account_keys.get_device();
|
||||
|
||||
@@ -315,9 +315,10 @@ namespace cryptonote
|
||||
tx.vin.push_back(input_to_key);
|
||||
}
|
||||
|
||||
// "Shuffle" outs
|
||||
std::vector<tx_destination_entry> shuffled_dsts(destinations);
|
||||
std::shuffle(shuffled_dsts.begin(), shuffled_dsts.end(), std::default_random_engine(crypto::rand<unsigned int>()));
|
||||
if (shuffle_outs)
|
||||
{
|
||||
std::shuffle(destinations.begin(), destinations.end(), std::default_random_engine(crypto::rand<unsigned int>()));
|
||||
}
|
||||
|
||||
// sort ins by their key image
|
||||
std::vector<size_t> ins_order(sources.size());
|
||||
@@ -364,7 +365,7 @@ namespace cryptonote
|
||||
uint64_t summary_outs_money = 0;
|
||||
//fill outputs
|
||||
size_t output_index = 0;
|
||||
for(const tx_destination_entry& dst_entr: shuffled_dsts)
|
||||
for(const tx_destination_entry& dst_entr: destinations)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(dst_entr.amount > 0 || tx.version > 1, false, "Destination with wrong amount: " << dst_entr.amount);
|
||||
crypto::key_derivation derivation;
|
||||
@@ -600,7 +601,7 @@ namespace cryptonote
|
||||
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, 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, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct, bool bulletproof, 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, 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, bool bulletproof, rct::multisig_out *msout)
|
||||
{
|
||||
hw::device &hwdev = sender_account_keys.get_device();
|
||||
hwdev.open_tx(tx_key);
|
||||
@@ -629,7 +630,8 @@ namespace cryptonote
|
||||
subaddresses[sender_account_keys.m_account_address.m_spend_public_key] = {0,0};
|
||||
crypto::secret_key tx_key;
|
||||
std::vector<crypto::secret_key> additional_tx_keys;
|
||||
return construct_tx_and_get_tx_key(sender_account_keys, subaddresses, sources, destinations, change_addr, extra, tx, unlock_time, tx_key, additional_tx_keys, false, false, NULL);
|
||||
std::vector<tx_destination_entry> destinations_copy = destinations;
|
||||
return construct_tx_and_get_tx_key(sender_account_keys, subaddresses, sources, destinations_copy, change_addr, extra, tx, unlock_time, tx_key, additional_tx_keys, false, false, NULL);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool generate_genesis_block(
|
||||
|
||||
@@ -90,8 +90,8 @@ 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);
|
||||
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_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, 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, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, bool rct = false, bool bulletproof = false, 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, 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, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys, bool rct = false, bool bulletproof = false, rct::multisig_out *msout = NULL);
|
||||
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, bool bulletproof = false, 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, bool bulletproof = false, rct::multisig_out *msout = NULL);
|
||||
|
||||
bool generate_genesis_block(
|
||||
block& bl
|
||||
|
||||
@@ -720,6 +720,7 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash,
|
||||
|
||||
req.txs_hashes.push_back(epee::string_tools::pod_to_hex(transaction_hash));
|
||||
req.decode_as_json = false;
|
||||
req.prune = false;
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->rpc_request(req, res, "/gettransactions", fail_message.c_str()))
|
||||
|
||||
@@ -48,6 +48,15 @@ namespace hw {
|
||||
/* ===================================================================== */
|
||||
/* === Debug ==== */
|
||||
/* ===================================================================== */
|
||||
#ifdef WIN32
|
||||
static char *pcsc_stringify_error(LONG rv) {
|
||||
static __thread char out[20];
|
||||
sprintf_s(out, sizeof(out), "0x%08lX", rv);
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
void set_apdu_verbose(bool verbose) {
|
||||
apdu_verbose = verbose;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,13 @@
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include "device.hpp"
|
||||
#ifdef WIN32
|
||||
#include <winscard.h>
|
||||
#define MAX_ATR_SIZE 33
|
||||
#else
|
||||
#include <PCSC/winscard.h>
|
||||
#include <PCSC/wintypes.h>
|
||||
#endif
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ using namespace std;
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "ringct"
|
||||
|
||||
#define CHECK_AND_ASSERT_MES_L1(expr, ret, message) {if(!(expr)) {MCERROR("verify", message); return ret;}}
|
||||
|
||||
namespace rct {
|
||||
bool is_simple(int type)
|
||||
{
|
||||
@@ -135,8 +137,8 @@ namespace rct {
|
||||
bool verifyBorromean(const boroSig &bb, const key64 P1, const key64 P2) {
|
||||
ge_p3 P1_p3[64], P2_p3[64];
|
||||
for (size_t i = 0 ; i < 64 ; ++i) {
|
||||
CHECK_AND_ASSERT_MES(ge_frombytes_vartime(&P1_p3[i], P1[i].bytes) == 0, false, "point conv failed");
|
||||
CHECK_AND_ASSERT_MES(ge_frombytes_vartime(&P2_p3[i], P2[i].bytes) == 0, false, "point conv failed");
|
||||
CHECK_AND_ASSERT_MES_L1(ge_frombytes_vartime(&P1_p3[i], P1[i].bytes) == 0, false, "point conv failed");
|
||||
CHECK_AND_ASSERT_MES_L1(ge_frombytes_vartime(&P2_p3[i], P2[i].bytes) == 0, false, "point conv failed");
|
||||
}
|
||||
return verifyBorromean(bb, P1_p3, P2_p3);
|
||||
}
|
||||
@@ -356,9 +358,9 @@ namespace rct {
|
||||
ge_cached cached;
|
||||
ge_p3 p3;
|
||||
ge_p1p1 p1;
|
||||
CHECK_AND_ASSERT_MES(ge_frombytes_vartime(&p3, H2[i].bytes) == 0, false, "point conv failed");
|
||||
CHECK_AND_ASSERT_MES_L1(ge_frombytes_vartime(&p3, H2[i].bytes) == 0, false, "point conv failed");
|
||||
ge_p3_to_cached(&cached, &p3);
|
||||
CHECK_AND_ASSERT_MES(ge_frombytes_vartime(&asCi[i], as.Ci[i].bytes) == 0, false, "point conv failed");
|
||||
CHECK_AND_ASSERT_MES_L1(ge_frombytes_vartime(&asCi[i], as.Ci[i].bytes) == 0, false, "point conv failed");
|
||||
ge_sub(&p1, &asCi[i], &cached);
|
||||
ge_p3_to_cached(&cached, &asCi[i]);
|
||||
ge_p1p1_to_p3(&CiH[i], &p1);
|
||||
|
||||
@@ -47,6 +47,7 @@ using namespace epee;
|
||||
#include "rpc/rpc_args.h"
|
||||
#include "core_rpc_server_error_codes.h"
|
||||
#include "p2p/net_node.h"
|
||||
#include "get_output_distribution_cache.h"
|
||||
#include "version.h"
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
@@ -2103,9 +2104,23 @@ namespace cryptonote
|
||||
continue;
|
||||
}
|
||||
|
||||
// this is a slow operation, so we have precomputed caches of common cases
|
||||
bool found = false;
|
||||
for (const auto &slot: get_output_distribution_cache)
|
||||
{
|
||||
if (slot.amount == amount && slot.from_height == req.from_height && slot.to_height == req.to_height)
|
||||
{
|
||||
res.distributions.push_back({amount, slot.start_height, slot.distribution, slot.base});
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
continue;
|
||||
|
||||
std::vector<uint64_t> distribution;
|
||||
uint64_t start_height, base;
|
||||
if (!m_core.get_output_distribution(amount, req.from_height, start_height, distribution, base))
|
||||
if (!m_core.get_output_distribution(amount, req.from_height, req.to_height, start_height, distribution, base))
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to get rct distribution";
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
static const struct
|
||||
{
|
||||
uint64_t amount;
|
||||
uint64_t from_height;
|
||||
uint64_t to_height;
|
||||
uint64_t start_height;
|
||||
uint64_t base;
|
||||
std::vector<uint64_t> distribution;
|
||||
}
|
||||
get_output_distribution_cache[] =
|
||||
{
|
||||
{
|
||||
0,
|
||||
1544704,
|
||||
1546001,
|
||||
1544704,
|
||||
5143500,
|
||||
{
|
||||
5, 38, 37, 33, 39, 7, 1, 1, 5, 9, 7, 5, 17, 5, 3, 9, 3, 17, 5, 17, 1, 1, 15, 13, 3, 10, 5, 3, 34, 1, 45, 7,
|
||||
5, 17, 5, 22, 3, 1, 17, 16, 5, 1, 3, 43, 5, 13, 3, 23, 9, 7, 9, 13, 1, 11, 1, 17, 1, 3, 16, 11, 5, 11, 7, 7,
|
||||
33, 11, 7, 1, 5, 1, 21, 19, 1, 17, 1, 49, 17, 3, 3, 9, 35, 46, 46, 39, 26, 33, 21, 3, 23, 3, 9, 37, 1, 33, 11, 32,
|
||||
1, 13, 16, 12, 3, 21, 1, 18, 3, 19, 1, 25, 5, 3, 18, 7, 17, 5, 9, 15, 7, 7, 11, 9, 9, 17, 5, 16, 1, 3, 13, 3,
|
||||
5, 5, 5, 13, 5, 9, 5, 13, 3, 17, 15, 36, 13, 3, 20, 12, 6, 23, 17, 10, 22, 23, 1, 7, 21, 6, 23, 1, 3, 19, 13, 1,
|
||||
3, 43, 35, 13, 1, 31, 7, 3, 17, 1, 15, 5, 11, 15, 24, 1, 18, 13, 5, 15, 1, 29, 3, 3, 13, 3, 15, 7, 17, 3, 1, 1,
|
||||
17, 1, 1, 45, 39, 27, 45, 46, 34, 7, 3, 3, 9, 3, 3, 11, 7, 5, 9, 25, 19, 3, 33, 1, 5, 17, 1, 45, 4, 1, 45, 11,
|
||||
44, 32, 3, 1, 3, 7, 17, 15, 5, 45, 35, 41, 1, 35, 3, 3, 19, 1, 9, 17, 29, 29, 3, 1, 13, 1, 3, 47, 21, 13, 7, 1,
|
||||
7, 5, 1, 11, 1, 40, 9, 7, 3, 3, 13, 25, 1, 47, 5, 7, 3, 7, 31, 40, 34, 6, 3, 15, 3, 31, 5, 13, 27, 9, 12, 21,
|
||||
3, 1, 19, 1, 19, 5, 47, 49, 47, 42, 50, 34, 29, 23, 1, 5, 9, 16, 11, 7, 1, 19, 7, 5, 1, 15, 1, 1, 9, 13, 9, 5,
|
||||
27, 3, 3, 29, 1, 33, 3, 9, 5, 35, 5, 1, 17, 7, 3, 39, 3, 28, 19, 1, 1, 9, 1, 3, 27, 1, 37, 3, 1, 1, 16, 3,
|
||||
25, 11, 5, 3, 33, 45, 17, 11, 7, 22, 9, 1, 5, 5, 5, 15, 1, 15, 9, 7, 11, 13, 37, 49, 46, 38, 11, 1, 25, 1, 13, 18,
|
||||
3, 7, 39, 3, 37, 19, 35, 3, 1, 3, 19, 1, 3, 15, 21, 3, 27, 1, 45, 48, 1, 13, 29, 9, 1, 1, 46, 43, 5, 15, 3, 7,
|
||||
29, 26, 5, 5, 21, 37, 17, 21, 3, 13, 1, 5, 1, 17, 5, 31, 13, 1, 11, 3, 46, 9, 3, 7, 1, 1, 41, 1, 21, 1, 5, 12,
|
||||
7, 13, 9, 25, 1, 47, 47, 48, 48, 48, 48, 48, 47, 48, 45, 45, 33, 52, 50, 46, 45, 47, 35, 41, 38, 35, 42, 38, 34, 41, 39, 35,
|
||||
51, 51, 45, 43, 49, 52, 53, 45, 42, 46, 37, 53, 49, 41, 46, 49, 46, 47, 48, 37, 41, 33, 43, 38, 15, 3, 3, 27, 11, 5, 23, 13,
|
||||
1, 1, 37, 3, 15, 3, 30, 13, 3, 45, 12, 3, 5, 11, 1, 1, 21, 9, 11, 19, 1, 1, 1, 25, 5, 21, 3, 1, 32, 44, 3, 33,
|
||||
11, 7, 5, 23, 1, 37, 47, 48, 48, 48, 48, 48, 48, 46, 47, 47, 50, 45, 49, 50, 46, 47, 49, 45, 51, 49, 50, 49, 49, 46, 47, 48,
|
||||
46, 48, 46, 50, 46, 43, 46, 46, 48, 47, 46, 47, 45, 49, 46, 43, 50, 45, 45, 49, 45, 48, 45, 49, 48, 45, 45, 51, 45, 51, 45, 46,
|
||||
52, 45, 45, 51, 51, 52, 44, 45, 52, 50, 50, 46, 47, 51, 51, 46, 47, 47, 47, 50, 47, 51, 48, 49, 51, 50, 48, 48, 48, 50, 49, 49,
|
||||
52, 52, 49, 50, 49, 49, 49, 51, 52, 49, 52, 50, 49, 47, 29, 15, 39, 17, 31, 5, 40, 5, 18, 23, 25, 7, 35, 26, 5, 31, 49, 22,
|
||||
3, 17, 7, 49, 7, 49, 47, 12, 44, 46, 36, 15, 3, 1, 47, 13, 35, 40, 5, 21, 19, 39, 21, 33, 31, 29, 1, 1, 37, 1, 15, 47,
|
||||
7, 7, 47, 41, 13, 3, 47, 31, 9, 33, 13, 43, 29, 5, 1, 9, 33, 7, 27, 15, 15, 25, 5, 43, 22, 31, 7, 1, 47, 1, 15, 27,
|
||||
3, 27, 45, 15, 1, 36, 17, 1, 23, 39, 38, 45, 7, 7, 19, 7, 11, 47, 33, 16, 3, 45, 45, 45, 9, 27, 3, 3, 21, 3, 7, 21,
|
||||
7, 3, 43, 1, 17, 1, 45, 37, 46, 5, 5, 13, 46, 40, 48, 48, 45, 34, 1, 46, 19, 25, 9, 7, 47, 23, 37, 31, 3, 25, 13, 46,
|
||||
31, 25, 5, 46, 35, 52, 11, 23, 27, 4, 15, 11, 11, 11, 9, 34, 7, 9, 15, 34, 9, 27, 37, 28, 25, 45, 13, 30, 5, 25, 15, 7,
|
||||
3, 19, 27, 1, 7, 11, 1, 32, 3, 45, 11, 9, 21, 25, 9, 13, 13, 1, 7, 1, 33, 11, 5, 3, 3, 27, 27, 5, 3, 37, 17, 17,
|
||||
3, 7, 5, 13, 1, 3, 44, 45, 26, 25, 1, 13, 3, 13, 3, 11, 1, 11, 7, 45, 3, 3, 1, 43, 1, 19, 3, 1, 15, 5, 39, 7,
|
||||
7, 1, 9, 1, 11, 19, 3, 35, 29, 7, 15, 11, 40, 7, 44, 38, 34, 7, 9, 7, 1, 27, 1, 9, 5, 45, 1, 21, 3, 1, 5, 9,
|
||||
3, 21, 23, 33, 3, 1, 7, 3, 3, 7, 41, 9, 7, 1, 5, 31, 9, 7, 1, 1, 11, 41, 51, 20, 9, 47, 39, 17, 9, 35, 1, 41,
|
||||
1, 19, 1, 19, 15, 1, 13, 5, 23, 15, 9, 15, 17, 1, 15, 27, 33, 31, 29, 7, 13, 1, 5, 45, 5, 1, 1, 11, 1, 13, 3, 7,
|
||||
9, 1, 13, 39, 3, 33, 5, 3, 7, 7, 5, 29, 11, 1, 7, 1, 15, 3, 13, 3, 15, 3, 3, 1, 5, 1, 9, 1, 44, 49, 24, 25,
|
||||
1, 1, 34, 22, 7, 5, 5, 5, 10, 9, 13, 3, 9, 1, 9, 19, 7, 43, 48, 7, 11, 7, 3, 3, 7, 21, 1, 1, 3, 3, 11, 31,
|
||||
1, 1, 13, 22, 23, 7, 27, 9, 3, 3, 21, 1, 35, 21, 9, 11, 13, 39, 1, 3, 7, 23, 3, 28, 3, 45, 47, 38, 32, 37, 34, 1,
|
||||
23, 3, 3, 1, 19, 19, 1, 5, 13, 1, 5, 11, 38, 3, 1, 36, 13, 1, 1, 23, 5, 17, 11, 1, 13, 1, 3, 7, 11, 3, 33, 7,
|
||||
19, 5, 5, 1, 1, 3, 5, 41, 1, 3, 25, 1, 7, 7, 9, 3, 11, 3, 13, 5, 7, 1, 3, 9, 1, 1, 43, 47, 47, 47, 17, 7,
|
||||
17, 3, 19, 1, 9, 9, 33, 22, 1, 25, 1, 3, 3, 32, 5, 1, 23, 9, 5, 1, 31, 5, 9, 1, 3, 7, 19, 1, 12, 11, 5, 1,
|
||||
1, 9, 25, 15, 15, 13, 5, 3, 15, 1, 17, 1, 1, 5, 5, 41, 11, 15, 7, 3, 21, 21, 35, 22, 46, 35, 3, 27, 5, 3, 45, 22,
|
||||
27, 1, 19, 9, 1, 25, 1, 29, 3, 5, 25, 17, 27, 5, 19, 5, 25, 7, 19, 1, 9, 21, 3, 7, 29, 27, 17, 3, 3, 15, 7, 19,
|
||||
5, 25, 1, 23, 45, 4, 31, 1, 37, 14, 29, 3, 29, 1, 23, 29, 19, 11, 1, 13, 13, 9, 1, 25, 1, 33, 1, 37, 37, 23, 7, 21,
|
||||
7, 3, 13, 7, 3, 7, 21, 11, 9, 1, 31, 3, 1, 7, 39, 46, 3, 30,
|
||||
},
|
||||
},
|
||||
{
|
||||
0,
|
||||
1562704,
|
||||
1564001,
|
||||
1562704,
|
||||
5521986,
|
||||
{
|
||||
35, 45, 23, 3, 44, 47, 44, 3, 17, 35, 7, 11, 7, 29, 43, 27, 11, 7, 5, 31, 13, 9, 45, 45, 7, 42, 17, 15, 19, 11, 45, 19,
|
||||
45, 46, 45, 46, 32, 34, 43, 34, 46, 47, 45, 30, 17, 45, 46, 36, 35, 38, 19, 9, 23, 17, 3, 19, 31, 41, 35, 24, 15, 45, 15, 5,
|
||||
11, 5, 19, 11, 11, 7, 15, 19, 45, 34, 7, 7, 29, 1, 9, 36, 7, 44, 45, 33, 25, 8, 17, 7, 44, 43, 48, 45, 42, 46, 40, 44,
|
||||
1, 43, 45, 46, 46, 35, 19, 19, 23, 5, 13, 19, 7, 16, 9, 3, 25, 34, 3, 27, 9, 39, 3, 43, 21, 1, 45, 45, 39, 25, 23, 13,
|
||||
39, 39, 3, 45, 43, 46, 44, 40, 39, 33, 45, 47, 38, 45, 45, 39, 47, 47, 45, 46, 35, 45, 43, 47, 45, 40, 34, 42, 42, 48, 49, 47,
|
||||
47, 48, 47, 45, 43, 48, 37, 48, 41, 45, 48, 34, 42, 44, 9, 19, 27, 1, 47, 47, 43, 25, 29, 5, 5, 21, 39, 35, 43, 37, 13, 45,
|
||||
25, 31, 26, 47, 45, 23, 23, 39, 32, 25, 44, 47, 35, 47, 15, 17, 7, 9, 5, 35, 31, 3, 45, 47, 46, 13, 17, 48, 45, 9, 13, 45,
|
||||
45, 31, 1, 53, 44, 46, 39, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 47, 47, 47, 47, 47, 47, 47, 47, 53, 49, 45, 45, 50,
|
||||
50, 27, 43, 46, 47, 46, 45, 48, 36, 42, 42, 46, 45, 47, 41, 45, 43, 47, 38, 48, 47, 33, 11, 45, 46, 34, 42, 32, 3, 45, 37, 45,
|
||||
15, 3, 45, 29, 31, 9, 5, 3, 27, 5, 21, 25, 7, 15, 46, 34, 5, 3, 17, 3, 9, 13, 7, 11, 3, 1, 34, 13, 7, 45, 33, 26,
|
||||
9, 5, 9, 41, 43, 34, 3, 35, 3, 17, 37, 11, 17, 3, 15, 27, 15, 45, 46, 13, 26, 16, 11, 7, 5, 45, 38, 45, 45, 22, 44, 44,
|
||||
43, 6, 11, 35, 15, 44, 17, 27, 13, 3, 40, 5, 9, 7, 35, 19, 5, 5, 1, 28, 33, 15, 45, 5, 29, 3, 31, 12, 5, 32, 24, 3,
|
||||
23, 13, 47, 45, 42, 46, 39, 21, 21, 1, 44, 44, 47, 41, 5, 1, 11, 36, 20, 5, 45, 39, 45, 45, 44, 45, 32, 22, 40, 11, 38, 1,
|
||||
45, 46, 37, 9, 23, 9, 15, 44, 7, 16, 38, 46, 11, 14, 24, 19, 19, 7, 26, 25, 45, 37, 17, 1, 35, 1, 3, 28, 3, 11, 22, 13,
|
||||
3, 1, 7, 38, 5, 3, 1, 26, 1, 3, 43, 44, 46, 45, 21, 11, 1, 44, 27, 1, 11, 26, 10, 44, 45, 45, 45, 47, 47, 45, 48, 45,
|
||||
38, 9, 5, 44, 46, 27, 3, 12, 1, 11, 3, 44, 43, 1, 5, 2, 46, 17, 13, 19, 1, 12, 7, 23, 1, 17, 6, 13, 3, 5, 27, 7,
|
||||
46, 36, 19, 25, 1, 1, 3, 8, 15, 3, 45, 45, 45, 37, 6, 15, 3, 5, 38, 14, 41, 1, 13, 45, 45, 39, 44, 29, 43, 48, 51, 50,
|
||||
37, 5, 17, 46, 47, 31, 5, 42, 49, 38, 39, 24, 7, 11, 44, 35, 21, 6, 15, 5, 47, 13, 28, 45, 34, 27, 24, 15, 35, 13, 7, 25,
|
||||
43, 13, 14, 5, 3, 5, 46, 45, 45, 35, 5, 21, 28, 3, 13, 4, 30, 19, 45, 45, 40, 37, 5, 40, 17, 9, 3, 9, 13, 4, 17, 33,
|
||||
44, 39, 17, 45, 28, 5, 11, 45, 19, 45, 21, 44, 31, 43, 49, 48, 15, 3, 1, 44, 45, 43, 11, 1, 1, 27, 43, 45, 39, 3, 1, 3,
|
||||
5, 31, 1, 43, 23, 19, 7, 5, 45, 31, 11, 7, 3, 9, 5, 7, 13, 43, 47, 45, 46, 47, 14, 3, 25, 45, 7, 17, 32, 21, 3, 17,
|
||||
5, 11, 31, 40, 45, 20, 45, 45, 32, 38, 47, 38, 45, 41, 49, 30, 45, 5, 36, 31, 22, 3, 46, 45, 13, 21, 23, 5, 46, 45, 33, 19,
|
||||
25, 1, 7, 13, 5, 44, 23, 29, 23, 24, 7, 5, 37, 13, 29, 13, 7, 17, 7, 43, 3, 21, 7, 44, 1, 19, 15, 9, 34, 43, 26, 3,
|
||||
17, 5, 6, 5, 7, 3, 33, 35, 43, 41, 48, 47, 30, 45, 19, 7, 5, 33, 11, 34, 25, 1, 21, 11, 29, 7, 1, 4, 5, 10, 14, 3,
|
||||
44, 11, 47, 45, 33, 3, 9, 7, 40, 23, 9, 1, 3, 1, 7, 5, 9, 9, 6, 11, 45, 41, 45, 19, 5, 11, 10, 39, 9, 19, 3, 11,
|
||||
43, 42, 1, 13, 35, 5, 32, 7, 5, 5, 43, 37, 3, 32, 17, 3, 23, 1, 13, 45, 17, 1, 21, 45, 43, 46, 49, 47, 45, 30, 9, 31,
|
||||
19, 42, 19, 44, 17, 14, 19, 25, 1, 7, 5, 45, 19, 13, 7, 3, 1, 1, 9, 21, 37, 9, 11, 1, 3, 37, 27, 13, 5, 21, 33, 3,
|
||||
27, 9, 27, 1, 39, 1, 46, 21, 10, 13, 21, 40, 22, 35, 41, 9, 33, 3, 17, 8, 45, 46, 42, 46, 47, 47, 47, 48, 48, 47, 43, 48,
|
||||
37, 39, 50, 35, 3, 40, 45, 40, 46, 36, 34, 28, 9, 9, 37, 9, 5, 7, 13, 31, 1, 7, 3, 3, 44, 45, 25, 15, 1, 21, 43, 25,
|
||||
1, 38, 34, 42, 31, 23, 33, 35, 37, 20, 7, 15, 3, 7, 7, 27, 45, 45, 48, 47, 45, 44, 47, 23, 25, 36, 11, 3, 18, 24, 27, 13,
|
||||
41, 13, 5, 5, 7, 19, 15, 7, 5, 14, 45, 45, 37, 1, 5, 17, 21, 41, 17, 37, 53, 41, 45, 45, 45, 45, 45, 45, 45, 45, 43, 47,
|
||||
47, 48, 53, 47, 47, 47, 49, 27, 45, 47, 47, 47, 47, 45, 45, 45, 47, 43, 48, 34, 34, 43, 46, 15, 37, 21, 5, 27, 11, 1, 9, 7,
|
||||
19, 15, 1, 1, 19, 3, 36, 27, 29, 13, 21, 9, 17, 5, 16, 45, 23, 34, 3, 1, 7, 25, 28, 13, 29, 15, 11, 19, 17, 1, 27, 23,
|
||||
31, 19, 41, 41, 40, 47, 28, 31, 26, 26, 36, 17, 5, 1, 23, 1, 45, 34, 49, 51, 34, 43, 37, 5, 41, 15, 5, 21, 1, 7, 9, 19,
|
||||
5, 11, 39, 19, 45, 45, 38, 17, 9, 1, 15, 11, 5, 13, 47, 46, 48, 45, 19, 32, 7, 19, 5, 7, 23, 29, 5, 45, 41, 37, 1, 5,
|
||||
27, 5, 5, 7, 19, 9, 1, 35, 48, 38, 38, 39, 42, 43, 21, 23, 43, 41, 7, 3, 7, 13, 1, 46, 47, 46, 23, 46, 45, 25, 7, 9,
|
||||
21, 7, 41, 13, 20, 1, 21, 15, 37, 5, 40, 45, 45, 5, 45, 46, 15, 33, 46, 12, 13, 7, 24, 7, 5, 30, 7, 46, 13, 8, 44, 35,
|
||||
45, 33, 40, 36, 47, 47, 29, 43, 36, 43, 45, 42, 36, 19, 7, 7, 43, 3, 44, 25, 48, 29, 11, 45, 30, 1, 17, 13, 25, 1, 48, 45,
|
||||
45, 45, 44, 49, 37, 9, 21, 17, 15, 7, 15, 25, 1, 1, 9, 43, 33, 11, 3, 29, 45, 45, 9, 7, 7, 27, 47, 45, 47, 48, 45, 47,
|
||||
26, 1, 43, 15, 45, 17, 1, 5, 35, 31, 9, 3, 9, 19, 9, 21, 43, 5, 27, 1, 5, 9, 4, 34, 19, 3, 7, 11, 45, 46, 45, 45,
|
||||
46, 47, 47, 44, 45, 43, 27, 9, 17, 15, 19, 44, 45, 46, 47, 47, 45, 45,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -759,7 +759,7 @@ bool simple_wallet::print_fee_info(const std::vector<std::string> &args/* = std:
|
||||
}
|
||||
const uint64_t per_kb_fee = m_wallet->get_per_kb_fee();
|
||||
const uint64_t typical_size_kb = 13;
|
||||
message_writer() << (boost::format(tr("Current fee is %s monero per kB")) % print_money(per_kb_fee)).str();
|
||||
message_writer() << (boost::format(tr("Current fee is %s %s per kB")) % print_money(per_kb_fee) % cryptonote::get_unit(cryptonote::get_default_decimal_point())).str();
|
||||
|
||||
std::vector<uint64_t> fees;
|
||||
for (uint32_t priority = 1; priority <= 4; ++priority)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||
#define DEF_MONERO_VERSION "0.12.0.0-master"
|
||||
#define DEF_MONERO_VERSION "0.12.1.0-master"
|
||||
#define DEF_MONERO_RELEASE_NAME "Lithium Luna"
|
||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||
|
||||
|
||||
@@ -305,14 +305,14 @@ uint64_t Wallet::maximumAllowedAmount()
|
||||
return std::numeric_limits<uint64_t>::max();
|
||||
}
|
||||
|
||||
void Wallet::init(const char *argv0, const char *default_log_base_name) {
|
||||
void Wallet::init(const char *argv0, const char *default_log_base_name, const std::string &log_path, bool console) {
|
||||
#ifdef WIN32
|
||||
// Activate UTF-8 support for Boost filesystem classes on Windows
|
||||
std::locale::global(boost::locale::generator().generate(""));
|
||||
boost::filesystem::path::imbue(std::locale());
|
||||
#endif
|
||||
epee::string_tools::set_module_name_and_folder(argv0);
|
||||
mlog_configure(mlog_get_default_log_path(default_log_base_name), true);
|
||||
mlog_configure(log_path.empty() ? mlog_get_default_log_path(default_log_base_name) : log_path.c_str(), console);
|
||||
}
|
||||
|
||||
void Wallet::debug(const std::string &category, const std::string &str) {
|
||||
|
||||
@@ -556,7 +556,8 @@ struct Wallet
|
||||
}
|
||||
static uint64_t maximumAllowedAmount();
|
||||
// Easylogger wrapper
|
||||
static void init(const char *argv0, const char *default_log_base_name);
|
||||
static void init(const char *argv0, const char *default_log_base_name) { init(argv0, default_log_base_name, "", true); }
|
||||
static void init(const char *argv0, const char *default_log_base_name, const std::string &log_path, bool console);
|
||||
static void debug(const std::string &category, const std::string &str);
|
||||
static void info(const std::string &category, const std::string &str);
|
||||
static void warning(const std::string &category, const std::string &str);
|
||||
|
||||
@@ -5155,7 +5155,7 @@ bool wallet2::sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto
|
||||
rct::multisig_out msout = ptx.multisig_sigs.front().msout;
|
||||
auto sources = sd.sources;
|
||||
const bool bulletproof = sd.use_rct && (ptx.tx.rct_signatures.type == rct::RCTTypeFullBulletproof || ptx.tx.rct_signatures.type == rct::RCTTypeSimpleBulletproof);
|
||||
bool r = cryptonote::construct_tx_with_tx_key(m_account.get_keys(), m_subaddresses, sources, sd.splitted_dsts, ptx.change_dts.addr, sd.extra, tx, sd.unlock_time, ptx.tx_key, ptx.additional_tx_keys, sd.use_rct, bulletproof, &msout);
|
||||
bool r = cryptonote::construct_tx_with_tx_key(m_account.get_keys(), m_subaddresses, sources, sd.splitted_dsts, ptx.change_dts.addr, sd.extra, tx, sd.unlock_time, ptx.tx_key, ptx.additional_tx_keys, sd.use_rct, bulletproof, &msout, false);
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::tx_not_constructed, sd.sources, sd.splitted_dsts, sd.unlock_time, m_nettype);
|
||||
|
||||
THROW_WALLET_EXCEPTION_IF(get_transaction_prefix_hash (tx) != get_transaction_prefix_hash(ptx.tx),
|
||||
@@ -6670,7 +6670,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
|
||||
LOG_PRINT_L2("Creating supplementary multisig transaction");
|
||||
cryptonote::transaction ms_tx;
|
||||
auto sources_copy_copy = sources_copy;
|
||||
bool r = cryptonote::construct_tx_with_tx_key(m_account.get_keys(), m_subaddresses, sources_copy_copy, splitted_dsts, change_dts.addr, extra, ms_tx, unlock_time,tx_key, additional_tx_keys, true, bulletproof, &msout);
|
||||
bool r = cryptonote::construct_tx_with_tx_key(m_account.get_keys(), m_subaddresses, sources_copy_copy, splitted_dsts, change_dts.addr, extra, ms_tx, unlock_time,tx_key, additional_tx_keys, true, bulletproof, &msout, false);
|
||||
LOG_PRINT_L2("constructed tx, r="<<r);
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::tx_not_constructed, sources, splitted_dsts, unlock_time, m_nettype);
|
||||
THROW_WALLET_EXCEPTION_IF(upper_transaction_size_limit <= get_object_blobsize(tx), error::tx_too_big, tx, upper_transaction_size_limit);
|
||||
@@ -8201,14 +8201,14 @@ const wallet2::transfer_details &wallet2::get_transfer_details(size_t idx) const
|
||||
std::vector<size_t> wallet2::select_available_unmixable_outputs(bool trusted_daemon)
|
||||
{
|
||||
// request all outputs with less than 3 instances
|
||||
const size_t min_mixin = use_fork_rules(6, 10) ? 4 : 2; // v6 increases min mixin from 2 to 4
|
||||
const size_t min_mixin = use_fork_rules(7, 10) ? 6 : use_fork_rules(6, 10) ? 4 : 2; // v6 increases min mixin from 2 to 4, v7 to 6
|
||||
return select_available_outputs_from_histogram(min_mixin + 1, false, true, false, trusted_daemon);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> wallet2::select_available_mixable_outputs(bool trusted_daemon)
|
||||
{
|
||||
// request all outputs with at least 3 instances, so we can use mixin 2 with
|
||||
const size_t min_mixin = use_fork_rules(6, 10) ? 4 : 2; // v6 increases min mixin from 2 to 4
|
||||
const size_t min_mixin = use_fork_rules(7, 10) ? 6 : use_fork_rules(6, 10) ? 4 : 2; // v6 increases min mixin from 2 to 4, v7 to 6
|
||||
return select_available_outputs_from_histogram(min_mixin + 1, true, true, true, trusted_daemon);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -103,6 +103,8 @@ if (NOT MSVC)
|
||||
COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
|
||||
endif ()
|
||||
|
||||
SET_PROPERTY(SOURCE main.cpp PROPERTY COMPILE_FLAGS -DDEFAULT_DATA_DIR="\\"${CMAKE_SOURCE_DIR}/tests/data\\"")
|
||||
|
||||
SET_PROPERTY(SOURCE memwipe.cpp PROPERTY COMPILE_FLAGS -Ofast)
|
||||
|
||||
add_test(
|
||||
|
||||
@@ -113,6 +113,7 @@ public:
|
||||
virtual bool for_all_outputs(uint64_t amount, const std::function<bool(uint64_t height)> &f) const { return true; }
|
||||
virtual bool is_read_only() const { return false; }
|
||||
virtual std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> get_output_histogram(const std::vector<uint64_t> &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count) const { return std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>>(); }
|
||||
virtual bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector<uint64_t> &distribution, uint64_t &base) const { return false; }
|
||||
|
||||
virtual void add_txpool_tx(const transaction &tx, const txpool_tx_meta_t& details) {}
|
||||
virtual void update_txpool_tx(const crypto::hash &txid, const txpool_tx_meta_t& details) {}
|
||||
|
||||
@@ -61,8 +61,8 @@ int main(int argc, char** argv)
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
po::options_description desc_options("Command line options");
|
||||
const command_line::arg_descriptor<std::string> arg_data_dir = { "data-dir", "Data files directory" };
|
||||
command_line::add_arg(desc_options, arg_data_dir, "");
|
||||
const command_line::arg_descriptor<std::string> arg_data_dir = { "data-dir", "Data files directory", DEFAULT_DATA_DIR };
|
||||
command_line::add_arg(desc_options, arg_data_dir);
|
||||
|
||||
po::variables_map vm;
|
||||
bool r = command_line::handle_error_helper(desc_options, [&]()
|
||||
@@ -74,12 +74,7 @@ int main(int argc, char** argv)
|
||||
if (! r)
|
||||
return 1;
|
||||
|
||||
if (command_line::is_arg_defaulted(vm, arg_data_dir))
|
||||
unit_test::data_dir = boost::filesystem::canonical(boost::filesystem::path(epee::string_tools::get_current_module_folder()))
|
||||
.parent_path().parent_path().parent_path().parent_path()
|
||||
.append("tests").append("data");
|
||||
else
|
||||
unit_test::data_dir = command_line::get_arg(vm, arg_data_dir);
|
||||
unit_test::data_dir = command_line::get_arg(vm, arg_data_dir);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user