Compare commits

..

78 Commits
10.0.0 ... v10

Author SHA1 Message Date
wowario
beefa5e62e Merge pull request 'Bulletproofs+' (#394) from wowario/wownero:bpp into dev
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/394
2021-06-27 13:46:52 +00:00
wowario
525cda3691 change to else if 2021-06-27 16:27:57 +03:00
wowario
9eb34340f4 fix macos operator error 2021-06-27 14:34:26 +03:00
wowario
90efe7dee8 set bp+ fork height 2021-06-27 14:31:26 +03:00
wowario
a9c03bb005 remove unused variable 2021-06-27 14:01:47 +03:00
moneromooo-monero
04dbdfcd98 store outPk/8 in the tx for speed
It avoids dividing by 8 when deserializing a tx, which is a slow
operation, and multiplies by 8 when verifying and extracing the
amount, which is much faster as well as less frequent
2021-06-27 13:50:12 +03:00
moneromooo-monero
1520d6a271 ringct: port some of vtnerd's review changes from BP+ to BP 2021-06-27 13:50:03 +03:00
moneromooo-monero
8e98e5b58a ringct: a few minor optimizations from review 2021-06-27 13:49:45 +03:00
moneromooo-monero
fa3856fedf plug bulletproofs plus into consensus 2021-06-27 13:47:33 +03:00
Sarang Noether
47d7d0751e Updates from security audit 2021-06-27 12:15:05 +03:00
Sarang Noether
75981b8463 Precompute initial transcript hash 2021-06-27 12:14:54 +03:00
Sarang Noether
16c573a507 Bulletproofs+ 2021-06-27 12:14:36 +03:00
wowario
100eebe660 update fork height 2021-06-27 02:42:04 +03:00
wowario
671c51d0b6 update Dockerfile 2021-06-27 02:33:36 +03:00
wowario
8d71405a59 open collective details 2021-06-27 00:45:38 +03:00
wowario
1113f815e1 update checkpoints 2021-06-27 00:45:24 +03:00
wowario
04a5d47e6c set fork height 2021-06-27 00:45:04 +03:00
wowario
45f275e9e4 add vote rpc res 2021-06-27 00:43:24 +03:00
wowario
4f16bd2b95 vote by block 2021-06-27 00:43:09 +03:00
wowario
6049797093 adjust difficulty_blocks_count 2021-06-27 00:42:33 +03:00
wowario
78ba621fa3 nudge estimate height 2021-06-27 00:42:21 +03:00
wowario
86b17e7dd1 update README 2021-06-27 00:42:06 +03:00
wowario
eaa511440f set testnet 2021-06-27 00:41:55 +03:00
wowario
03af4e871c fixed coinbase unlock 288 blks 2021-06-27 00:41:44 +03:00
wowario
51c8b36ba0 miner block header signing 2021-06-27 00:40:21 +03:00
wowario
9cd125b345 reset, revert difficulty algorithm, set fork height 2021-06-27 00:40:11 +03:00
wowario
707bfe86ad tidy up miner msgs 2021-06-27 00:39:57 +03:00
wowario
6f964b6cfb DojaCat 2021-06-27 00:39:45 +03:00
wowario
71a2c90fb8 remove MLSAG bug from monero 2021-06-27 00:39:33 +03:00
wowario
9c437b403a delete translation files 2021-06-27 00:39:19 +03:00
wowario
a67efd0686 disable sanity_checks 2021-06-27 00:39:09 +03:00
wowario
24948d4c2d update checkpoints 2021-06-27 00:38:47 +03:00
wowario
bd2c97c923 Update 'README.md' 2021-06-27 00:38:35 +03:00
wowario
974d8db176 bump to RandomWOW v1.1.9 2021-06-27 00:38:25 +03:00
qvqc
70811c09c5 wow colors 2021-06-27 00:38:17 +03:00
wowario
1196a9253b v0.10 ASCII art 2021-06-27 00:38:06 +03:00
wowario
70f8f2386c support old BP 2021-06-27 00:37:53 +03:00
wowario
840928cd6b initial commit 2021-06-27 00:37:27 +03:00
luigi1111
9c18f2767b Merge pull request #7743
8a67724 wallet_api: get bytes sent/received (tobtoht)
2021-06-24 14:35:30 -05:00
tobtoht
8a67724218 wallet_api: get bytes sent/received 2021-06-24 21:32:03 +02:00
luigi1111
14a1b89122 Merge pull request #7752
4251cc0 unit_tests: check for ge_frombytes_vartime failure (moneromooo-monero)
67b97a5 easylogging++: do not delete uninitialized objects (moneromooo-monero)
7b6d959 trezor: fix potential use of uninitialized memory (moneromooo-monero)
2021-06-24 14:13:19 -05:00
luigi1111
4f08d52dfa Merge pull request #7750
8e0b8dd wallet/api: remove Bitmonero namespace alias (selsta)
2021-06-24 14:12:37 -05:00
luigi1111
0a9d218044 Merge pull request #7749
e63c110 wallet_api: address_book: don't lose pid on setDescription (tobtoht)
2021-06-24 14:11:45 -05:00
luigi1111
99aa45fd34 Merge pull request #7746
1aa1850 wallet_api: signMessage: add sign with subaddress (tobtoht)
2021-06-24 14:06:13 -05:00
luigi1111
7c3629a5ee Merge pull request #7742
f174a8f wallet_api: reconnectDevice (tobtoht)
2021-06-24 14:05:35 -05:00
luigi1111
ce129599d0 Merge pull request #7739
6914d5b wallet_api: move adjust_mixin call within try block (tobtoht)
2021-06-24 14:04:42 -05:00
luigi1111
48e59b8064 Merge pull request #7672
5bf91fc add documentation for monero-blockchain-stats (donkeydonkey)
2021-06-24 14:03:03 -05:00
luigi1111
ad9956d987 Merge pull request #7634
5a2edea db_lmdb: catch exceptions testing for mmap support (moneromooo-monero)
2021-06-24 14:01:42 -05:00
luigi1111
f8abb225fc Merge pull request #7633
f6e2636 blockchain_db: harden code against invalid input types (moneromooo-monero)
2021-06-24 14:00:59 -05:00
luigi1111
3366bd81eb Merge pull request #7612
254a133 core: speed up print_coinbase_tx_sum (moneromooo-monero)
2021-06-24 13:59:44 -05:00
luigi1111
1796b44c67 Merge pull request #7611
71741a1 blockchain_import: fix wrong reported block/tx hashes on error (moneromooo-monero)
2021-06-24 13:59:12 -05:00
luigi1111
e028591336 Merge pull request #7380
8889f49 easylogging++: fix potential memory corruption (moneromooo-monero)
2021-06-24 13:57:53 -05:00
luigi1111
282e2ef058 Merge pull request #7738
a240453 README: freenode -> libera (selsta)
2021-06-16 14:41:40 -05:00
luigi1111
4e07c8cbbc Merge pull request #7733
cd8901c randomx: bump submodule to v1.1.9 (selsta)
2021-06-16 14:39:51 -05:00
luigi1111
b63442da21 Merge pull request #7730
e761577 provide key images of spent outputs in wallet rpc (woodser)
2021-06-16 14:38:06 -05:00
luigi1111
ab0bb31518 Merge pull request #7683
41297c1 CMake: strip targets (optional) with -D STRIP_TARGETS=ON (mj-xmr)
2021-06-16 14:37:39 -05:00
luigi1111
f8f1c78984 Merge pull request #7676
c19f0cb Compil time: move epee storages/parserse_base_utils.h to parserse_base_utils.cpp (mj-xmr)
2021-06-16 14:36:42 -05:00
woodser
e7615772fa provide key images of spent outputs in wallet rpc 2021-06-15 15:54:39 -04:00
mj-xmr
c19f0cbdea Compil time: move epee storages/parserse_base_utils.h to parserse_base_utils.cpp 2021-06-11 21:20:51 +02:00
mj-xmr
41297c10f0 CMake: strip targets (optional) with -D STRIP_TARGETS=ON 2021-06-11 21:19:37 +02:00
luigi1111
ab7df49331 Merge pull request #7751
b8b054c python-rpc: add missing python api for new freeze/thaw/frozen RPC (moneromooo-monero)
2021-06-11 12:28:01 -05:00
moneromooo-monero
4251cc0b4d unit_tests: check for ge_frombytes_vartime failure
CID 1446559
2021-06-11 07:51:45 +00:00
moneromooo-monero
67b97a5f16 easylogging++: do not delete uninitialized objects
CID 1446562
2021-06-11 07:51:29 +00:00
moneromooo-monero
7b6d959596 trezor: fix potential use of uninitialized memory
CID 1446575
2021-06-11 07:11:23 +00:00
moneromooo-monero
b8b054c0f1 python-rpc: add missing python api for new freeze/thaw/frozen RPC 2021-06-11 07:00:27 +00:00
selsta
8e0b8ddb96 wallet/api: remove Bitmonero namespace alias 2021-06-08 23:29:41 +02:00
tobtoht
e63c1107c0 wallet_api: address_book: don't lose pid on setDescription 2021-06-08 15:20:48 +02:00
tobtoht
1aa1850ba5 wallet_api: signMessage: add sign with subaddress 2021-06-04 18:16:10 +02:00
tobtoht
f174a8f05f wallet_api: reconnectDevice 2021-06-04 15:24:53 +02:00
tobtoht
6914d5b914 wallet_api: move adjust_mixin call within try block 2021-06-04 13:41:10 +02:00
selsta
a24045340c README: freenode -> libera 2021-06-01 03:07:58 +02:00
selsta
cd8901cc01 randomx: bump submodule to v1.1.9 2021-05-22 23:12:23 +02:00
donkeydonkey
5bf91fc894 add documentation for monero-blockchain-stats 2021-04-19 20:54:44 +02:00
moneromooo-monero
5a2edea16b db_lmdb: catch exceptions testing for mmap support
Turns out at least one arch (armel based) does not have unique_path
implemented and throws
2021-03-25 09:24:45 +00:00
moneromooo-monero
f6e2636493 blockchain_db: harden code against invalid input types
If an invalid input type were to get to this, the code could
remove key images that might be present already in the chain,
which could allow a double spend, even if this is impossible
with the current code.

Reported by KeyboardWarrior.
2021-03-24 21:43:57 +00:00
moneromooo-monero
71741a1ed6 blockchain_import: fix wrong reported block/tx hashes on error 2021-03-19 11:04:24 +00:00
moneromooo-monero
254a1338ad core: speed up print_coinbase_tx_sum
It only needs to parse the tx headers, not the full tx data
2021-03-18 11:16:08 +00:00
moneromooo-monero
8889f490ce easylogging++: fix potential memory corruption
The m_typedConfigurations pointer is copied from one object to the next,
but deleted in the dtor, leading to potential double free. It is also
deleted first thing in the copy ctor, deleting uninitialized memory.

This does not seem to actually happen in practice (those functions do
not get called), but seems safer that way.

Coverity 1446562
2021-02-16 09:43:18 +00:00
53 changed files with 322 additions and 157 deletions

View File

@@ -116,8 +116,8 @@ RUN set -ex \
&& make install
# Udev
ARG UDEV_VERSION=v3.2.8
ARG UDEV_HASH=d69f3f28348123ab7fa0ebac63ec2fd16800c5e0
ARG UDEV_VERSION=v3.2.10
ARG UDEV_HASH=be7068512c7512fa67c64fbff3472ab140c277c8
RUN set -ex \
&& git clone https://github.com/gentoo/eudev -b ${UDEV_VERSION} \
&& cd eudev \
@@ -202,11 +202,10 @@ VOLUME /home/wownero/.wownero
# wownero-wallet-cli
VOLUME /wallet
EXPOSE 38080
EXPOSE 38081
EXPOSE 34567
EXPOSE 34568
# switch to 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"]

View File

@@ -59,14 +59,18 @@ 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.
@@ -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
| - | 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,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.

View File

@@ -714,9 +714,8 @@ 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;
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
m_parentApplicationName = logger.m_parentApplicationName;
m_isConfigured = logger.m_isConfigured;
m_configurations = logger.m_configurations;
@@ -728,7 +727,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;
m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr;
m_parentApplicationName = logger.m_parentApplicationName;
m_isConfigured = logger.m_isConfigured;
m_configurations = logger.m_configurations;

View File

@@ -216,15 +216,8 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const std::pair
}
else
{
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;
LOG_PRINT_L1("Unsupported input type, aborting transaction addition");
throw std::runtime_error("Unexpected input type, aborting");
}
}

