mirror of
https://codeberg.org/nahuhh/wownero
synced 2026-06-16 03:02:11 -04:00
Compare commits
78 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
beefa5e62e | ||
|
|
525cda3691 | ||
|
|
9eb34340f4 | ||
|
|
90efe7dee8 | ||
|
|
a9c03bb005 | ||
|
|
04dbdfcd98 | ||
|
|
1520d6a271 | ||
|
|
8e98e5b58a | ||
|
|
fa3856fedf | ||
|
|
47d7d0751e | ||
|
|
75981b8463 | ||
|
|
16c573a507 | ||
|
|
100eebe660 | ||
|
|
671c51d0b6 | ||
|
|
8d71405a59 | ||
|
|
1113f815e1 | ||
|
|
04a5d47e6c | ||
|
|
45f275e9e4 | ||
|
|
4f16bd2b95 | ||
|
|
6049797093 | ||
|
|
78ba621fa3 | ||
|
|
86b17e7dd1 | ||
|
|
eaa511440f | ||
|
|
03af4e871c | ||
|
|
51c8b36ba0 | ||
|
|
9cd125b345 | ||
|
|
707bfe86ad | ||
|
|
6f964b6cfb | ||
|
|
71a2c90fb8 | ||
|
|
9c437b403a | ||
|
|
a67efd0686 | ||
|
|
24948d4c2d | ||
|
|
bd2c97c923 | ||
|
|
974d8db176 | ||
|
|
70811c09c5 | ||
|
|
1196a9253b | ||
|
|
70f8f2386c | ||
|
|
840928cd6b | ||
|
|
9c18f2767b | ||
|
|
8a67724218 | ||
|
|
14a1b89122 | ||
|
|
4f08d52dfa | ||
|
|
0a9d218044 | ||
|
|
99aa45fd34 | ||
|
|
7c3629a5ee | ||
|
|
ce129599d0 | ||
|
|
48e59b8064 | ||
|
|
ad9956d987 | ||
|
|
f8abb225fc | ||
|
|
3366bd81eb | ||
|
|
1796b44c67 | ||
|
|
e028591336 | ||
|
|
282e2ef058 | ||
|
|
4e07c8cbbc | ||
|
|
b63442da21 | ||
|
|
ab0bb31518 | ||
|
|
f8f1c78984 | ||
|
|
e7615772fa | ||
|
|
c19f0cbdea | ||
|
|
41297c10f0 | ||
|
|
ab7df49331 | ||
|
|
4251cc0b4d | ||
|
|
67b97a5f16 | ||
|
|
7b6d959596 | ||
|
|
b8b054c0f1 | ||
|
|
8e0b8ddb96 | ||
|
|
e63c1107c0 | ||
|
|
1aa1850ba5 | ||
|
|
f174a8f05f | ||
|
|
6914d5b914 | ||
|
|
a24045340c | ||
|
|
cd8901cc01 | ||
|
|
5bf91fc894 | ||
|
|
5a2edea16b | ||
|
|
f6e2636493 | ||
|
|
71741a1ed6 | ||
|
|
254a1338ad | ||
|
|
8889f490ce |
11
Dockerfile
11
Dockerfile
@@ -116,8 +116,8 @@ RUN set -ex \
|
|||||||
&& make install
|
&& make install
|
||||||
|
|
||||||
# Udev
|
# Udev
|
||||||
ARG UDEV_VERSION=v3.2.8
|
ARG UDEV_VERSION=v3.2.10
|
||||||
ARG UDEV_HASH=d69f3f28348123ab7fa0ebac63ec2fd16800c5e0
|
ARG UDEV_HASH=be7068512c7512fa67c64fbff3472ab140c277c8
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& git clone https://github.com/gentoo/eudev -b ${UDEV_VERSION} \
|
&& git clone https://github.com/gentoo/eudev -b ${UDEV_VERSION} \
|
||||||
&& cd eudev \
|
&& cd eudev \
|
||||||
@@ -202,11 +202,10 @@ VOLUME /home/wownero/.wownero
|
|||||||
# wownero-wallet-cli
|
# wownero-wallet-cli
|
||||||
VOLUME /wallet
|
VOLUME /wallet
|
||||||
|
|
||||||
EXPOSE 38080
|
EXPOSE 34567
|
||||||
EXPOSE 38081
|
EXPOSE 34568
|
||||||
|
|
||||||
# switch to user wownero
|
# switch to user wownero
|
||||||
USER wownero
|
USER wownero
|
||||||
|
|
||||||
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"]
|
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"]
|
||||||
|
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -59,14 +59,18 @@ XMR: `44SQVPGLufPasUcuUQSZiF5c9BFzjcP8ucDxzzFDgLf1VkCEFaidJ3u2AhSKMhPLKA3jc2iS8w
|
|||||||
|
|
||||||
BTC: `bc1qcw9zglp3fxyl25zswemw7jczlqryms2lsmu464`
|
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
|
## Release staging and Contributing
|
||||||
|
|
||||||
**Anyone is welcome to contribute to Wownero's codebase!**
|
**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.
|
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.
|
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.
|
Join `#wownero-dev` on IRC OFTC to participate in development conversation.
|
||||||
@@ -87,7 +91,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
|
| 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
|
| - | 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
|
| 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,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
|
| 331,170 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.0.0 | 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
|
||||||
|
|
||||||
X's indicate that these details have not been determined as of commit date.
|
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,9 +714,8 @@ Logger::Logger(const std::string& id, const Configurations& configurations,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logger::Logger(const Logger& logger) {
|
Logger::Logger(const Logger& logger) {
|
||||||
base::utils::safeDelete(m_typedConfigurations);
|
|
||||||
m_id = logger.m_id;
|
m_id = logger.m_id;
|
||||||
m_typedConfigurations = logger.m_typedConfigurations;
|
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
|
||||||
m_parentApplicationName = logger.m_parentApplicationName;
|
m_parentApplicationName = logger.m_parentApplicationName;
|
||||||
m_isConfigured = logger.m_isConfigured;
|
m_isConfigured = logger.m_isConfigured;
|
||||||
m_configurations = logger.m_configurations;
|
m_configurations = logger.m_configurations;
|
||||||
@@ -728,7 +727,7 @@ Logger& Logger::operator=(const Logger& logger) {
|
|||||||
if (&logger != this) {
|
if (&logger != this) {
|
||||||
base::utils::safeDelete(m_typedConfigurations);
|
base::utils::safeDelete(m_typedConfigurations);
|
||||||
m_id = logger.m_id;
|
m_id = logger.m_id;
|
||||||
m_typedConfigurations = logger.m_typedConfigurations;
|
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
|
||||||
m_parentApplicationName = logger.m_parentApplicationName;
|
m_parentApplicationName = logger.m_parentApplicationName;
|
||||||
m_isConfigured = logger.m_isConfigured;
|
m_isConfigured = logger.m_isConfigured;
|
||||||
m_configurations = logger.m_configurations;
|
m_configurations = logger.m_configurations;
|
||||||
|
|||||||
@@ -216,15 +216,8 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const std::pair
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("Unsupported input type, removing key images and aborting transaction addition");
|
LOG_PRINT_L1("Unsupported input type, aborting transaction addition");
|
||||||
for (const txin_v& tx_input : tx.vin)
|
throw std::runtime_error("Unexpected input type, aborting");
|
||||||
{
|
|
||||||
if (tx_input.type() == typeid(txin_to_key))
|
|
||||||
{
|
|
||||||
remove_spent_key(boost::get<txin_to_key>(tx_input).k_image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1354,7 +1354,8 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
|
|||||||
|
|
||||||
m_folder = filename;
|
m_folder = filename;
|
||||||
|
|
||||||
check_mmap_support();
|
try { check_mmap_support(); }
|
||||||
|
catch(...) { MERROR("Failed to check for mmap support, proceeding"); }
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if ((mdb_flags & MDB_WRITEMAP) == 0) {
|
if ((mdb_flags & MDB_WRITEMAP) == 0) {
|
||||||
|
|||||||
54
src/blockchain_utilities/blockchain-stats-readme.md
Normal file
54
src/blockchain_utilities/blockchain-stats-readme.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# 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))
|
if (!parse_and_validate_block_from_blob(b.block, block))
|
||||||
{
|
{
|
||||||
MERROR("Failed to parse block: "
|
MERROR("Failed to parse block: "
|
||||||
<< epee::string_tools::pod_to_hex(get_blob_hash(b.block)));
|
<< epee::string_tools::buff_to_hex_nodelimer(b.block));
|
||||||
core.cleanup_handle_incoming_blocks();
|
core.cleanup_handle_incoming_blocks();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -177,8 +177,11 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
|
|||||||
core.handle_incoming_tx(tx_blob, tvc, relay_method::block, true);
|
core.handle_incoming_tx(tx_blob, tvc, relay_method::block, true);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
MERROR("transaction verification failed, tx_id = "
|
cryptonote::transaction transaction;
|
||||||
<< epee::string_tools::pod_to_hex(get_blob_hash(tx_blob.blob)));
|
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");
|
||||||
core.cleanup_handle_incoming_blocks();
|
core.cleanup_handle_incoming_blocks();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -192,8 +195,11 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
|
|||||||
|
|
||||||
if(bvc.m_verifivation_failed)
|
if(bvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
MERROR("Block verification failed, id = "
|
cryptonote::block block;
|
||||||
<< epee::string_tools::pod_to_hex(get_blob_hash(block_entry.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");
|
||||||
core.cleanup_handle_incoming_blocks();
|
core.cleanup_handle_incoming_blocks();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -219,6 +219,7 @@ namespace cryptonote
|
|||||||
ADD_CHECKPOINT2(307883, "9a8c35cd10963a14bba8a9628d1776df92fee5e3153b7249f5d15726efafaaea", "0x30b0965ba5a18");
|
ADD_CHECKPOINT2(307883, "9a8c35cd10963a14bba8a9628d1776df92fee5e3153b7249f5d15726efafaaea", "0x30b0965ba5a18");
|
||||||
ADD_CHECKPOINT2(312130, "e0da085bd273fff9f5f8e604fce0e91908bc62b6b004731a93e16e89cb9b1f54", "0x3cfe7148f2e18");
|
ADD_CHECKPOINT2(312130, "e0da085bd273fff9f5f8e604fce0e91908bc62b6b004731a93e16e89cb9b1f54", "0x3cfe7148f2e18");
|
||||||
ADD_CHECKPOINT2(324600, "b24cd1ed7c192bbcf3d5b15729f2b032566687f96bda6f8cb73a5b16df4c6e6b", "0x69caecbe78718");
|
ADD_CHECKPOINT2(324600, "b24cd1ed7c192bbcf3d5b15729f2b032566687f96bda6f8cb73a5b16df4c6e6b", "0x69caecbe78718");
|
||||||
|
ADD_CHECKPOINT2(327700, "f113c8cbe077aab9296ecbfb41780c147aeb54edfece7e4b9946b8abd0f06de7", "0x732431429c818");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -447,6 +447,7 @@ namespace cryptonote
|
|||||||
crypto::hash prev_id;
|
crypto::hash prev_id;
|
||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
crypto::signature signature;
|
crypto::signature signature;
|
||||||
|
uint16_t vote;
|
||||||
|
|
||||||
BEGIN_SERIALIZE()
|
BEGIN_SERIALIZE()
|
||||||
VARINT_FIELD(major_version)
|
VARINT_FIELD(major_version)
|
||||||
@@ -455,7 +456,10 @@ namespace cryptonote
|
|||||||
FIELD(prev_id)
|
FIELD(prev_id)
|
||||||
FIELD(nonce)
|
FIELD(nonce)
|
||||||
if (major_version >= BLOCK_HEADER_MINER_SIG)
|
if (major_version >= BLOCK_HEADER_MINER_SIG)
|
||||||
|
{
|
||||||
FIELD(signature)
|
FIELD(signature)
|
||||||
|
FIELD(vote)
|
||||||
|
}
|
||||||
END_SERIALIZE()
|
END_SERIALIZE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ namespace boost
|
|||||||
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
a & b.signature;
|
a & b.signature;
|
||||||
|
a & b.vote;
|
||||||
}
|
}
|
||||||
//------------------
|
//------------------
|
||||||
a & b.miner_tx;
|
a & b.miner_tx;
|
||||||
@@ -341,7 +342,7 @@ namespace boost
|
|||||||
if (x.rangeSigs.empty())
|
if (x.rangeSigs.empty())
|
||||||
{
|
{
|
||||||
a & x.bulletproofs;
|
a & x.bulletproofs;
|
||||||
if (ver >= 2)
|
if (ver >= 2u)
|
||||||
a & x.bulletproofs_plus;
|
a & x.bulletproofs_plus;
|
||||||
}
|
}
|
||||||
a & x.MGs;
|
a & x.MGs;
|
||||||
@@ -371,7 +372,7 @@ namespace boost
|
|||||||
if (x.p.rangeSigs.empty())
|
if (x.p.rangeSigs.empty())
|
||||||
{
|
{
|
||||||
a & x.p.bulletproofs;
|
a & x.p.bulletproofs;
|
||||||
if (ver >= 2)
|
if (ver >= 2u)
|
||||||
a & x.p.bulletproofs_plus;
|
a & x.p.bulletproofs_plus;
|
||||||
}
|
}
|
||||||
a & x.p.MGs;
|
a & x.p.MGs;
|
||||||
|
|||||||
@@ -181,7 +181,6 @@ namespace cryptonote
|
|||||||
|
|
||||||
if (!base_only)
|
if (!base_only)
|
||||||
{
|
{
|
||||||
const bool bulletproof = rct::is_rct_bulletproof(rv.type);
|
|
||||||
const bool bulletproof_plus = rct::is_rct_bulletproof_plus(rv.type);
|
const bool bulletproof_plus = rct::is_rct_bulletproof_plus(rv.type);
|
||||||
if (bulletproof_plus)
|
if (bulletproof_plus)
|
||||||
{
|
{
|
||||||
@@ -207,6 +206,7 @@ namespace cryptonote
|
|||||||
for (size_t i = 0; i < n_amounts; ++i)
|
for (size_t i = 0; i < n_amounts; ++i)
|
||||||
rv.p.bulletproofs_plus[0].V[i] = rv.outPk[i].mask;
|
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 (rct::is_rct_new_bulletproof(rv.type))
|
||||||
{
|
{
|
||||||
if (rv.p.bulletproofs.size() != 1)
|
if (rv.p.bulletproofs.size() != 1)
|
||||||
@@ -1324,13 +1324,22 @@ namespace cryptonote
|
|||||||
crypto::hash get_sig_data(const block& b)
|
crypto::hash get_sig_data(const block& b)
|
||||||
{
|
{
|
||||||
crypto::hash sig_data;
|
crypto::hash sig_data;
|
||||||
std::stringstream ss;
|
blobdata blob = get_block_hashing_blob_sig_data(b);
|
||||||
ss << (b.nonce + b.timestamp);
|
crypto::cn_fast_hash(blob.data(), blob.size(), sig_data);
|
||||||
std::string d(ss.str());
|
|
||||||
crypto::cn_fast_hash(d.data(), d.size(), sig_data);
|
|
||||||
return 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> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off)
|
||||||
{
|
{
|
||||||
std::vector<uint64_t> res = off;
|
std::vector<uint64_t> res = off;
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ namespace cryptonote
|
|||||||
bool get_block_hash(const block& b, crypto::hash& res);
|
bool get_block_hash(const block& b, crypto::hash& res);
|
||||||
crypto::hash get_block_hash(const block& b);
|
crypto::hash get_block_hash(const block& b);
|
||||||
crypto::hash get_sig_data(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, 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);
|
||||||
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, crypto::hash &block_hash);
|
||||||
|
|||||||
@@ -45,8 +45,6 @@
|
|||||||
#include "storages/portable_storage_template_helper.h"
|
#include "storages/portable_storage_template_helper.h"
|
||||||
#include "boost/logic/tribool.hpp"
|
#include "boost/logic/tribool.hpp"
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
@@ -103,6 +101,7 @@ 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_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<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_spendkey = {"spendkey", "Specify secret spend key used for mining", "", true};
|
||||||
|
const command_line::arg_descriptor<std::string> arg_vote = {"vote", "Vote for proposals.", "", true};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -296,6 +295,7 @@ namespace cryptonote
|
|||||||
command_line::add_arg(desc, arg_bg_mining_idle_threshold_percentage);
|
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_bg_mining_miner_target_percentage);
|
||||||
command_line::add_arg(desc, arg_spendkey);
|
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)
|
bool miner::init(const boost::program_options::variables_map& vm, network_type nettype)
|
||||||
@@ -311,6 +311,25 @@ namespace cryptonote
|
|||||||
m_spendkey = spendkey;
|
m_spendkey = spendkey;
|
||||||
m_viewkey = viewkey;
|
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))
|
if(command_line::has_arg(vm, arg_extra_messages))
|
||||||
{
|
{
|
||||||
std::string buff;
|
std::string buff;
|
||||||
@@ -608,6 +627,7 @@ namespace cryptonote
|
|||||||
crypto::generate_signature(sig_data, eph_pub_key, eph_secret_key, signature);
|
crypto::generate_signature(sig_data, eph_pub_key, eph_secret_key, signature);
|
||||||
// amend signature to block header before PoW hashing
|
// amend signature to block header before PoW hashing
|
||||||
b.signature = signature;
|
b.signature = signature;
|
||||||
|
b.vote = m_int_vote;
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto::hash h;
|
crypto::hash h;
|
||||||
@@ -645,6 +665,14 @@ namespace cryptonote
|
|||||||
" //@@@@@@@@@@@@@@@@@// \n"
|
" //@@@@@@@@@@@@@@@@@// \n"
|
||||||
<< ENDL);
|
<< ENDL);
|
||||||
MGINFO_GREEN("Awesome, you won a block reward!\n" << get_block_hash(b) << " at height " << height);
|
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;
|
cryptonote::block_verification_context bvc;
|
||||||
if(!m_phandler->handle_block_found(b, bvc) || !bvc.m_added_to_main_chain)
|
if(!m_phandler->handle_block_found(b, bvc) || !bvc.m_added_to_main_chain)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ namespace cryptonote
|
|||||||
account_public_address m_mine_address;
|
account_public_address m_mine_address;
|
||||||
crypto::secret_key m_spendkey;
|
crypto::secret_key m_spendkey;
|
||||||
crypto::secret_key m_viewkey;
|
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<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<2> m_update_merge_hr_interval;
|
||||||
epee::math_helper::once_a_time_seconds<1> m_autodetect_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_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_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N
|
||||||
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
|
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
|
||||||
#define DIFFICULTY_RESET_HEIGHT 331571 // ~July 4, 2021 Pool Independence Day
|
#define DIFFICULTY_RESET_HEIGHT 331170// ~July 4, 2021 Pool Independence Day
|
||||||
#define DIFFICULTY_RESET_LEVEL 100000000 // 100 mill
|
#define DIFFICULTY_RESET_LEVEL 100000000 // 100 mill
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/range/adaptor/reversed.hpp>
|
#include <boost/range/adaptor/reversed.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "include_base_utils.h"
|
#include "include_base_utils.h"
|
||||||
#include "cryptonote_basic/cryptonote_basic_impl.h"
|
#include "cryptonote_basic/cryptonote_basic_impl.h"
|
||||||
@@ -1397,6 +1395,11 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
|||||||
MWARNING("Wrong txout type");
|
MWARNING("Wrong txout type");
|
||||||
return false;
|
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
|
// keccak hash block header data and check miner signature
|
||||||
// if signature is invalid, reject block
|
// if signature is invalid, reject block
|
||||||
crypto::hash sig_data = get_sig_data(b);
|
crypto::hash sig_data = get_sig_data(b);
|
||||||
@@ -1408,6 +1411,7 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
LOG_PRINT_L1("Miner signature is good");
|
LOG_PRINT_L1("Miner signature is good");
|
||||||
|
LOG_PRINT_L1("Vote: " << b.vote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1824,8 +1828,7 @@ 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
|
//make blocks coin-base tx looks close to real coinbase tx to get truthful blob weight
|
||||||
uint8_t hf_version = b.major_version;
|
uint8_t hf_version = b.major_version;
|
||||||
size_t max_outs = hf_version >= 4 ? 1 : 11;
|
size_t max_outs = hf_version >= 4 ? 1 : 11;
|
||||||
keypair txkey = keypair::generate(hw::get_device("default"));
|
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);
|
||||||
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");
|
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);
|
size_t cumulative_weight = txs_weight + get_transaction_weight(b.miner_tx);
|
||||||
#if defined(DEBUG_CREATE_BLOCK_TEMPLATE)
|
#if defined(DEBUG_CREATE_BLOCK_TEMPLATE)
|
||||||
@@ -1834,7 +1837,8 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
|
|||||||
#endif
|
#endif
|
||||||
for (size_t try_count = 0; try_count != 10; ++try_count)
|
for (size_t try_count = 0; try_count != 10; ++try_count)
|
||||||
{
|
{
|
||||||
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);
|
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);
|
||||||
|
|
||||||
CHECK_AND_ASSERT_MES(r, false, "Failed to construct miner tx, second chance");
|
CHECK_AND_ASSERT_MES(r, false, "Failed to construct miner tx, second chance");
|
||||||
size_t coinbase_weight = get_transaction_weight(b.miner_tx);
|
size_t coinbase_weight = get_transaction_weight(b.miner_tx);
|
||||||
if (coinbase_weight > cumulative_weight - txs_weight)
|
if (coinbase_weight > cumulative_weight - txs_weight)
|
||||||
@@ -2720,7 +2724,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>
|
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) const
|
bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs, bool pruned) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
@@ -2731,10 +2735,12 @@ bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
cryptonote::blobdata tx;
|
cryptonote::blobdata tx;
|
||||||
if (m_db->get_tx_blob(tx_hash, tx))
|
bool res = pruned ? m_db->get_pruned_tx_blob(tx_hash, tx) : m_db->get_tx_blob(tx_hash, tx);
|
||||||
|
if (res)
|
||||||
{
|
{
|
||||||
txs.push_back(transaction());
|
txs.push_back(transaction());
|
||||||
if (!parse_and_validate_tx_from_blob(tx, txs.back()))
|
res = pruned ? parse_and_validate_tx_base_from_blob(tx, txs.back()) : parse_and_validate_tx_from_blob(tx, txs.back());
|
||||||
|
if (!res)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid transaction");
|
LOG_ERROR("Invalid transaction");
|
||||||
return false;
|
return false;
|
||||||
@@ -5519,7 +5525,7 @@ void Blockchain::cancel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PER_BLOCK_CHECKPOINT)
|
#if defined(PER_BLOCK_CHECKPOINT)
|
||||||
static const char expected_block_hashes_hash[] = "bf90cee947a6becbcdcbaa3aabf7055b1eabc2305739961d984615a7ccf357f7";
|
static const char expected_block_hashes_hash[] = "6dd0d016366b906ed9e493f721d3b3f60c0db628774206424651b6e8f2a76a95";
|
||||||
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
|
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
|
||||||
{
|
{
|
||||||
if (get_checkpoints == nullptr || !m_fast_sync)
|
if (get_checkpoints == nullptr || !m_fast_sync)
|
||||||
@@ -5677,6 +5683,6 @@ void Blockchain::cache_block_template(const block &b, const cryptonote::account_
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace cryptonote {
|
namespace cryptonote {
|
||||||
template bool Blockchain::get_transactions(const std::vector<crypto::hash>&, std::vector<transaction>&, std::vector<crypto::hash>&) const;
|
template bool Blockchain::get_transactions(const std::vector<crypto::hash>&, std::vector<transaction>&, std::vector<crypto::hash>&, bool) 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;
|
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>
|
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;
|
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>
|
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) const;
|
bool get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs, bool pruned = false) const;
|
||||||
|
|
||||||
//debug functions
|
//debug functions
|
||||||
|
|
||||||
|
|||||||
@@ -429,9 +429,9 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs) const
|
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
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_transactions_blobs(txs_ids, txs, missed_txs);
|
return m_blockchain_storage.get_transactions_blobs(txs_ids, txs, missed_txs, pruned);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
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
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs) const
|
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs, bool pruned) const
|
||||||
{
|
{
|
||||||
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs);
|
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs, pruned);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::get_alternative_blocks(std::vector<block>& blocks) const
|
bool core::get_alternative_blocks(std::vector<block>& blocks) const
|
||||||
@@ -1304,7 +1304,7 @@ namespace cryptonote
|
|||||||
std::vector<transaction> txs;
|
std::vector<transaction> txs;
|
||||||
std::vector<crypto::hash> missed_txs;
|
std::vector<crypto::hash> missed_txs;
|
||||||
uint64_t coinbase_amount = get_outs_money_amount(b.miner_tx);
|
uint64_t coinbase_amount = get_outs_money_amount(b.miner_tx);
|
||||||
this->get_transactions(b.tx_hashes, txs, missed_txs);
|
this->get_transactions(b.tx_hashes, txs, missed_txs, true);
|
||||||
uint64_t tx_fee_amount = 0;
|
uint64_t tx_fee_amount = 0;
|
||||||
for(const auto& tx: txs)
|
for(const auto& tx: txs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ namespace cryptonote
|
|||||||
*
|
*
|
||||||
* @note see Blockchain::get_transactions
|
* @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) const;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc Blockchain::get_transactions
|
* @copydoc Blockchain::get_transactions
|
||||||
@@ -399,7 +399,7 @@ namespace cryptonote
|
|||||||
*
|
*
|
||||||
* @note see Blockchain::get_transactions
|
* @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) const;
|
bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc Blockchain::get_block_by_hash
|
* @copydoc Blockchain::get_block_by_hash
|
||||||
|
|||||||
@@ -76,11 +76,12 @@ namespace cryptonote
|
|||||||
LOG_PRINT_L2("destinations include " << num_stdaddresses << " standard addresses and " << num_subaddresses << " subaddresses");
|
LOG_PRINT_L2("destinations include " << num_stdaddresses << " standard addresses and " << num_subaddresses << " subaddresses");
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
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) {
|
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) {
|
||||||
tx.vin.clear();
|
tx.vin.clear();
|
||||||
tx.vout.clear();
|
tx.vout.clear();
|
||||||
tx.extra.clear();
|
tx.extra.clear();
|
||||||
|
|
||||||
|
keypair txkey = keypair::generate(hw::get_device("default"));
|
||||||
add_tx_pub_key_to_extra(tx, txkey.pub);
|
add_tx_pub_key_to_extra(tx, txkey.pub);
|
||||||
if(!extra_nonce.empty())
|
if(!extra_nonce.empty())
|
||||||
if(!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce))
|
if(!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce))
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
class Blockchain;
|
class Blockchain;
|
||||||
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);
|
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);
|
||||||
|
|
||||||
struct tx_source_entry
|
struct tx_source_entry
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ namespace {
|
|||||||
void print_block_header(cryptonote::block_header_response const & header)
|
void print_block_header(cryptonote::block_header_response const & header)
|
||||||
{
|
{
|
||||||
tools::success_msg_writer()
|
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
|
<< "timestamp: " << boost::lexical_cast<std::string>(header.timestamp) << " (" << tools::get_human_readable_timestamp(header.timestamp) << ")" << std::endl
|
||||||
<< "previous hash: " << header.prev_hash << std::endl
|
<< "previous hash: " << header.prev_hash << std::endl
|
||||||
<< "nonce: " << boost::lexical_cast<std::string>(header.nonce) << std::endl
|
<< "nonce: " << boost::lexical_cast<std::string>(header.nonce) << std::endl
|
||||||
|
|||||||
@@ -573,8 +573,13 @@ namespace trezor{
|
|||||||
std::string req = "PINGPING";
|
std::string req = "PINGPING";
|
||||||
char res[8];
|
char res[8];
|
||||||
|
|
||||||
m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
|
const auto written = m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
|
||||||
receive(res, 8, nullptr, false, timeout);
|
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;
|
||||||
|
|
||||||
return memcmp(res, "PONGPONG", 8) == 0;
|
return memcmp(res, "PONGPONG", 8) == 0;
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ const hardfork_t mainnet_hard_forks[] = {
|
|||||||
{ 15, 160777, 0, 1573280497 },
|
{ 15, 160777, 0, 1573280497 },
|
||||||
{ 16, 253999, 0, 1600576508 },
|
{ 16, 253999, 0, 1600576508 },
|
||||||
{ 17, 254287, 0, 1600576524 },
|
{ 17, 254287, 0, 1600576524 },
|
||||||
{ 18, 331337, 0, 1623245591 },
|
{ 18, 331170, 0, 1623245591 },
|
||||||
{ 19, 331625, 0, 1623693101 },
|
{ 19, 331458, 0, 1624793373 },
|
||||||
};
|
};
|
||||||
const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]);
|
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)
|
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");
|
CHECK_AND_ASSERT_THROW_MES(amounts.size() == sk.size(), "Invalid amounts/sk sizes");
|
||||||
masks.resize(amounts.size());
|
masks.resize(amounts.size());
|
||||||
for (size_t i = 0; i < masks.size(); ++i)
|
for (size_t i = 0; i < masks.size(); ++i)
|
||||||
masks[i] = hwdev.genCommitmentMask(sk[i]);
|
masks[i] = hwdev.genCommitmentMask(sk[i]);
|
||||||
BulletproofPlus proof = bulletproof_plus_PROVE(amounts, masks);
|
BulletproofPlus proof = bulletproof_plus_PROVE(amounts, masks);
|
||||||
CHECK_AND_ASSERT_THROW_MES(proof.V.size() == amounts.size(), "V does not have the expected size");
|
CHECK_AND_ASSERT_THROW_MES(proof.V.size() == amounts.size(), "V does not have the expected size");
|
||||||
C = proof.V;
|
C = proof.V;
|
||||||
return proof;
|
return proof;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verBulletproofPlus(const BulletproofPlus &proof)
|
bool verBulletproofPlus(const BulletproofPlus &proof)
|
||||||
@@ -1705,16 +1705,6 @@ namespace rct {
|
|||||||
offset += rv.p.rangeSigs.size();
|
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 (!bpp_proofs.empty() && !verBulletproofPlus(bpp_proofs))
|
||||||
{
|
{
|
||||||
if (!waiter.wait())
|
if (!waiter.wait())
|
||||||
@@ -1727,8 +1717,7 @@ namespace rct {
|
|||||||
LOG_PRINT_L1("Aggregate range proof verified failed");
|
LOG_PRINT_L1("Aggregate range proof verified failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!waiter.wait())
|
if (!waiter.wait())
|
||||||
return false;
|
return false;
|
||||||
for (size_t i = 0; i < results.size(); ++i) {
|
for (size_t i = 0; i < results.size(); ++i) {
|
||||||
@@ -1863,8 +1852,7 @@ namespace rct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
xmr_amount decodeRctSimple(const rctSig & rv, const key & sk, unsigned int i, key &mask, hw::device &hwdev) {
|
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,
|
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");
|
||||||
false, "decodeRct called on non simple rctSig");
|
|
||||||
CHECK_AND_ASSERT_THROW_MES(i < rv.ecdhInfo.size(), "Bad index");
|
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");
|
CHECK_AND_ASSERT_THROW_MES(rv.outPk.size() == rv.ecdhInfo.size(), "Mismatched sizes of rv.outPk and rv.ecdhInfo");
|
||||||
|
|
||||||
|
|||||||
@@ -422,18 +422,20 @@ namespace rct {
|
|||||||
return ar.good();
|
return ar.good();
|
||||||
if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeFullBulletproof && type != RCTTypeSimpleBulletproof && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus)
|
if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeFullBulletproof && type != RCTTypeSimpleBulletproof && type != RCTTypeCLSAG && type != RCTTypeBulletproofPlus)
|
||||||
return false;
|
return false;
|
||||||
if (type == RCTTypeSimpleBulletproof || type == RCTTypeFullBulletproof) {
|
if (type == RCTTypeSimpleBulletproof || type == RCTTypeFullBulletproof)
|
||||||
ar.tag("bp");
|
{
|
||||||
ar.begin_array();
|
ar.tag("bp");
|
||||||
PREPARE_CUSTOM_VECTOR_SERIALIZATION(outputs, bulletproofs);
|
ar.begin_array();
|
||||||
if (bulletproofs.size() != outputs)
|
PREPARE_CUSTOM_VECTOR_SERIALIZATION(outputs, bulletproofs);
|
||||||
return false;
|
if (bulletproofs.size() != outputs)
|
||||||
for (size_t i = 0; i < outputs; ++i) {
|
return false;
|
||||||
FIELDS(bulletproofs[i])
|
for (size_t i = 0; i < outputs; ++i)
|
||||||
if (outputs - i > 1)
|
{
|
||||||
ar.delimit_array();
|
FIELDS(bulletproofs[i])
|
||||||
}
|
if (outputs - i > 1)
|
||||||
ar.end_array();
|
ar.delimit_array();
|
||||||
|
}
|
||||||
|
ar.end_array();
|
||||||
}
|
}
|
||||||
else if (type == RCTTypeBulletproofPlus)
|
else if (type == RCTTypeBulletproofPlus)
|
||||||
{
|
{
|
||||||
@@ -452,6 +454,7 @@ namespace rct {
|
|||||||
}
|
}
|
||||||
if (n_bulletproof_plus_max_amounts(bulletproofs_plus) < outputs)
|
if (n_bulletproof_plus_max_amounts(bulletproofs_plus) < outputs)
|
||||||
return false;
|
return false;
|
||||||
|
ar.end_array();
|
||||||
}
|
}
|
||||||
else if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG)
|
else if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG)
|
||||||
{
|
{
|
||||||
@@ -614,12 +617,12 @@ namespace rct {
|
|||||||
|
|
||||||
keyV& get_pseudo_outs()
|
keyV& get_pseudo_outs()
|
||||||
{
|
{
|
||||||
return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeSimpleBulletproof || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
return type == RCTTypeBulletproof || type == RCTTypeSimpleBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyV const& get_pseudo_outs() const
|
keyV const& get_pseudo_outs() const
|
||||||
{
|
{
|
||||||
return type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeSimpleBulletproof || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
return type == RCTTypeBulletproof || type == RCTTypeSimpleBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus ? p.pseudoOuts : pseudoOuts;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_SERIALIZE_OBJECT()
|
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))
|
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);
|
LOG_PRINT_L0(res.status);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1859,6 +1859,7 @@ namespace cryptonote
|
|||||||
res.blocktemplate_blob = string_tools::buff_to_hex_nodelimer(block_blob);
|
res.blocktemplate_blob = string_tools::buff_to_hex_nodelimer(block_blob);
|
||||||
res.blockhashing_blob = string_tools::buff_to_hex_nodelimer(hashing_blob);
|
res.blockhashing_blob = string_tools::buff_to_hex_nodelimer(hashing_blob);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
|
res.vote = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -2090,6 +2091,7 @@ namespace cryptonote
|
|||||||
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
b.signature = {};
|
b.signature = {};
|
||||||
|
b.vote = 0;
|
||||||
}
|
}
|
||||||
crypto::hash seed_hash = crypto::null_hash;
|
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))
|
if (b.major_version >= RX_BLOCK_VERSION && !epee::string_tools::hex_to_pod(template_res.seed_hash, seed_hash))
|
||||||
@@ -2129,6 +2131,7 @@ 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)
|
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);
|
PERF_TIMER(fill_block_header_response);
|
||||||
|
response.vote = blk.vote;
|
||||||
response.major_version = blk.major_version;
|
response.major_version = blk.major_version;
|
||||||
response.minor_version = blk.minor_version;
|
response.minor_version = blk.minor_version;
|
||||||
response.timestamp = blk.timestamp;
|
response.timestamp = blk.timestamp;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace cryptonote
|
|||||||
// advance which version they will stop working with
|
// advance which version they will stop working with
|
||||||
// Don't go over 32767 for any of these
|
// Don't go over 32767 for any of these
|
||||||
#define CORE_RPC_VERSION_MAJOR 3
|
#define CORE_RPC_VERSION_MAJOR 3
|
||||||
#define CORE_RPC_VERSION_MINOR 7
|
#define CORE_RPC_VERSION_MINOR 8
|
||||||
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
|
#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)
|
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
|
||||||
|
|
||||||
@@ -921,6 +921,7 @@ namespace cryptonote
|
|||||||
blobdata blocktemplate_blob;
|
blobdata blocktemplate_blob;
|
||||||
blobdata blockhashing_blob;
|
blobdata blockhashing_blob;
|
||||||
uint64_t unlock_height;
|
uint64_t unlock_height;
|
||||||
|
uint16_t vote;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE_PARENT(rpc_response_base)
|
KV_SERIALIZE_PARENT(rpc_response_base)
|
||||||
@@ -937,6 +938,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(seed_hash)
|
KV_SERIALIZE(seed_hash)
|
||||||
KV_SERIALIZE(next_seed_hash)
|
KV_SERIALIZE(next_seed_hash)
|
||||||
KV_SERIALIZE(unlock_height)
|
KV_SERIALIZE(unlock_height)
|
||||||
|
KV_SERIALIZE(vote)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
typedef epee::misc_utils::struct_init<response_t> response;
|
typedef epee::misc_utils::struct_init<response_t> response;
|
||||||
@@ -1058,6 +1060,7 @@ namespace cryptonote
|
|||||||
std::string pow_hash;
|
std::string pow_hash;
|
||||||
uint64_t long_term_weight;
|
uint64_t long_term_weight;
|
||||||
std::string miner_tx_hash;
|
std::string miner_tx_hash;
|
||||||
|
uint16_t vote;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(major_version)
|
KV_SERIALIZE(major_version)
|
||||||
@@ -1082,6 +1085,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(pow_hash)
|
KV_SERIALIZE(pow_hash)
|
||||||
KV_SERIALIZE_OPT(long_term_weight, (uint64_t)0)
|
KV_SERIALIZE_OPT(long_term_weight, (uint64_t)0)
|
||||||
KV_SERIALIZE(miner_tx_hash)
|
KV_SERIALIZE(miner_tx_hash)
|
||||||
|
KV_SERIALIZE(vote)
|
||||||
END_KV_SERIALIZE_MAP()
|
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))
|
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);
|
LOG_PRINT_L0(res.error_details);
|
||||||
res.status = Message::STATUS_FAILED;
|
res.status = Message::STATUS_FAILED;
|
||||||
return;
|
return;
|
||||||
@@ -898,6 +898,7 @@ namespace rpc
|
|||||||
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
|
||||||
{
|
{
|
||||||
header.signature = b.signature;
|
header.signature = b.signature;
|
||||||
|
header.vote = b.vote;
|
||||||
}
|
}
|
||||||
header.prev_id = b.prev_id;
|
header.prev_id = b.prev_id;
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ namespace rpc
|
|||||||
crypto::hash prev_id;
|
crypto::hash prev_id;
|
||||||
uint32_t nonce;
|
uint32_t nonce;
|
||||||
crypto::signature signature;
|
crypto::signature signature;
|
||||||
|
uint16_t vote;
|
||||||
uint64_t height;
|
uint64_t height;
|
||||||
uint64_t depth;
|
uint64_t depth;
|
||||||
crypto::hash hash;
|
crypto::hash hash;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace rpc
|
|||||||
bool is_version_string_valid(const std::string& str)
|
bool is_version_string_valid(const std::string& str)
|
||||||
{
|
{
|
||||||
return std::regex_match(str, std::regex(
|
return std::regex_match(str, std::regex(
|
||||||
"^.*$",
|
"^\\d{1,2}(\\.\\d{1,2}){3}(-(release|[0-9a-f]{9}))?$",
|
||||||
std::regex_constants::nosubs
|
std::regex_constants::nosubs
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,6 +313,7 @@ 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, prev_id, b.prev_id);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, nonce, b.nonce);
|
INSERT_INTO_JSON_OBJECT(dest, nonce, b.nonce);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, signature, b.signature);
|
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, miner_tx, b.miner_tx);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, tx_hashes, b.tx_hashes);
|
INSERT_INTO_JSON_OBJECT(dest, tx_hashes, b.tx_hashes);
|
||||||
|
|
||||||
@@ -333,6 +334,7 @@ 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.prev_id, prev_id);
|
||||||
GET_FROM_JSON_OBJECT(val, b.nonce, nonce);
|
GET_FROM_JSON_OBJECT(val, b.nonce, nonce);
|
||||||
GET_FROM_JSON_OBJECT(val, b.signature, signature);
|
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.miner_tx, miner_tx);
|
||||||
GET_FROM_JSON_OBJECT(val, b.tx_hashes, tx_hashes);
|
GET_FROM_JSON_OBJECT(val, b.tx_hashes, tx_hashes);
|
||||||
}
|
}
|
||||||
@@ -1048,6 +1050,7 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::r
|
|||||||
{
|
{
|
||||||
dest.StartObject();
|
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, major_version, response.major_version);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, minor_version, response.minor_version);
|
INSERT_INTO_JSON_OBJECT(dest, minor_version, response.minor_version);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, timestamp, response.timestamp);
|
INSERT_INTO_JSON_OBJECT(dest, timestamp, response.timestamp);
|
||||||
@@ -1069,6 +1072,7 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::rpc::BlockHeaderResp
|
|||||||
throw WRONG_TYPE("json object");
|
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.major_version, major_version);
|
||||||
GET_FROM_JSON_OBJECT(val, response.minor_version, minor_version);
|
GET_FROM_JSON_OBJECT(val, response.minor_version, minor_version);
|
||||||
GET_FROM_JSON_OBJECT(val, response.timestamp, timestamp);
|
GET_FROM_JSON_OBJECT(val, response.timestamp, timestamp);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||||
#define DEF_MONERO_VERSION "10.0.0"
|
#define DEF_MONERO_VERSION "0.10.0.0"
|
||||||
#define DEF_MONERO_RELEASE_NAME "Junkie Jeff"
|
#define DEF_MONERO_RELEASE_NAME "Junkie Jeff"
|
||||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||||
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
|
#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];
|
tools::wallet2::address_book_row entry = ab[index];
|
||||||
entry.m_description = description;
|
entry.m_description = description;
|
||||||
bool r = m_wallet->m_wallet->set_address_book_row(index, entry.m_address, NULL, entry.m_description, entry.m_is_subaddress);
|
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);
|
||||||
if (r)
|
if (r)
|
||||||
refresh();
|
refresh();
|
||||||
else
|
else
|
||||||
@@ -166,5 +166,3 @@ AddressBookImpl::~AddressBookImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -66,6 +66,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|
||||||
|
|||||||
@@ -264,6 +264,3 @@ std::vector<std::string> PendingTransactionImpl::signersKeys() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,5 +73,3 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -266,5 +266,3 @@ void TransactionHistoryImpl::refresh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -56,6 +56,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
|
||||||
|
|
||||||
|
|||||||
@@ -150,5 +150,3 @@ uint64_t TransactionInfoImpl::unlockTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
|
||||||
|
|||||||
@@ -87,5 +87,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -316,6 +316,3 @@ uint64_t UnsignedTransactionImpl::minMixinCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,5 +71,3 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -60,5 +60,3 @@ void onStartup()
|
|||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ namespace Monero {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// copy-pasted from simplewallet
|
// copy-pasted from simplewallet
|
||||||
static const size_t DEFAULT_MIXIN = 21;
|
|
||||||
static const int DEFAULT_REFRESH_INTERVAL_MILLIS = 1000 * 10;
|
static const int DEFAULT_REFRESH_INTERVAL_MILLIS = 1000 * 10;
|
||||||
// limit maximum refresh interval as one minute
|
// limit maximum refresh interval as one minute
|
||||||
static const int MAX_REFRESH_INTERVAL_MILLIS = 1000 * 60 * 1;
|
static const int MAX_REFRESH_INTERVAL_MILLIS = 1000 * 60 * 1;
|
||||||
@@ -1491,13 +1490,6 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
|||||||
|
|
||||||
cryptonote::address_parse_info info;
|
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));
|
uint32_t adjusted_priority = m_wallet->adjust_priority(static_cast<uint32_t>(priority));
|
||||||
|
|
||||||
PendingTransactionImpl * transaction = new PendingTransactionImpl(*this);
|
PendingTransactionImpl * transaction = new PendingTransactionImpl(*this);
|
||||||
@@ -1563,6 +1555,9 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
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) {
|
if (amount) {
|
||||||
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
|
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
|
||||||
adjusted_priority,
|
adjusted_priority,
|
||||||
@@ -2063,9 +2058,24 @@ bool WalletImpl::checkReserveProof(const std::string &address, const std::string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WalletImpl::signMessage(const std::string &message)
|
std::string WalletImpl::signMessage(const std::string &message, const std::string &address)
|
||||||
{
|
{
|
||||||
return m_wallet->sign(message, tools::wallet2::sign_with_spend_key);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletImpl::verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const
|
bool WalletImpl::verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const
|
||||||
@@ -2576,6 +2586,32 @@ void WalletImpl::deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex,
|
|||||||
|
|
||||||
m_wallet->device_show_address(accountIndex, addressIndex, payment_id_param);
|
m_wallet->device_show_address(accountIndex, addressIndex, payment_id_param);
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
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
|
||||||
|
|||||||
@@ -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 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 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 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) override;
|
virtual std::string signMessage(const std::string &message, const std::string &address) override;
|
||||||
virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const 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 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;
|
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override;
|
||||||
@@ -220,6 +220,9 @@ public:
|
|||||||
virtual bool isKeysFileLocked() override;
|
virtual bool isKeysFileLocked() override;
|
||||||
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) 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 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:
|
private:
|
||||||
void clearStatus() const;
|
void clearStatus() const;
|
||||||
@@ -281,7 +284,4 @@ private:
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -993,7 +993,7 @@ struct Wallet
|
|||||||
* \param message - the message to sign (arbitrary byte data)
|
* \param message - the message to sign (arbitrary byte data)
|
||||||
* \return the signature
|
* \return the signature
|
||||||
*/
|
*/
|
||||||
virtual std::string signMessage(const std::string &message) = 0;
|
virtual std::string signMessage(const std::string &message, const std::string &address = "") = 0;
|
||||||
/*!
|
/*!
|
||||||
* \brief verifySignedMessage - verify a signature matches a given message
|
* \brief verifySignedMessage - verify a signature matches a given message
|
||||||
* \param message - the message (arbitrary byte data)
|
* \param message - the message (arbitrary byte data)
|
||||||
@@ -1084,6 +1084,15 @@ struct Wallet
|
|||||||
|
|
||||||
//! shows address on device display
|
//! shows address on device display
|
||||||
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1362,6 +1371,3 @@ struct WalletManagerFactory
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|
||||||
|
|||||||
@@ -406,5 +406,3 @@ void WalletManagerFactory::setLogCategories(const std::string &categories)
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -102,5 +102,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace Bitmonero = Wownero;
|
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ TEST(multiexp, scalarmult_triple)
|
|||||||
rct::key res;
|
rct::key res;
|
||||||
ge_p3 Gp3;
|
ge_p3 Gp3;
|
||||||
|
|
||||||
ge_frombytes_vartime(&Gp3, rct::G.bytes);
|
ASSERT_EQ(ge_frombytes_vartime(&Gp3, rct::G.bytes), 0);
|
||||||
|
|
||||||
static const rct::key scalars[] = {
|
static const rct::key scalars[] = {
|
||||||
rct::Z,
|
rct::Z,
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ TEST(tx_proof, prove_verify_v2)
|
|||||||
// R_B = rB
|
// R_B = rB
|
||||||
crypto::public_key R_B;
|
crypto::public_key R_B;
|
||||||
ge_p3 B_p3;
|
ge_p3 B_p3;
|
||||||
ge_frombytes_vartime(&B_p3,&B);
|
ASSERT_EQ(ge_frombytes_vartime(&B_p3,&B), 0);
|
||||||
ge_p2 R_B_p2;
|
ge_p2 R_B_p2;
|
||||||
ge_scalarmult(&R_B_p2, &unwrap(r), &B_p3);
|
ge_scalarmult(&R_B_p2, &unwrap(r), &B_p3);
|
||||||
ge_tobytes(&R_B, &R_B_p2);
|
ge_tobytes(&R_B, &R_B_p2);
|
||||||
|
|
||||||
// R_G = rG
|
// R_G = rG
|
||||||
crypto::public_key R_G;
|
crypto::public_key R_G;
|
||||||
ge_frombytes_vartime(&B_p3,&B);
|
ASSERT_EQ(ge_frombytes_vartime(&B_p3,&B), 0);
|
||||||
ge_p3 R_G_p3;
|
ge_p3 R_G_p3;
|
||||||
ge_scalarmult_base(&R_G_p3, &unwrap(r));
|
ge_scalarmult_base(&R_G_p3, &unwrap(r));
|
||||||
ge_p3_tobytes(&R_G, &R_G_p3);
|
ge_p3_tobytes(&R_G, &R_G_p3);
|
||||||
@@ -73,7 +73,7 @@ TEST(tx_proof, prove_verify_v2)
|
|||||||
// D = rA
|
// D = rA
|
||||||
crypto::public_key D;
|
crypto::public_key D;
|
||||||
ge_p3 A_p3;
|
ge_p3 A_p3;
|
||||||
ge_frombytes_vartime(&A_p3,&A);
|
ASSERT_EQ(ge_frombytes_vartime(&A_p3,&A), 0);
|
||||||
ge_p2 D_p2;
|
ge_p2 D_p2;
|
||||||
ge_scalarmult(&D_p2, &unwrap(r), &A_p3);
|
ge_scalarmult(&D_p2, &unwrap(r), &A_p3);
|
||||||
ge_tobytes(&D, &D_p2);
|
ge_tobytes(&D, &D_p2);
|
||||||
|
|||||||
34
utils/votes.pl
Normal file
34
utils/votes.pl
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# 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