forked from such-gitea/wownero
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ee6da17fa | ||
|
|
4f279b1c7d | ||
|
|
0cbf1a8e37 | ||
|
|
879ba26fbe | ||
|
|
458334be0d | ||
|
|
bce819205b | ||
|
|
016bdedf73 | ||
|
|
2016b83300 | ||
|
|
cdabf3036e | ||
|
|
8305df6605 | ||
|
|
60d367d77e | ||
|
|
9d1692ea76 | ||
|
|
ed63e37a27 | ||
|
|
a58418501d | ||
|
|
9c1317b878 | ||
|
|
445423668b | ||
|
|
cec0995020 | ||
|
|
f93126ff66 | ||
|
|
8423eebcdf | ||
|
|
41531b5849 | ||
|
|
76e437acd6 | ||
|
|
408fe4ec28 | ||
|
|
72f33077ba | ||
|
|
f19db08156 | ||
|
|
51ef1851e8 | ||
|
|
3c493ecd09 | ||
|
|
4e6d3a50f2 | ||
|
|
bf16d2bb37 | ||
|
|
9121631733 | ||
|
|
d481a414b0 | ||
|
|
e511679463 | ||
|
|
5cf05f27da | ||
|
|
b5652f5484 | ||
|
|
768e11b3f6 | ||
|
|
95e17a98aa | ||
|
|
43387464ff | ||
|
|
40f4143730 | ||
|
|
eb7d095731 | ||
|
|
7b4bf98da4 | ||
|
|
c887405110 | ||
|
|
1f3b98c271 | ||
|
|
8d7928bb48 | ||
|
|
01592aa474 | ||
|
|
b7076c8e6d | ||
|
|
d05048198d | ||
|
|
336d4bd838 | ||
|
|
7d71c5354f | ||
|
|
a4431d8317 | ||
|
|
57d909fd8c |
11
Dockerfile
11
Dockerfile
@@ -116,8 +116,8 @@ RUN set -ex \
|
||||
&& make install
|
||||
|
||||
# Udev
|
||||
ARG UDEV_VERSION=v3.2.10
|
||||
ARG UDEV_HASH=be7068512c7512fa67c64fbff3472ab140c277c8
|
||||
ARG UDEV_VERSION=v3.2.8
|
||||
ARG UDEV_HASH=d69f3f28348123ab7fa0ebac63ec2fd16800c5e0
|
||||
RUN set -ex \
|
||||
&& git clone https://github.com/gentoo/eudev -b ${UDEV_VERSION} \
|
||||
&& cd eudev \
|
||||
@@ -202,10 +202,11 @@ VOLUME /home/wownero/.wownero
|
||||
# wownero-wallet-cli
|
||||
VOLUME /wallet
|
||||
|
||||
EXPOSE 34567
|
||||
EXPOSE 34568
|
||||
EXPOSE 38080
|
||||
EXPOSE 38081
|
||||
|
||||
# switch to user wownero
|
||||
USER wownero
|
||||
|
||||
ENTRYPOINT ["wownerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=34567", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=34568", "--non-interactive", "--confirm-external-bind"]
|
||||
ENTRYPOINT ["wownerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=38080", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=38081", "--non-interactive", "--confirm-external-bind"]
|
||||
|
||||
|
||||
10
README.md
10
README.md
@@ -59,18 +59,14 @@ XMR: `44SQVPGLufPasUcuUQSZiF5c9BFzjcP8ucDxzzFDgLf1VkCEFaidJ3u2AhSKMhPLKA3jc2iS8w
|
||||
|
||||
BTC: `bc1qcw9zglp3fxyl25zswemw7jczlqryms2lsmu464`
|
||||
|
||||
### Open Collective
|
||||
|
||||
Open Collective is an online funding platform for open source software and collaborative communities. The platform brings together legal entities that act as a “Fiscal Host”, “Collectives” (unincorporated, community-based projects), and individuals interested in supporting projects with donations. Fiscal hosts hold donations for collectives in trust and handle all the taxes and legal stuff.
|
||||
|
||||
Wownero is hosted by Open Collective Europe, a Brussels-based non-profit that hosts many other collectives, such as Manjaro, EndeavourOS, Xfce, and peertube.social. If you would like donate to the Wownero Project using this method, you can check out our [Wownero - Open Collective](https://opencollective.com/wownero) page.
|
||||
|
||||
## Release staging and Contributing
|
||||
|
||||
**Anyone is welcome to contribute to Wownero's codebase!**
|
||||
|
||||
If you have a fix or code change, feel free to submit it as a pull request. Ahead of a scheduled software upgrade, a development branch will be created with the new release version tag. Pull requests that address bugs should be made to Master. Pull requests that require review and testing (generally, optimizations and new features) should be made to the development branch. All pull requests will be considered safe until the US dollar valuation of 1 Wownero equals $1000. After this valuation has been reached, more research will be needed to introduce experimental cryptography and/or code into the codebase.
|
||||
|
||||
From version 10, Wownero follows [Semantic Versioning 2.0.0](https://semver.org) standard for releases: MAJOR.MINOR.PATCH. **MAJOR** version deals with changes to consensus code, **MINOR** deals with new features, major bugs fixes, **PATCH** version deals with minor bug fixes, superficial changes.
|
||||
|
||||
Things to Do, Work in Progress, and Help Wanted tasks are tracked in the [Meta](https://git.wownero.com/wownero/meta/issues) repo.
|
||||
|
||||
Join `#wownero-dev` on IRC OFTC to participate in development conversation.
|
||||
@@ -91,7 +87,7 @@ Dates are provided in the format YYYY-MM-DD.
|
||||
| 160,777 | 2019-11-20 | Gaping Goatse | v0.7.0.0 | v0.7.1.0 | Only allow >= 2 outputs, change to the block median used to calculate penalty, rct sigs in coinbase forbidden, 4 unlock time as protocol rule
|
||||
| - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support
|
||||
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.3.3 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
|
||||
| 331,170 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.0.1 | Bulletproofs+, Miner Block Header Signing, Vote by Block, Change coinbase unlock time to 1 day, Reset difficulty and switch back to Monero's difficulty algorithm
|
||||
| 331,337 | 2021-07-04 | Junkie Jeff | 10.0.0 | 10.0.0 | Bulletproofs+, Miner Block Header Signing, Change coinbase unlock time to 1 day, Reset difficulty and switch back to Monero's difficulty algorithm
|
||||
|
||||
X's indicate that these details have not been determined as of commit date.
|
||||
|
||||
|
||||
5
external/easylogging++/easylogging++.cc
vendored
5
external/easylogging++/easylogging++.cc
vendored
@@ -714,8 +714,9 @@ Logger::Logger(const std::string& id, const Configurations& configurations,
|
||||
}
|
||||
|
||||
Logger::Logger(const Logger& logger) {
|
||||
base::utils::safeDelete(m_typedConfigurations);
|
||||
m_id = logger.m_id;
|
||||
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
|
||||
m_typedConfigurations = logger.m_typedConfigurations;
|
||||
m_parentApplicationName = logger.m_parentApplicationName;
|
||||
m_isConfigured = logger.m_isConfigured;
|
||||
m_configurations = logger.m_configurations;
|
||||
@@ -727,7 +728,7 @@ Logger& Logger::operator=(const Logger& logger) {
|
||||
if (&logger != this) {
|
||||
base::utils::safeDelete(m_typedConfigurations);
|
||||
m_id = logger.m_id;
|
||||
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
|
||||
m_typedConfigurations = logger.m_typedConfigurations;
|
||||
m_parentApplicationName = logger.m_parentApplicationName;
|
||||
m_isConfigured = logger.m_isConfigured;
|
||||
m_configurations = logger.m_configurations;
|
||||
|
||||
@@ -216,8 +216,15 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const std::pair
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_PRINT_L1("Unsupported input type, aborting transaction addition");
|
||||
throw std::runtime_error("Unexpected input type, aborting");
|
||||
LOG_PRINT_L1("Unsupported input type, removing key images and aborting transaction addition");
|
||||
for (const txin_v& tx_input : tx.vin)
|
||||
{
|
||||
if (tx_input.type() == typeid(txin_to_key))
|
||||
{
|
||||
remove_spent_key(boost::get<txin_to_key>(tx_input).k_image);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1354,8 +1354,7 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
|
||||
|
||||
m_folder = filename;
|
||||
|
||||
try { check_mmap_support(); }
|
||||
catch(...) { MERROR("Failed to check for mmap support, proceeding"); }
|
||||
check_mmap_support();
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
if ((mdb_flags & MDB_WRITEMAP) == 0) {
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
# Monero Blockchain Stats
|
||||
|
||||
Monero Blockchain Stats utlity exports daily statistics for the monero blockchain from creation through current state.
|
||||
|
||||
## Usage:
|
||||
|
||||
See also the utility's help option. `monero-blockchain-stats --help`
|
||||
|
||||
From the command line run:
|
||||
|
||||
`$ monero-blockchain-stats`
|
||||
|
||||
This loads the existing blockchain and prints the results to the terminal. Default printed data includes Blocks per Day, Total Blocks, Transactions per Day, Total Transactions, Bytes per Day and Total Bytes. The format of the output is in tab delimited csv which is printed to the console. Piping the output of the command to a csv file allows for saving the output of the utilty to a file.
|
||||
i.e. `monero-blockchain-stats > stats.csv`
|
||||
|
||||
### Options
|
||||
`--data-dir arg`
|
||||
to specify location of blockchain storage
|
||||
|
||||
`--testnet`
|
||||
Run on testnet.
|
||||
|
||||
`--stagenet`
|
||||
Run on stagenet.
|
||||
|
||||
`--log-level arg`
|
||||
0-4 or categories
|
||||
|
||||
`--block-start arg (=0)`
|
||||
start at block number
|
||||
|
||||
`--block-stop arg (=0)`
|
||||
Stop at block number
|
||||
|
||||
`--with-inputs`
|
||||
with input stats
|
||||
|
||||
`--with-outputs`
|
||||
with output stats
|
||||
|
||||
`--with-ringsize`
|
||||
with ringsize stats
|
||||
|
||||
`--with-hours`
|
||||
with txns per hour
|
||||
|
||||
`--with-emission`
|
||||
with coin emission
|
||||
|
||||
`--with-fees`
|
||||
with txn fees
|
||||
|
||||
`--with-diff`
|
||||
with difficulty
|
||||
@@ -146,7 +146,7 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
|
||||
if (!parse_and_validate_block_from_blob(b.block, block))
|
||||
{
|
||||
MERROR("Failed to parse block: "
|
||||
<< epee::string_tools::buff_to_hex_nodelimer(b.block));
|
||||
<< epee::string_tools::pod_to_hex(get_blob_hash(b.block)));
|
||||
core.cleanup_handle_incoming_blocks();
|
||||
return 1;
|
||||
}
|
||||
@@ -177,11 +177,8 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
|
||||
core.handle_incoming_tx(tx_blob, tvc, relay_method::block, true);
|
||||
if(tvc.m_verifivation_failed)
|
||||
{
|
||||
cryptonote::transaction transaction;
|
||||
if (cryptonote::parse_and_validate_tx_from_blob(tx_blob.blob, transaction))
|
||||
MERROR("Transaction verification failed, tx_id = " << cryptonote::get_transaction_hash(transaction));
|
||||
else
|
||||
MERROR("Transaction verification failed, transaction is unparsable");
|
||||
MERROR("transaction verification failed, tx_id = "
|
||||
<< epee::string_tools::pod_to_hex(get_blob_hash(tx_blob.blob)));
|
||||
core.cleanup_handle_incoming_blocks();
|
||||
return 1;
|
||||
}
|
||||
@@ -195,11 +192,8 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
|
||||
|
||||
if(bvc.m_verifivation_failed)
|
||||
{
|
||||
cryptonote::block block;
|
||||
if (cryptonote::parse_and_validate_block_from_blob(block_entry.block, block))
|
||||
MERROR("Block verification failed, id = " << cryptonote::get_block_hash(block));
|
||||
else
|
||||
MERROR("Block verification failed, block is unparsable");
|
||||
MERROR("Block verification failed, id = "
|
||||
<< epee::string_tools::pod_to_hex(get_blob_hash(block_entry.block)));
|
||||
core.cleanup_handle_incoming_blocks();
|
||||
return 1;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -219,7 +219,6 @@ namespace cryptonote
|
||||
ADD_CHECKPOINT2(307883, "9a8c35cd10963a14bba8a9628d1776df92fee5e3153b7249f5d15726efafaaea", "0x30b0965ba5a18");
|
||||
ADD_CHECKPOINT2(312130, "e0da085bd273fff9f5f8e604fce0e91908bc62b6b004731a93e16e89cb9b1f54", "0x3cfe7148f2e18");
|
||||
ADD_CHECKPOINT2(324600, "b24cd1ed7c192bbcf3d5b15729f2b032566687f96bda6f8cb73a5b16df4c6e6b", "0x69caecbe78718");
|
||||
ADD_CHECKPOINT2(327700, "f113c8cbe077aab9296ecbfb41780c147aeb54edfece7e4b9946b8abd0f06de7", "0x732431429c818");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +447,6 @@ namespace cryptonote
|
||||
crypto::hash prev_id;
|
||||
uint32_t nonce;
|
||||
crypto::signature signature;
|
||||
uint16_t vote;
|
||||
|
||||
BEGIN_SERIALIZE()
|
||||
VARINT_FIELD(major_version)
|
||||
@@ -456,10 +455,7 @@ namespace cryptonote
|
||||
FIELD(prev_id)
|
||||
FIELD(nonce)
|
||||
if (major_version >= BLOCK_HEADER_MINER_SIG)
|
||||
{
|
||||
FIELD(signature)
|
||||
FIELD(vote)
|
||||
}
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
|
||||
@@ -188,7 +188,6 @@ namespace boost
|
||||
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
||||
{
|
||||
a & b.signature;
|
||||
a & b.vote;
|
||||
}
|
||||
//------------------
|
||||
a & b.miner_tx;
|
||||
@@ -342,7 +341,7 @@ namespace boost
|
||||
if (x.rangeSigs.empty())
|
||||
{
|
||||
a & x.bulletproofs;
|
||||
if (ver >= 2u)
|
||||
if (ver >= 2)
|
||||
a & x.bulletproofs_plus;
|
||||
}
|
||||
a & x.MGs;
|
||||
@@ -372,7 +371,7 @@ namespace boost
|
||||
if (x.p.rangeSigs.empty())
|
||||
{
|
||||
a & x.p.bulletproofs;
|
||||
if (ver >= 2u)
|
||||
if (ver >= 2)
|
||||
a & x.p.bulletproofs_plus;
|
||||
}
|
||||
a & x.p.MGs;
|
||||
|
||||
@@ -181,6 +181,7 @@ namespace cryptonote
|
||||
|
||||
if (!base_only)
|
||||
{
|
||||
const bool bulletproof = rct::is_rct_bulletproof(rv.type);
|
||||
const bool bulletproof_plus = rct::is_rct_bulletproof_plus(rv.type);
|
||||
if (bulletproof_plus)
|
||||
{
|
||||
@@ -206,7 +207,6 @@ namespace cryptonote
|
||||
for (size_t i = 0; i < n_amounts; ++i)
|
||||
rv.p.bulletproofs_plus[0].V[i] = rv.outPk[i].mask;
|
||||
}
|
||||
const bool bulletproof = rct::is_rct_bulletproof(rv.type);
|
||||
if (rct::is_rct_new_bulletproof(rv.type))
|
||||
{
|
||||
if (rv.p.bulletproofs.size() != 1)
|
||||
@@ -1324,22 +1324,13 @@ namespace cryptonote
|
||||
crypto::hash get_sig_data(const block& b)
|
||||
{
|
||||
crypto::hash sig_data;
|
||||
blobdata blob = get_block_hashing_blob_sig_data(b);
|
||||
crypto::cn_fast_hash(blob.data(), blob.size(), sig_data);
|
||||
std::stringstream ss;
|
||||
ss << (b.nonce + b.timestamp);
|
||||
std::string d(ss.str());
|
||||
crypto::cn_fast_hash(d.data(), d.size(), sig_data);
|
||||
return sig_data;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
blobdata get_block_hashing_blob_sig_data(const block& b)
|
||||
{
|
||||
block_header tmp = static_cast<const block_header&>(b);
|
||||
memset(&tmp.signature, 0, sizeof(tmp.signature));
|
||||
blobdata blob = t_serializable_object_to_blob(tmp);
|
||||
crypto::hash tree_root_hash = get_tx_tree_hash(b);
|
||||
blob.append(reinterpret_cast<const char*>(&tree_root_hash), sizeof(tree_root_hash));
|
||||
blob.append(tools::get_varint_data(b.tx_hashes.size()+1));
|
||||
return blob;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
std::vector<uint64_t> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off)
|
||||
{
|
||||
std::vector<uint64_t> res = off;
|
||||
|
||||
@@ -122,7 +122,6 @@ namespace cryptonote
|
||||
bool get_block_hash(const block& b, crypto::hash& res);
|
||||
crypto::hash get_block_hash(const block& b);
|
||||
crypto::hash get_sig_data(const block& b);
|
||||
blobdata get_block_hashing_blob_sig_data(const block& b);
|
||||
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash *block_hash);
|
||||
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b);
|
||||
bool parse_and_validate_block_from_blob(const blobdata_ref& b_blob, block& b, crypto::hash &block_hash);
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "storages/portable_storage_template_helper.h"
|
||||
#include "boost/logic/tribool.hpp"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <sys/times.h>
|
||||
@@ -101,7 +103,6 @@ namespace cryptonote
|
||||
const command_line::arg_descriptor<uint16_t> arg_bg_mining_idle_threshold_percentage = {"bg-mining-idle-threshold", "Specify minimum avg idle percentage over lookback interval", miner::BACKGROUND_MINING_DEFAULT_IDLE_THRESHOLD_PERCENTAGE, true};
|
||||
const command_line::arg_descriptor<uint16_t> arg_bg_mining_miner_target_percentage = {"bg-mining-miner-target", "Specify maximum percentage cpu use by miner(s)", miner::BACKGROUND_MINING_DEFAULT_MINING_TARGET_PERCENTAGE, true};
|
||||
const command_line::arg_descriptor<std::string> arg_spendkey = {"spendkey", "Specify secret spend key used for mining", "", true};
|
||||
const command_line::arg_descriptor<std::string> arg_vote = {"vote", "Vote for proposals.", "", true};
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +296,6 @@ namespace cryptonote
|
||||
command_line::add_arg(desc, arg_bg_mining_idle_threshold_percentage);
|
||||
command_line::add_arg(desc, arg_bg_mining_miner_target_percentage);
|
||||
command_line::add_arg(desc, arg_spendkey);
|
||||
command_line::add_arg(desc, arg_vote);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool miner::init(const boost::program_options::variables_map& vm, network_type nettype)
|
||||
@@ -311,25 +311,6 @@ namespace cryptonote
|
||||
m_spendkey = spendkey;
|
||||
m_viewkey = viewkey;
|
||||
}
|
||||
if(!command_line::has_arg(vm, arg_vote))
|
||||
{
|
||||
m_int_vote = 0;
|
||||
} else {
|
||||
m_vote = command_line::get_arg(vm, arg_vote);
|
||||
if(m_vote != "yes" && m_vote != "no")
|
||||
{
|
||||
LOG_ERROR("Voting format error, only a \"yes\" or \"no\" response is accepted");
|
||||
return false;
|
||||
}
|
||||
if(m_vote == "yes")
|
||||
{
|
||||
m_int_vote = 1;
|
||||
}
|
||||
if(m_vote == "no")
|
||||
{
|
||||
m_int_vote = 2;
|
||||
}
|
||||
}
|
||||
if(command_line::has_arg(vm, arg_extra_messages))
|
||||
{
|
||||
std::string buff;
|
||||
@@ -627,7 +608,6 @@ namespace cryptonote
|
||||
crypto::generate_signature(sig_data, eph_pub_key, eph_secret_key, signature);
|
||||
// amend signature to block header before PoW hashing
|
||||
b.signature = signature;
|
||||
b.vote = m_int_vote;
|
||||
}
|
||||
|
||||
crypto::hash h;
|
||||
@@ -665,14 +645,6 @@ namespace cryptonote
|
||||
" //@@@@@@@@@@@@@@@@@// \n"
|
||||
<< ENDL);
|
||||
MGINFO_GREEN("Awesome, you won a block reward!\n" << get_block_hash(b) << " at height " << height);
|
||||
if (b.vote == 1)
|
||||
{
|
||||
MGINFO_GREEN("Your \"YES\" vote has been cast.");
|
||||
}
|
||||
if (b.vote == 2)
|
||||
{
|
||||
MGINFO_GREEN("Your \"NO\" vote has been cast.");
|
||||
}
|
||||
cryptonote::block_verification_context bvc;
|
||||
if(!m_phandler->handle_block_found(b, bvc) || !bvc.m_added_to_main_chain)
|
||||
{
|
||||
|
||||
@@ -138,8 +138,6 @@ namespace cryptonote
|
||||
account_public_address m_mine_address;
|
||||
crypto::secret_key m_spendkey;
|
||||
crypto::secret_key m_viewkey;
|
||||
std::string m_vote;
|
||||
uint16_t m_int_vote;
|
||||
epee::math_helper::once_a_time_seconds<5> m_update_block_template_interval;
|
||||
epee::math_helper::once_a_time_seconds<2> m_update_merge_hr_interval;
|
||||
epee::math_helper::once_a_time_seconds<1> m_autodetect_interval;
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
#define DIFFICULTY_BLOCKS_COUNT_V3 DIFFICULTY_WINDOW_V3 + 1 // added +1 to make N=N
|
||||
#define DIFFICULTY_BLOCKS_COUNT_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N
|
||||
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
|
||||
#define DIFFICULTY_RESET_HEIGHT 331170// ~July 4, 2021 Pool Independence Day
|
||||
#define DIFFICULTY_RESET_HEIGHT 331571 // ~July 4, 2021 Pool Independence Day
|
||||
#define DIFFICULTY_RESET_LEVEL 100000000 // 100 mill
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "include_base_utils.h"
|
||||
#include "cryptonote_basic/cryptonote_basic_impl.h"
|
||||
@@ -1395,11 +1397,6 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
||||
MWARNING("Wrong txout type");
|
||||
return false;
|
||||
}
|
||||
if (b.vote > 2)
|
||||
{
|
||||
MWARNING("Vote integer must be either 0, 1, or 2");
|
||||
return false;
|
||||
}
|
||||
// keccak hash block header data and check miner signature
|
||||
// if signature is invalid, reject block
|
||||
crypto::hash sig_data = get_sig_data(b);
|
||||
@@ -1411,7 +1408,6 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
||||
return false;
|
||||
} else {
|
||||
LOG_PRINT_L1("Miner signature is good");
|
||||
LOG_PRINT_L1("Vote: " << b.vote);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1828,7 +1824,8 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
|
||||
//make blocks coin-base tx looks close to real coinbase tx to get truthful blob weight
|
||||
uint8_t hf_version = b.major_version;
|
||||
size_t max_outs = hf_version >= 4 ? 1 : 11;
|
||||
bool r = construct_miner_tx(this, m_nettype, height, median_weight, already_generated_coins, txs_weight, fee, miner_address, b.miner_tx, ex_nonce, max_outs, hf_version);
|
||||
keypair txkey = keypair::generate(hw::get_device("default"));
|
||||
bool r = construct_miner_tx(this, txkey, m_nettype, height, median_weight, already_generated_coins, txs_weight, fee, miner_address, b.miner_tx, ex_nonce, max_outs, hf_version);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to construct miner tx, first chance");
|
||||
size_t cumulative_weight = txs_weight + get_transaction_weight(b.miner_tx);
|
||||
#if defined(DEBUG_CREATE_BLOCK_TEMPLATE)
|
||||
@@ -1837,8 +1834,7 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
|
||||
#endif
|
||||
for (size_t try_count = 0; try_count != 10; ++try_count)
|
||||
{
|
||||
r = construct_miner_tx(this, m_nettype, height, median_weight, already_generated_coins, cumulative_weight, fee, miner_address, b.miner_tx, ex_nonce, max_outs, hf_version);
|
||||
|
||||
r = construct_miner_tx(this, txkey, m_nettype, height, median_weight, already_generated_coins, cumulative_weight, fee, miner_address, b.miner_tx, ex_nonce, max_outs, hf_version);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to construct miner tx, second chance");
|
||||
size_t coinbase_weight = get_transaction_weight(b.miner_tx);
|
||||
if (coinbase_weight > cumulative_weight - txs_weight)
|
||||
@@ -2724,7 +2720,7 @@ bool Blockchain::get_split_transactions_blobs(const t_ids_container& txs_ids, t_
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
template<class t_ids_container, class t_tx_container, class t_missed_container>
|
||||
bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs, bool pruned) const
|
||||
bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs) const
|
||||
{
|
||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||
@@ -2735,12 +2731,10 @@ bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container
|
||||
try
|
||||
{
|
||||
cryptonote::blobdata tx;
|
||||
bool res = pruned ? m_db->get_pruned_tx_blob(tx_hash, tx) : m_db->get_tx_blob(tx_hash, tx);
|
||||
if (res)
|
||||
if (m_db->get_tx_blob(tx_hash, tx))
|
||||
{
|
||||
txs.push_back(transaction());
|
||||
res = pruned ? parse_and_validate_tx_base_from_blob(tx, txs.back()) : parse_and_validate_tx_from_blob(tx, txs.back());
|
||||
if (!res)
|
||||
if (!parse_and_validate_tx_from_blob(tx, txs.back()))
|
||||
{
|
||||
LOG_ERROR("Invalid transaction");
|
||||
return false;
|
||||
@@ -5525,7 +5519,7 @@ void Blockchain::cancel()
|
||||
}
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
static const char expected_block_hashes_hash[] = "6dd0d016366b906ed9e493f721d3b3f60c0db628774206424651b6e8f2a76a95";
|
||||
static const char expected_block_hashes_hash[] = "bf90cee947a6becbcdcbaa3aabf7055b1eabc2305739961d984615a7ccf357f7";
|
||||
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
|
||||
{
|
||||
if (get_checkpoints == nullptr || !m_fast_sync)
|
||||
@@ -5683,6 +5677,6 @@ void Blockchain::cache_block_template(const block &b, const cryptonote::account_
|
||||
}
|
||||
|
||||
namespace cryptonote {
|
||||
template bool Blockchain::get_transactions(const std::vector<crypto::hash>&, std::vector<transaction>&, std::vector<crypto::hash>&, bool) const;
|
||||
template bool Blockchain::get_transactions(const std::vector<crypto::hash>&, std::vector<transaction>&, std::vector<crypto::hash>&) const;
|
||||
template bool Blockchain::get_split_transactions_blobs(const std::vector<crypto::hash>&, std::vector<std::tuple<crypto::hash, cryptonote::blobdata, crypto::hash, cryptonote::blobdata>>&, std::vector<crypto::hash>&) const;
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ namespace cryptonote
|
||||
template<class t_ids_container, class t_tx_container, class t_missed_container>
|
||||
bool get_split_transactions_blobs(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs) const;
|
||||
template<class t_ids_container, class t_tx_container, class t_missed_container>
|
||||
bool get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs, bool pruned = false) const;
|
||||
bool get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs) const;
|
||||
|
||||
//debug functions
|
||||
|
||||
|
||||
@@ -429,9 +429,9 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs, bool pruned) const
|
||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs) const
|
||||
{
|
||||
return m_blockchain_storage.get_transactions_blobs(txs_ids, txs, missed_txs, pruned);
|
||||
return m_blockchain_storage.get_transactions_blobs(txs_ids, txs, missed_txs);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_split_transactions_blobs(const std::vector<crypto::hash>& txs_ids, std::vector<std::tuple<crypto::hash, cryptonote::blobdata, crypto::hash, cryptonote::blobdata>>& txs, std::vector<crypto::hash>& missed_txs) const
|
||||
@@ -445,9 +445,9 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs, bool pruned) const
|
||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs) const
|
||||
{
|
||||
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs, pruned);
|
||||
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_alternative_blocks(std::vector<block>& blocks) const
|
||||
@@ -1304,7 +1304,7 @@ namespace cryptonote
|
||||
std::vector<transaction> txs;
|
||||
std::vector<crypto::hash> missed_txs;
|
||||
uint64_t coinbase_amount = get_outs_money_amount(b.miner_tx);
|
||||
this->get_transactions(b.tx_hashes, txs, missed_txs, true);
|
||||
this->get_transactions(b.tx_hashes, txs, missed_txs);
|
||||
uint64_t tx_fee_amount = 0;
|
||||
for(const auto& tx: txs)
|
||||
{
|
||||
|
||||
@@ -385,7 +385,7 @@ namespace cryptonote
|
||||
*
|
||||
* @note see Blockchain::get_transactions
|
||||
*/
|
||||
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
|
||||
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs) const;
|
||||
|
||||
/**
|
||||
* @copydoc Blockchain::get_transactions
|
||||
@@ -399,7 +399,7 @@ namespace cryptonote
|
||||
*
|
||||
* @note see Blockchain::get_transactions
|
||||
*/
|
||||
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
|
||||
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs) const;
|
||||
|
||||
/**
|
||||
* @copydoc Blockchain::get_block_by_hash
|
||||
|
||||
@@ -76,12 +76,11 @@ namespace cryptonote
|
||||
LOG_PRINT_L2("destinations include " << num_stdaddresses << " standard addresses and " << num_subaddresses << " subaddresses");
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool construct_miner_tx(const Blockchain *pb, network_type m_nettype, size_t height, size_t median_weight, uint64_t already_generated_coins, size_t current_block_weight, uint64_t fee, const account_public_address &miner_address, transaction& tx, const blobdata& extra_nonce, size_t max_outs, uint8_t hard_fork_version) {
|
||||
bool construct_miner_tx(const Blockchain *pb, const keypair& txkey, network_type m_nettype, size_t height, size_t median_weight, uint64_t already_generated_coins, size_t current_block_weight, uint64_t fee, const account_public_address &miner_address, transaction& tx, const blobdata& extra_nonce, size_t max_outs, uint8_t hard_fork_version) {
|
||||
tx.vin.clear();
|
||||
tx.vout.clear();
|
||||
tx.extra.clear();
|
||||
|
||||
keypair txkey = keypair::generate(hw::get_device("default"));
|
||||
add_tx_pub_key_to_extra(tx, txkey.pub);
|
||||
if(!extra_nonce.empty())
|
||||
if(!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce))
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace cryptonote
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
class Blockchain;
|
||||
bool construct_miner_tx(const Blockchain *pb, network_type m_nettype, size_t height, size_t median_weight, uint64_t already_generated_coins, size_t current_block_weight, uint64_t fee, const account_public_address &miner_address, transaction& tx, const blobdata& extra_nonce = blobdata(), size_t max_outs = 999, uint8_t hard_fork_version = 1);
|
||||
bool construct_miner_tx(const Blockchain *pb, const keypair& txkey, network_type m_nettype, size_t height, size_t median_weight, uint64_t already_generated_coins, size_t current_block_weight, uint64_t fee, const account_public_address &miner_address, transaction& tx, const blobdata& extra_nonce = blobdata(), size_t max_outs = 999, uint8_t hard_fork_version = 1);
|
||||
|
||||
struct tx_source_entry
|
||||
{
|
||||
|
||||
@@ -94,7 +94,6 @@ namespace {
|
||||
void print_block_header(cryptonote::block_header_response const & header)
|
||||
{
|
||||
tools::success_msg_writer()
|
||||
<< "vote: " << header.vote << std::endl
|
||||
<< "timestamp: " << boost::lexical_cast<std::string>(header.timestamp) << " (" << tools::get_human_readable_timestamp(header.timestamp) << ")" << std::endl
|
||||
<< "previous hash: " << header.prev_hash << std::endl
|
||||
<< "nonce: " << boost::lexical_cast<std::string>(header.nonce) << std::endl
|
||||
|
||||
@@ -573,13 +573,8 @@ namespace trezor{
|
||||
std::string req = "PINGPING";
|
||||
char res[8];
|
||||
|
||||
const auto written = m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
|
||||
if (written != req.size())
|
||||
return false;
|
||||
memset(res, 0, sizeof(res));
|
||||
const auto received = receive(res, 8, nullptr, false, timeout);
|
||||
if (received != 8)
|
||||
return false;
|
||||
m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
|
||||
receive(res, 8, nullptr, false, timeout);
|
||||
|
||||
return memcmp(res, "PONGPONG", 8) == 0;
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ const hardfork_t mainnet_hard_forks[] = {
|
||||
{ 15, 160777, 0, 1573280497 },
|
||||
{ 16, 253999, 0, 1600576508 },
|
||||
{ 17, 254287, 0, 1600576524 },
|
||||
{ 18, 331170, 0, 1623245591 },
|
||||
{ 19, 331458, 0, 1624793373 },
|
||||
{ 18, 331337, 0, 1623245591 },
|
||||
{ 19, 331625, 0, 1623693101 },
|
||||
};
|
||||
const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]);
|
||||
|
||||
|
||||
@@ -172,14 +172,14 @@ namespace rct {
|
||||
|
||||
BulletproofPlus proveRangeBulletproofPlus(keyV &C, keyV &masks, const std::vector<uint64_t> &amounts, epee::span<const key> sk, hw::device &hwdev)
|
||||
{
|
||||
CHECK_AND_ASSERT_THROW_MES(amounts.size() == sk.size(), "Invalid amounts/sk sizes");
|
||||
masks.resize(amounts.size());
|
||||
for (size_t i = 0; i < masks.size(); ++i)
|
||||
masks[i] = hwdev.genCommitmentMask(sk[i]);
|
||||
BulletproofPlus proof = bulletproof_plus_PROVE(amounts, masks);
|
||||
CHECK_AND_ASSERT_THROW_MES(proof.V.size() == amounts.size(), "V does not have the expected size");
|
||||
C = proof.V;
|
||||
return proof;
|
||||
CHECK_AND_ASSERT_THROW_MES(amounts.size() == sk.size(), "Invalid amounts/sk sizes");
|
||||
masks.resize(amounts.size());
|
||||
for (size_t i = 0; i < masks.size(); ++i)
|
||||
masks[i] = hwdev.genCommitmentMask(sk[i]);
|
||||
BulletproofPlus proof = bulletproof_plus_PROVE(amounts, masks);
|
||||
CHECK_AND_ASSERT_THROW_MES(proof.V.size() == amounts.size(), "V does not have the expected size");
|
||||
C = proof.V;
|
||||
return proof;
|
||||
}
|
||||
|
||||
bool verBulletproofPlus(const BulletproofPlus &proof)
|
||||
@@ -1705,6 +1705,16 @@ namespace rct {
|
||||
offset += rv.p.rangeSigs.size();
|
||||
}
|
||||
}
|
||||
for (const rctSig *rvp: rvv)
|
||||
{
|
||||
const rctSig &rv = *rvp;
|
||||
if (!rct::is_rct_new_bulletproof(rv.type)){
|
||||
if (!bp_proofs.empty() && !verBulletproof_old(bp_proofs))
|
||||
{
|
||||
LOG_PRINT_L1("Aggregate range proof verified failed");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!bpp_proofs.empty() && !verBulletproofPlus(bpp_proofs))
|
||||
{
|
||||
if (!waiter.wait())
|
||||
@@ -1717,7 +1727,8 @@ namespace rct {
|
||||
LOG_PRINT_L1("Aggregate range proof verified failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!waiter.wait())
|
||||
return false;
|
||||
for (size_t i = 0; i < results.size(); ++i) {
|
||||
@@ -1852,7 +1863,8 @@ namespace rct {
|
||||
}
|
||||
|
||||
xmr_amount decodeRctSimple(const rctSig & rv, const key & sk, unsigned int i, key &mask, hw::device &hwdev) {
|
||||
CHECK_AND_ASSERT_MES(rv.type == RCTTypeSimple || rv.type == RCTTypeBulletproof || rv.type == RCTTypeBulletproof2 || rv.type == RCTTypeSimpleBulletproof || rv.type == RCTTypeCLSAG || rv.type == RCTTypeBulletproofPlus, false, "decodeRct called on non simple rctSig");
|
||||
CHECK_AND_ASSERT_MES(rv.type == RCTTypeSimple || rv.type == RCTTypeBulletproof || rv.type == RCTTypeBulletproof2 || rv.type == RCTTypeSimpleBulletproof || rv.type == RCTTypeCLSAG || rv.type == RCTTypeBulletproofPlus,
|
||||
false, "decodeRct called on non simple rctSig");
|
||||
CHECK_AND_ASSERT_THROW_MES(i < rv.ecdhInfo.size(), "Bad index");
|
||||
CHECK_AND_ASSERT_THROW_MES(rv.outPk.size() == rv.ecdhInfo.size(), "Mismatched sizes of rv.outPk and rv.ecdhInfo");
|
||||
|
||||
|
||||
@@ -422,20 +422,18 @@ namespace rct {
|
||||
return ar.good();
|
||||
if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeFullBulletproof && type != RCTTypeSimpleBulletproof && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus)
|
||||
return false;
|
||||
if (type == RCTTypeSimpleBulletproof || type == RCTTypeFullBulletproof)
|
||||
{
|
||||
ar.tag("bp");
|
||||
ar.begin_array();
|
||||
PREPARE_CUSTOM_VECTOR_SERIALIZATION(outputs, bulletproofs);
|
||||
if (bulletproofs.size() != outputs)
|
||||
return false;
|
||||
for (size_t i = 0; i < outputs; ++i)
|
||||
{
|
||||
FIELDS(bulletproofs[i])
|
||||
if (outputs - i > 1)
|
||||
ar.delimit_array();
|
||||
}
|
||||
ar.end_array();
|
||||
if (type == RCTTypeSimpleBulletproof || type == RCTTypeFullBulletproof) {
|
||||
ar.tag("bp");
|
||||
ar.begin_array();
|
||||
PREPARE_CUSTOM_VECTOR_SERIALIZATION(outputs, bulletproofs);
|
||||
if (bulletproofs.size() != outputs)
|
||||
return false;
|
||||
for (size_t i = 0; i < outputs; ++i) {
|
||||
FIELDS(bulletproofs[i])
|
||||
if (outputs - i > 1)
|
||||
ar.delimit_array();
|
||||
}
|
||||
ar.end_array();
|
||||
}
|
||||
else if (type == RCTTypeBulletproofPlus)
|
||||
{
|
||||
@@ -454,7 +452,6 @@ namespace rct {
|
||||
}
|
||||
if (n_bulletproof_plus_max_amounts(bulletproofs_plus) < outputs)
|
||||
return false;
|
||||
ar.end_array();
|
||||
}
|
||||
else if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG)
|
||||
{
|
||||
@@ -617,12 +614,12 @@ namespace rct {
|
||||
|
||||
keyV& get_pseudo_outs()
|
||||
{
|
||||
return type == RCTTypeBulletproof || type == RCTTypeSimpleBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
||||
return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeSimpleBulletproof || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
||||
}
|
||||
|
||||
keyV const& get_pseudo_outs() const
|
||||
{
|
||||
return type == RCTTypeBulletproof || type == RCTTypeSimpleBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
||||
return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeSimpleBulletproof || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
||||
}
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
|
||||
@@ -1319,7 +1319,7 @@ namespace cryptonote
|
||||
}
|
||||
if(!miner.start(info.address, static_cast<size_t>(req.threads_count), req.do_background_mining, req.ignore_battery))
|
||||
{
|
||||
res.status = "Failed, mining not started";
|
||||
res.status = "Failed, mining not started.";
|
||||
LOG_PRINT_L0(res.status);
|
||||
return true;
|
||||
}
|
||||
@@ -1859,7 +1859,6 @@ namespace cryptonote
|
||||
res.blocktemplate_blob = string_tools::buff_to_hex_nodelimer(block_blob);
|
||||
res.blockhashing_blob = string_tools::buff_to_hex_nodelimer(hashing_blob);
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
res.vote = 0;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -2091,7 +2090,6 @@ namespace cryptonote
|
||||
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
||||
{
|
||||
b.signature = {};
|
||||
b.vote = 0;
|
||||
}
|
||||
crypto::hash seed_hash = crypto::null_hash;
|
||||
if (b.major_version >= RX_BLOCK_VERSION && !epee::string_tools::hex_to_pod(template_res.seed_hash, seed_hash))
|
||||
@@ -2131,7 +2129,6 @@ namespace cryptonote
|
||||
bool core_rpc_server::fill_block_header_response(const block& blk, bool orphan_status, uint64_t height, const crypto::hash& hash, block_header_response& response, bool fill_pow_hash)
|
||||
{
|
||||
PERF_TIMER(fill_block_header_response);
|
||||
response.vote = blk.vote;
|
||||
response.major_version = blk.major_version;
|
||||
response.minor_version = blk.minor_version;
|
||||
response.timestamp = blk.timestamp;
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace cryptonote
|
||||
// advance which version they will stop working with
|
||||
// Don't go over 32767 for any of these
|
||||
#define CORE_RPC_VERSION_MAJOR 3
|
||||
#define CORE_RPC_VERSION_MINOR 8
|
||||
#define CORE_RPC_VERSION_MINOR 7
|
||||
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
|
||||
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
|
||||
|
||||
@@ -921,7 +921,6 @@ namespace cryptonote
|
||||
blobdata blocktemplate_blob;
|
||||
blobdata blockhashing_blob;
|
||||
uint64_t unlock_height;
|
||||
uint16_t vote;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE_PARENT(rpc_response_base)
|
||||
@@ -938,7 +937,6 @@ namespace cryptonote
|
||||
KV_SERIALIZE(seed_hash)
|
||||
KV_SERIALIZE(next_seed_hash)
|
||||
KV_SERIALIZE(unlock_height)
|
||||
KV_SERIALIZE(vote)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
@@ -1060,7 +1058,6 @@ namespace cryptonote
|
||||
std::string pow_hash;
|
||||
uint64_t long_term_weight;
|
||||
std::string miner_tx_hash;
|
||||
uint16_t vote;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(major_version)
|
||||
@@ -1085,7 +1082,6 @@ namespace cryptonote
|
||||
KV_SERIALIZE(pow_hash)
|
||||
KV_SERIALIZE_OPT(long_term_weight, (uint64_t)0)
|
||||
KV_SERIALIZE(miner_tx_hash)
|
||||
KV_SERIALIZE(vote)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ namespace rpc
|
||||
|
||||
if(!m_core.get_miner().start(info.address, static_cast<size_t>(req.threads_count), req.do_background_mining, req.ignore_battery))
|
||||
{
|
||||
res.error_details = "Failed, mining not started";
|
||||
res.error_details = "Failed, mining not started.";
|
||||
LOG_PRINT_L0(res.error_details);
|
||||
res.status = Message::STATUS_FAILED;
|
||||
return;
|
||||
@@ -898,7 +898,6 @@ namespace rpc
|
||||
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
||||
{
|
||||
header.signature = b.signature;
|
||||
header.vote = b.vote;
|
||||
}
|
||||
header.prev_id = b.prev_id;
|
||||
|
||||
|
||||
@@ -165,7 +165,6 @@ namespace rpc
|
||||
crypto::hash prev_id;
|
||||
uint32_t nonce;
|
||||
crypto::signature signature;
|
||||
uint16_t vote;
|
||||
uint64_t height;
|
||||
uint64_t depth;
|
||||
crypto::hash hash;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace rpc
|
||||
bool is_version_string_valid(const std::string& str)
|
||||
{
|
||||
return std::regex_match(str, std::regex(
|
||||
"^\\d{1,2}(\\.\\d{1,2}){3}(-(release|[0-9a-f]{9}))?$",
|
||||
"^.*$",
|
||||
std::regex_constants::nosubs
|
||||
));
|
||||
}
|
||||
|
||||
@@ -313,7 +313,6 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::b
|
||||
INSERT_INTO_JSON_OBJECT(dest, prev_id, b.prev_id);
|
||||
INSERT_INTO_JSON_OBJECT(dest, nonce, b.nonce);
|
||||
INSERT_INTO_JSON_OBJECT(dest, signature, b.signature);
|
||||
INSERT_INTO_JSON_OBJECT(dest, vote, b.vote);
|
||||
INSERT_INTO_JSON_OBJECT(dest, miner_tx, b.miner_tx);
|
||||
INSERT_INTO_JSON_OBJECT(dest, tx_hashes, b.tx_hashes);
|
||||
|
||||
@@ -334,7 +333,6 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::block& b)
|
||||
GET_FROM_JSON_OBJECT(val, b.prev_id, prev_id);
|
||||
GET_FROM_JSON_OBJECT(val, b.nonce, nonce);
|
||||
GET_FROM_JSON_OBJECT(val, b.signature, signature);
|
||||
GET_FROM_JSON_OBJECT(val, b.vote, vote);
|
||||
GET_FROM_JSON_OBJECT(val, b.miner_tx, miner_tx);
|
||||
GET_FROM_JSON_OBJECT(val, b.tx_hashes, tx_hashes);
|
||||
}
|
||||
@@ -1050,7 +1048,6 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::r
|
||||
{
|
||||
dest.StartObject();
|
||||
|
||||
INSERT_INTO_JSON_OBJECT(dest, vote, response.vote);
|
||||
INSERT_INTO_JSON_OBJECT(dest, major_version, response.major_version);
|
||||
INSERT_INTO_JSON_OBJECT(dest, minor_version, response.minor_version);
|
||||
INSERT_INTO_JSON_OBJECT(dest, timestamp, response.timestamp);
|
||||
@@ -1072,7 +1069,6 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::rpc::BlockHeaderResp
|
||||
throw WRONG_TYPE("json object");
|
||||
}
|
||||
|
||||
GET_FROM_JSON_OBJECT(val, response.vote, vote);
|
||||
GET_FROM_JSON_OBJECT(val, response.major_version, major_version);
|
||||
GET_FROM_JSON_OBJECT(val, response.minor_version, minor_version);
|
||||
GET_FROM_JSON_OBJECT(val, response.timestamp, timestamp);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||
#define DEF_MONERO_VERSION "0.10.0.1"
|
||||
#define DEF_MONERO_VERSION "10.0.0"
|
||||
#define DEF_MONERO_RELEASE_NAME "Junkie Jeff"
|
||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
|
||||
|
||||
@@ -81,7 +81,7 @@ bool AddressBookImpl::setDescription(std::size_t index, const std::string &descr
|
||||
|
||||
tools::wallet2::address_book_row entry = ab[index];
|
||||
entry.m_description = description;
|
||||
bool r = m_wallet->m_wallet->set_address_book_row(index, entry.m_address, entry.m_has_payment_id ? &entry.m_payment_id : nullptr, entry.m_description, entry.m_is_subaddress);
|
||||
bool r = m_wallet->m_wallet->set_address_book_row(index, entry.m_address, NULL, entry.m_description, entry.m_is_subaddress);
|
||||
if (r)
|
||||
refresh();
|
||||
else
|
||||
@@ -166,3 +166,5 @@ AddressBookImpl::~AddressBookImpl()
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -66,3 +66,6 @@ private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
|
||||
@@ -264,3 +264,6 @@ std::vector<std::string> PendingTransactionImpl::signersKeys() const {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
|
||||
@@ -73,3 +73,5 @@ private:
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -266,3 +266,5 @@ void TransactionHistoryImpl::refresh()
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -56,3 +56,6 @@ private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Monero;
|
||||
|
||||
|
||||
@@ -150,3 +150,5 @@ uint64_t TransactionInfoImpl::unlockTime() const
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Monero;
|
||||
|
||||
@@ -87,3 +87,5 @@ private:
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -316,3 +316,6 @@ uint64_t UnsignedTransactionImpl::minMixinCount() const
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
|
||||
@@ -71,3 +71,5 @@ private:
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -60,3 +60,5 @@ void onStartup()
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Monero {
|
||||
|
||||
namespace {
|
||||
// copy-pasted from simplewallet
|
||||
static const size_t DEFAULT_MIXIN = 21;
|
||||
static const int DEFAULT_REFRESH_INTERVAL_MILLIS = 1000 * 10;
|
||||
// limit maximum refresh interval as one minute
|
||||
static const int MAX_REFRESH_INTERVAL_MILLIS = 1000 * 60 * 1;
|
||||
@@ -1490,6 +1491,13 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
|
||||
cryptonote::address_parse_info info;
|
||||
|
||||
// indicates if dst_addr is integrated address (address + payment_id)
|
||||
// TODO: (https://bitcointalk.org/index.php?topic=753252.msg9985441#msg9985441)
|
||||
size_t fake_outs_count = mixin_count > 0 ? mixin_count : m_wallet->default_mixin();
|
||||
if (fake_outs_count == 0)
|
||||
fake_outs_count = DEFAULT_MIXIN;
|
||||
fake_outs_count = m_wallet->adjust_mixin(fake_outs_count);
|
||||
|
||||
uint32_t adjusted_priority = m_wallet->adjust_priority(static_cast<uint32_t>(priority));
|
||||
|
||||
PendingTransactionImpl * transaction = new PendingTransactionImpl(*this);
|
||||
@@ -1555,9 +1563,6 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
break;
|
||||
}
|
||||
try {
|
||||
size_t fake_outs_count = mixin_count > 0 ? mixin_count : m_wallet->default_mixin();
|
||||
fake_outs_count = m_wallet->adjust_mixin(mixin_count);
|
||||
|
||||
if (amount) {
|
||||
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
|
||||
adjusted_priority,
|
||||
@@ -2058,24 +2063,9 @@ bool WalletImpl::checkReserveProof(const std::string &address, const std::string
|
||||
}
|
||||
}
|
||||
|
||||
std::string WalletImpl::signMessage(const std::string &message, const std::string &address)
|
||||
std::string WalletImpl::signMessage(const std::string &message)
|
||||
{
|
||||
if (address.empty()) {
|
||||
return m_wallet->sign(message, tools::wallet2::sign_with_spend_key);
|
||||
}
|
||||
|
||||
cryptonote::address_parse_info info;
|
||||
if (!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), address)) {
|
||||
setStatusError(tr("Failed to parse address"));
|
||||
return "";
|
||||
}
|
||||
auto index = m_wallet->get_subaddress_index(info.address);
|
||||
if (!index) {
|
||||
setStatusError(tr("Address doesn't belong to the wallet"));
|
||||
return "";
|
||||
}
|
||||
|
||||
return m_wallet->sign(message, tools::wallet2::sign_with_spend_key, *index);
|
||||
return m_wallet->sign(message, tools::wallet2::sign_with_spend_key);
|
||||
}
|
||||
|
||||
bool WalletImpl::verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const
|
||||
@@ -2586,32 +2576,6 @@ void WalletImpl::deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex,
|
||||
|
||||
m_wallet->device_show_address(accountIndex, addressIndex, payment_id_param);
|
||||
}
|
||||
|
||||
bool WalletImpl::reconnectDevice()
|
||||
{
|
||||
clearStatus();
|
||||
|
||||
bool r;
|
||||
try {
|
||||
r = m_wallet->reconnect_device();
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
LOG_ERROR(__FUNCTION__ << " error: " << e.what());
|
||||
setStatusError(e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t WalletImpl::getBytesReceived()
|
||||
{
|
||||
return m_wallet->get_bytes_received();
|
||||
}
|
||||
|
||||
uint64_t WalletImpl::getBytesSent()
|
||||
{
|
||||
return m_wallet->get_bytes_sent();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override;
|
||||
virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const override;
|
||||
virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const override;
|
||||
virtual std::string signMessage(const std::string &message, const std::string &address) override;
|
||||
virtual std::string signMessage(const std::string &message) override;
|
||||
virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const override;
|
||||
virtual std::string signMultisigParticipant(const std::string &message) const override;
|
||||
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override;
|
||||
@@ -220,9 +220,6 @@ public:
|
||||
virtual bool isKeysFileLocked() override;
|
||||
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) override;
|
||||
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override;
|
||||
virtual bool reconnectDevice() override;
|
||||
virtual uint64_t getBytesReceived() override;
|
||||
virtual uint64_t getBytesSent() override;
|
||||
|
||||
private:
|
||||
void clearStatus() const;
|
||||
@@ -284,4 +281,7 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -993,7 +993,7 @@ struct Wallet
|
||||
* \param message - the message to sign (arbitrary byte data)
|
||||
* \return the signature
|
||||
*/
|
||||
virtual std::string signMessage(const std::string &message, const std::string &address = "") = 0;
|
||||
virtual std::string signMessage(const std::string &message) = 0;
|
||||
/*!
|
||||
* \brief verifySignedMessage - verify a signature matches a given message
|
||||
* \param message - the message (arbitrary byte data)
|
||||
@@ -1084,15 +1084,6 @@ struct Wallet
|
||||
|
||||
//! shows address on device display
|
||||
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0;
|
||||
|
||||
//! attempt to reconnect to hardware device
|
||||
virtual bool reconnectDevice() = 0;
|
||||
|
||||
//! get bytes received
|
||||
virtual uint64_t getBytesReceived() = 0;
|
||||
|
||||
//! get bytes sent
|
||||
virtual uint64_t getBytesSent() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1371,3 +1362,6 @@ struct WalletManagerFactory
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
|
||||
@@ -406,3 +406,5 @@ void WalletManagerFactory::setLogCategories(const std::string &categories)
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -102,3 +102,5 @@ private:
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Bitmonero = Wownero;
|
||||
|
||||
@@ -260,7 +260,7 @@ TEST(multiexp, scalarmult_triple)
|
||||
rct::key res;
|
||||
ge_p3 Gp3;
|
||||
|
||||
ASSERT_EQ(ge_frombytes_vartime(&Gp3, rct::G.bytes), 0);
|
||||
ge_frombytes_vartime(&Gp3, rct::G.bytes);
|
||||
|
||||
static const rct::key scalars[] = {
|
||||
rct::Z,
|
||||
|
||||
@@ -58,14 +58,14 @@ TEST(tx_proof, prove_verify_v2)
|
||||
// R_B = rB
|
||||
crypto::public_key R_B;
|
||||
ge_p3 B_p3;
|
||||
ASSERT_EQ(ge_frombytes_vartime(&B_p3,&B), 0);
|
||||
ge_frombytes_vartime(&B_p3,&B);
|
||||
ge_p2 R_B_p2;
|
||||
ge_scalarmult(&R_B_p2, &unwrap(r), &B_p3);
|
||||
ge_tobytes(&R_B, &R_B_p2);
|
||||
|
||||
// R_G = rG
|
||||
crypto::public_key R_G;
|
||||
ASSERT_EQ(ge_frombytes_vartime(&B_p3,&B), 0);
|
||||
ge_frombytes_vartime(&B_p3,&B);
|
||||
ge_p3 R_G_p3;
|
||||
ge_scalarmult_base(&R_G_p3, &unwrap(r));
|
||||
ge_p3_tobytes(&R_G, &R_G_p3);
|
||||
@@ -73,7 +73,7 @@ TEST(tx_proof, prove_verify_v2)
|
||||
// D = rA
|
||||
crypto::public_key D;
|
||||
ge_p3 A_p3;
|
||||
ASSERT_EQ(ge_frombytes_vartime(&A_p3,&A), 0);
|
||||
ge_frombytes_vartime(&A_p3,&A);
|
||||
ge_p2 D_p2;
|
||||
ge_scalarmult(&D_p2, &unwrap(r), &A_p3);
|
||||
ge_tobytes(&D, &D_p2);
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# Script gets votes for a block range.
|
||||
# Run: perl votes.pl 60 300
|
||||
|
||||
$IP='127.0.0.1:11181';
|
||||
|
||||
$begin=$ARGV[0];
|
||||
if ($#ARGV == 1 ) { $end=$ARGV[1]; }
|
||||
|
||||
open (F,">vote.txt");
|
||||
for ($i=$begin; $i<$end; $i++) {
|
||||
$k=qq(-d '{"params":{"height":$i},"jsonrpc":"2.0","id":"test","method":"get_block_header_by_height"}' -H 'Content-Type: application/json');
|
||||
$k=`curl -s -X POST http://$IP/json_rpc $k`;
|
||||
$k=~/"vote"\D+(\d+)/sg;
|
||||
$v=$1;
|
||||
print F "$v ";
|
||||
}
|
||||
close F;
|
||||
|
||||
$s = do{local(@ARGV,$/)="vote.txt";<>};
|
||||
$yes = "1";
|
||||
$count1 = () = $s =~ /\Q$yes/g;
|
||||
print "$count1 votes for yes\n";
|
||||
$no = "2";
|
||||
$count2 = () = $s =~ /\Q$no/g;
|
||||
print "$count2 votes for no\n";
|
||||
$abs = "0";
|
||||
$count0 = () = $s =~ /\Q$abs/g;
|
||||
print "$count0 abstained\n";
|
||||
|
||||
if ($count1 > $count2) {
|
||||
print "Computer says... Yes!\n";
|
||||
} else {
|
||||
print "Computer says... No!\n";
|
||||
}
|
||||
Reference in New Issue
Block a user