View File

@@ -1354,7 +1354,8 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
m_folder = filename;
check_mmap_support();
try { check_mmap_support(); }
catch(...) { MERROR("Failed to check for mmap support, proceeding"); }
#ifdef __OpenBSD__
if ((mdb_flags & MDB_WRITEMAP) == 0) {

View 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

View File

@@ -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::pod_to_hex(get_blob_hash(b.block)));
<< epee::string_tools::buff_to_hex_nodelimer(b.block));
core.cleanup_handle_incoming_blocks();
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);
if(tvc.m_verifivation_failed)
{
MERROR("transaction verification failed, tx_id = "
<< epee::string_tools::pod_to_hex(get_blob_hash(tx_blob.blob)));
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");
core.cleanup_handle_incoming_blocks();
return 1;
}
@@ -192,8 +195,11 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
if(bvc.m_verifivation_failed)
{
MERROR("Block verification failed, id = "
<< epee::string_tools::pod_to_hex(get_blob_hash(block_entry.block)));
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");
core.cleanup_handle_incoming_blocks();
return 1;
}

Binary file not shown.

View File

@@ -219,6 +219,7 @@ namespace cryptonote
ADD_CHECKPOINT2(307883, "9a8c35cd10963a14bba8a9628d1776df92fee5e3153b7249f5d15726efafaaea", "0x30b0965ba5a18");
ADD_CHECKPOINT2(312130, "e0da085bd273fff9f5f8e604fce0e91908bc62b6b004731a93e16e89cb9b1f54", "0x3cfe7148f2e18");
ADD_CHECKPOINT2(324600, "b24cd1ed7c192bbcf3d5b15729f2b032566687f96bda6f8cb73a5b16df4c6e6b", "0x69caecbe78718");
ADD_CHECKPOINT2(327700, "f113c8cbe077aab9296ecbfb41780c147aeb54edfece7e4b9946b8abd0f06de7", "0x732431429c818");
return true;
}

View File

@@ -447,6 +447,7 @@ namespace cryptonote
crypto::hash prev_id;
uint32_t nonce;
crypto::signature signature;
uint16_t vote;
BEGIN_SERIALIZE()
VARINT_FIELD(major_version)
@@ -455,7 +456,10 @@ namespace cryptonote
FIELD(prev_id)
FIELD(nonce)
if (major_version >= BLOCK_HEADER_MINER_SIG)
{
FIELD(signature)
FIELD(vote)
}
END_SERIALIZE()
};

View File

@@ -188,6 +188,7 @@ namespace boost
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
{
a & b.signature;
a & b.vote;
}
//------------------
a & b.miner_tx;
@@ -341,7 +342,7 @@ namespace boost
if (x.rangeSigs.empty())
{
a & x.bulletproofs;
if (ver >= 2)
if (ver >= 2u)
a & x.bulletproofs_plus;
}
a & x.MGs;
@@ -371,7 +372,7 @@ namespace boost
if (x.p.rangeSigs.empty())
{
a & x.p.bulletproofs;
if (ver >= 2)
if (ver >= 2u)
a & x.p.bulletproofs_plus;
}
a & x.p.MGs;

View File

@@ -181,7 +181,6 @@ 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)
{
@@ -207,6 +206,7 @@ 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,13 +1324,22 @@ namespace cryptonote
crypto::hash get_sig_data(const block& b)
{
crypto::hash 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);
blobdata blob = get_block_hashing_blob_sig_data(b);
crypto::cn_fast_hash(blob.data(), blob.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;

View File

@@ -122,6 +122,7 @@ 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);

View File

@@ -45,8 +45,6 @@
#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>
@@ -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_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};
}
@@ -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_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,6 +311,25 @@ 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;
@@ -608,6 +627,7 @@ 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;
@@ -645,6 +665,14 @@ 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)
{

View File

@@ -138,6 +138,8 @@ 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;

View File

@@ -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 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

View File

@@ -33,8 +33,6 @@
#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"
@@ -1397,6 +1395,11 @@ 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);
@@ -1408,6 +1411,7 @@ 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);
}
}
@@ -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
uint8_t hf_version = b.major_version;
size_t max_outs = hf_version >= 4 ? 1 : 11;
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);
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);
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)
@@ -1834,7 +1837,8 @@ 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, 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");
size_t coinbase_weight = get_transaction_weight(b.miner_tx);
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>
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__);
CRITICAL_REGION_LOCAL(m_blockchain_lock);
@@ -2731,10 +2735,12 @@ bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container
try
{
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());
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");
return false;
@@ -5519,7 +5525,7 @@ void Blockchain::cancel()
}
#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)
{
if (get_checkpoints == nullptr || !m_fast_sync)
@@ -5677,6 +5683,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>&) 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;
}

View File

@@ -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) 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

View File

@@ -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) 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
@@ -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) 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
@@ -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);
this->get_transactions(b.tx_hashes, txs, missed_txs, true);
uint64_t tx_fee_amount = 0;
for(const auto& tx: txs)
{

View File

@@ -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) 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
@@ -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) 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

View File

@@ -76,11 +76,12 @@ namespace cryptonote
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.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))

View File

@@ -38,7 +38,7 @@ namespace cryptonote
{
//---------------------------------------------------------------
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
{

View File

@@ -94,6 +94,7 @@ 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

View File

@@ -573,8 +573,13 @@ namespace trezor{
std::string req = "PINGPING";
char res[8];
m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
receive(res, 8, nullptr, false, timeout);
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;
return memcmp(res, "PONGPONG", 8) == 0;

View File

@@ -43,8 +43,8 @@ const hardfork_t mainnet_hard_forks[] = {
{ 15, 160777, 0, 1573280497 },
{ 16, 253999, 0, 1600576508 },
{ 17, 254287, 0, 1600576524 },
{ 18, 331337, 0, 1623245591 },
{ 19, 331625, 0, 1623693101 },
{ 18, 331170, 0, 1623245591 },
{ 19, 331458, 0, 1624793373 },
};
const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]);

View File

@@ -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,16 +1705,6 @@ 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())
@@ -1727,8 +1717,7 @@ 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) {
@@ -1863,8 +1852,7 @@ 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");

View File

@@ -422,18 +422,20 @@ 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)
{
@@ -452,6 +454,7 @@ namespace rct {
}
if (n_bulletproof_plus_max_amounts(bulletproofs_plus) < outputs)
return false;
ar.end_array();
}
else if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2 || type == RCTTypeCLSAG)
{
@@ -614,12 +617,12 @@ namespace rct {
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
{
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()

View File

@@ -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,6 +1859,7 @@ 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;
}
//------------------------------------------------------------------------------------------------------------------------------
@@ -2090,6 +2091,7 @@ 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))
@@ -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)
{
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;

View File

@@ -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 7
#define CORE_RPC_VERSION_MINOR 8
#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,6 +921,7 @@ 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)
@@ -937,6 +938,7 @@ 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;
@@ -1058,6 +1060,7 @@ 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)
@@ -1082,6 +1085,7 @@ 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()
};

View File

@@ -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,6 +898,7 @@ namespace rpc
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
{
header.signature = b.signature;
header.vote = b.vote;
}
header.prev_id = b.prev_id;

View File

@@ -165,6 +165,7 @@ namespace rpc
crypto::hash prev_id;
uint32_t nonce;
crypto::signature signature;
uint16_t vote;
uint64_t height;
uint64_t depth;
crypto::hash hash;

View File

@@ -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
));
}

View File

@@ -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, 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);
@@ -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.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);
}
@@ -1048,6 +1050,7 @@ 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);
@@ -1069,6 +1072,7 @@ 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);

View File

@@ -1,5 +1,5 @@
#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_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@

View File

@@ -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, 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)
refresh();
else
@@ -166,5 +166,3 @@ AddressBookImpl::~AddressBookImpl()
}
} // namespace
namespace Bitmonero = Wownero;

View File

@@ -66,6 +66,3 @@ private:
};
}
namespace Bitmonero = Wownero;

View File

@@ -264,6 +264,3 @@ std::vector<std::string> PendingTransactionImpl::signersKeys() const {
}
}
namespace Bitmonero = Wownero;

View File

@@ -73,5 +73,3 @@ private:
}
namespace Bitmonero = Wownero;

View File

@@ -266,5 +266,3 @@ void TransactionHistoryImpl::refresh()
}
} // namespace
namespace Bitmonero = Wownero;

View File

@@ -56,6 +56,3 @@ private:
};
}
namespace Bitmonero = Monero;

View File

@@ -150,5 +150,3 @@ uint64_t TransactionInfoImpl::unlockTime() const
}
} // namespace
namespace Bitmonero = Monero;

View File

@@ -87,5 +87,3 @@ private:
};
} // namespace
namespace Bitmonero = Wownero;

View File

@@ -316,6 +316,3 @@ uint64_t UnsignedTransactionImpl::minMixinCount() const
}
} // namespace
namespace Bitmonero = Wownero;

View File

@@ -71,5 +71,3 @@ private:
}
namespace Bitmonero = Wownero;

View File

@@ -60,5 +60,3 @@ void onStartup()
} // namespace
namespace Bitmonero = Wownero;

View File

@@ -58,7 +58,6 @@ 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;
@@ -1491,13 +1490,6 @@ 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);
@@ -1563,6 +1555,9 @@ 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,
@@ -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
@@ -2576,6 +2586,32 @@ void WalletImpl::deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex,
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

View File

@@ -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) 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 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,6 +220,9 @@ 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;
@@ -281,7 +284,4 @@ private:
} // namespace
namespace Bitmonero = Wownero;
#endif

View File

@@ -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) = 0;
virtual std::string signMessage(const std::string &message, const std::string &address = "") = 0;
/*!
* \brief verifySignedMessage - verify a signature matches a given message
* \param message - the message (arbitrary byte data)
@@ -1084,6 +1084,15 @@ 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;
};
/**
@@ -1362,6 +1371,3 @@ struct WalletManagerFactory
}
namespace Bitmonero = Wownero;

View File

@@ -406,5 +406,3 @@ void WalletManagerFactory::setLogCategories(const std::string &categories)
}
namespace Bitmonero = Wownero;

View File

@@ -102,5 +102,3 @@ private:
};
} // namespace
namespace Bitmonero = Wownero;

View File

@@ -260,7 +260,7 @@ TEST(multiexp, scalarmult_triple)
rct::key res;
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[] = {
rct::Z,

View File

@@ -58,14 +58,14 @@ TEST(tx_proof, prove_verify_v2)
// R_B = rB
crypto::public_key R_B;
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_scalarmult(&R_B_p2, &unwrap(r), &B_p3);
ge_tobytes(&R_B, &R_B_p2);
// R_G = rG
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_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;
ge_frombytes_vartime(&A_p3,&A);
ASSERT_EQ(ge_frombytes_vartime(&A_p3,&A), 0);
ge_p2 D_p2;
ge_scalarmult(&D_p2, &unwrap(r), &A_p3);
ge_tobytes(&D, &D_p2);

34
utils/votes.pl Normal file
View 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";
}