Compare commits

..

444 Commits

Author SHA1 Message Date
dsc
e2c99252fd wowletify 2023-01-12 05:07:52 +02:00
wowario
ab42be18f2 Merge pull request 'tag-release' (#435) from wowario/wownero:tag-release into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/435
2023-01-10 18:53:39 +00:00
dsc
44c482913f Wownero fails to compile on armv7a. To fix we can:
- update src/crypto/slow-hash.c to the latest version that Monero currently has
- modify variant4_random_math.h to facilitate the changes in slow-hash.c

In short; src/crypto/slow-hash.c is now up to date with upstream Monero.

The next Wownero version will have these changes automatically as the
codebase follows Monero, rendering this commit obsolete in the process.
2023-01-10 21:47:46 +03:00
wowario
07864cc53f add seed nodes 2023-01-10 21:46:43 +03:00
wowario
2d8b094e09 update README.md 2023-01-10 21:19:35 +03:00
wowario
cc0889aa59 Merge pull request 'wallet: faster value conveyance via five various velocity advances' (#433) from wowario/wownero:pr8046 into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/433
2023-01-05 22:17:01 +00:00
wowario
23d1a8d68e update checkpoints 2023-01-06 01:09:52 +03:00
wowario
35c9cf9c88 bump version 2023-01-05 23:42:52 +03:00
wowario
833ac01ed9 Merge pull request 'epee: add missing header' (#431) from sneurlax/wownero:fix/gcc11 into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/431
2023-01-05 20:37:31 +00:00
wowario
dc3981618d remove use_view_tags, revert fractional_threshold 2023-01-05 23:17:55 +03:00
moneromooo-monero
2eeb3fc1bf wallet2: speedup large tx construction: reserve vector memory
2.8 seconds -> 2.6 seconds on a test case
2023-01-05 21:09:15 +03:00
Crypto City
940811465f wallet2: speedup large tx construction: batch ringdb lookups
3.3 seconds -> 2.8 seconds on a test case
2023-01-05 21:05:24 +03:00
Crypto City
4a60dfbb3e wallet2: speedup large tx construction: no pointless clsag generation
4.1 seconds -> 3.3 seconds on a test case
2023-01-05 21:05:12 +03:00
Crypto City
7cdb8244ee wallet2: speedup large tx construction: batch ringdb updates
5.2 seconds -> 4.1 seconds on a test case
2023-01-05 21:05:01 +03:00
moneromooo-monero
0f8a3eded6 wallet2: speedup large tx construction: cache public key validity
5.9 second -> 5.2 seconds on a test case
2023-01-05 21:04:36 +03:00
wowario
0c3ffa66ce Merge pull request 'Update year to 2023' (#432) from nicolasvansaberhagen/wownero:master into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/432
2023-01-05 16:43:39 +00:00
wow nero
01903438a0 Merge pull request 'update year to 2023' (#1) from nicolasvansaberhagen-patch-1 into master
Reviewed-on: https://git.wownero.com/nicolasvansaberhagen/wownero/pulls/1
2023-01-01 13:17:09 +00:00
wow nero
3692b631b3 update year to 2023 2023-01-01 13:16:39 +00:00
sneurlax
39379d7022 epee: add missing header
See Monero commit [e106bdc1fc](e106bdc1fc (diff-d2cb9c3ff4c4762cfd7e736b42f3eb354a361fe9f0ecd2f956c08f03eb5f3405)) by [@selsta](https://github.com/selsta).  This commit includes <limits> in three epee source files in other to fix GCC11 builds, in my case for cross-compiling for Windows from Ubuntu using MinGW.  I patch my files locally in order to achieve this, whereas this fix, tracking Monero upstream code, will allow builds to complete using GCC11 out of the box.  See also https://github.com/MultiMC/Launcher/issues/3574 for the same issue in another repository for context.
2022-11-16 14:30:58 -06:00
wowario
ac12e02fcb Merge pull request 'broadcast donation sub-address' (#430) from wowario/wownero:addy into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/430
2022-10-18 13:53:20 +00:00
wowario
e85ee60d35 broadcast donation sub-address 2022-10-16 21:10:55 +03:00
wowario
6a561e5d83 Merge pull request 'fixing tor hidden service ports' (#428) from nahuhh/wownero:tor into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/428
2022-08-06 08:42:28 +00:00
wow nero
9efbb8896c reflect restricted rpc port in wownero.conf 2022-05-04 10:02:42 +00:00
wow nero
7412b75d42 fix onion peers
The old peers were configured incorrectly but nevertheless seem to be dead. Should we remove them?

I added a working peer.
2022-05-04 09:56:35 +00:00
wow nero
ee0c3ed694 adjust binds and use rpc-restricted-bind flags 2022-05-04 09:49:03 +00:00
wowario
053c7bccb5 Merge pull request 'OpenAlias: change to wownero' (#426) from fix-oa into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/426
2022-03-19 10:08:33 +00:00
dsc
4fdf8c01cb OpenAlias: change to wownero 2022-03-18 20:38:57 +02:00
wowario
51e7a4178e Merge pull request 'enable async refresh' (#420) from m2049r/wownero:fix_asyncrefresh into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/420
2021-09-17 16:16:01 +00:00
m2049r
f3a45f26c4 enable async refresh 2021-09-16 08:32:05 +02:00
wowario
7944b65d7d Merge pull request 'fix typo which breaks pool tx being stored properly' (#419) from m2049r/wownero:fix_pendingtx into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/419
2021-09-16 05:07:07 +00:00
m2049r
90e321abd0 fix typo which breaks pool tx being stored properly 2021-09-16 00:09:08 +02:00
wowario
a053814e71 Merge pull request 'add i2p seeds' (#417) from qvqc/wownero:master into master
Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/417
2021-09-06 03:42:20 +00:00
qvqc
a7c7711b47 add i2p seeds 2021-09-05 19:41:52 -04:00
qvqc
8ab87421d9 w0w denominations 2021-08-31 14:43:48 +03:00
wowario
83b06a7ef8 update README 2021-08-30 23:07:15 +03:00
wowario
c8b4665370 nudge estimate height 2021-08-30 22:45:03 +03:00
dsc
26b8602a03 remove unused variable 2021-08-30 21:43:45 +03:00
thotbot
31ec95aade Skip unneeded blocks in fast refresh 2021-08-30 21:43:37 +03:00
thotbot
29613140f2 subaddressIndex() 2021-08-30 21:43:22 +03:00
thotbot
ae0ea220d5 Print wallet cache 2021-08-30 21:43:05 +03:00
thotbot
25e497db3f Misc. network related
- Add interface for bytes sent/received
- Allow wallet refresh while daemon is not synchronized
- emit success boolean for refreshed()
- don't call refreshThreadFunc (we don't need it)
- lower rpc timeout from 3m30s (?!) to 10 seconds
2021-08-30 21:42:38 +03:00
thotbot
4edba5301a Import transaction 2021-08-30 21:39:47 +03:00
thotbot
3ea6587022 Misc. wallet API and wallet2 changes 2021-08-30 21:39:33 +03:00
thotbot
1840e844db Coins 2021-08-30 21:38:06 +03:00
thotbot
9da60611db Offline transaction signing 2021-08-30 21:37:53 +03:00
wowario
2baefe5e7e revert sanity check 2021-08-30 20:49:16 +03:00
wowario
859e43810b update checkpoints 2021-08-30 09:56:30 +03:00
wowario
a400e47582 remove unused blocks.dat 2021-08-30 07:40:55 +03:00
dsc
234674922c estimate_fee requires new bp+ parameter 2021-08-30 07:34:04 +03:00
wowario
882e13f15f bump version 2021-08-30 00:32:17 +03:00
wowario
947c154cd1 prevent mining within wallet and node 2021-08-30 00:29:18 +03:00
wowario
e586e39936 revert requested_outputs_count 2021-08-30 00:28:04 +03:00
wowario
3a5502297e remove 32 bit builds 2021-08-30 00:27:26 +03:00
wowario
7c24988ec0 bump version 2021-08-30 00:27:12 +03:00
wowario
4be1068f8a add seed nodes 2021-08-30 00:26:35 +03:00
wowario
805bdf15f2 remove DNS ips 2021-08-30 00:25:55 +03:00
wowario
7e44298459 msg on mining key 2021-08-30 00:25:32 +03:00
wowario
933e5df1cf change unable to send transaction warning to debug 2021-08-30 00:25:19 +03:00
wowario
e1b385332b bump version 2021-08-30 00:24:54 +03:00
wowario
2b814d3ca2 update checkpoints 2021-08-30 00:24:32 +03:00
lza_menace
15495e8c28 Update lza_menace seed node
This old AWS IP is gone
2021-08-30 00:23:45 +03:00
wowario
92a382dc13 change no incoming connections warning to debug 2021-08-30 00:23:26 +03:00
wowario
8e42421e15 change ports 2021-08-30 00:23:07 +03:00
wowario
07e4356090 update systemd service file 2021-08-30 00:22:52 +03:00
wowario
b5ad030b5b update checkpoints 2021-08-30 00:22:34 +03:00
wowario
337d131b82 add tor stuff 2021-08-30 00:21:49 +03:00
wowario
3083209a0c tag for gitian builds 2021-08-30 00:20:07 +03:00
wowario
f380155a97 change to else if 2021-08-30 00:19:36 +03:00
wowario
ff6883710b fix macos operator error 2021-08-30 00:19:26 +03:00
wowario
93b6af8a66 set bp+ fork height 2021-08-30 00:19:09 +03:00
wowario
307f553ee7 remove unused variable 2021-08-30 00:18:59 +03:00
moneromooo-monero
34884a4b00 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-08-30 00:18:45 +03:00
moneromooo-monero
e44b32c30c ringct: port some of vtnerd's review changes from BP+ to BP 2021-08-30 00:18:36 +03:00
moneromooo-monero
9176075ab9 ringct: a few minor optimizations from review 2021-08-30 00:18:25 +03:00
moneromooo-monero
ce6db7db63 plug bulletproofs plus into consensus 2021-08-30 00:17:37 +03:00
Sarang Noether
54559e256b Updates from security audit 2021-08-30 00:12:21 +03:00
Sarang Noether
619bbbb99f Precompute initial transcript hash 2021-08-30 00:12:09 +03:00
Sarang Noether
0bdbd108d8 Bulletproofs+ 2021-08-30 00:11:56 +03:00
wowario
d2fcec5413 update fork height 2021-08-30 00:08:25 +03:00
wowario
cf618fad1e update Dockerfile 2021-08-30 00:08:06 +03:00
wowario
6ca198c5e3 open collective details 2021-08-30 00:07:54 +03:00
wowario
9093976dba update checkpoints 2021-08-30 00:07:41 +03:00
wowario
d5f8b181df set fork height 2021-08-30 00:07:07 +03:00
wowario
8180febd4a add vote rpc res 2021-08-30 00:06:51 +03:00
wowario
30a41c2ab1 vote by block 2021-08-30 00:06:35 +03:00
wowario
118cbd043a adjust difficulty_blocks_count 2021-08-30 00:05:15 +03:00
wowario
40e30964c4 nudge estimate height 2021-08-30 00:05:02 +03:00
wowario
d47655f1f2 update README 2021-08-30 00:04:51 +03:00
wowario
87a375b3ff set testnet 2021-08-30 00:04:42 +03:00
wowario
c49a72f1ce fixed coinbase unlock 288 blks 2021-08-30 00:04:31 +03:00
wowario
7f7d697f43 miner block header signing 2021-08-30 00:04:17 +03:00
wowario
3898c1c4d9 reset, revert difficulty algorithm, set fork height 2021-08-30 00:04:06 +03:00
wowario
f6e95d080d tidy up miner msgs 2021-08-30 00:03:54 +03:00
wowario
b21562924e DojaCat 2021-08-30 00:03:42 +03:00
wowario
b78b83d79c remove MLSAG bug from monero 2021-08-30 00:03:33 +03:00
wowario
a74d59a7c2 delete translation files 2021-08-30 00:03:22 +03:00
wowario
25e3365afb disable sanity_checks 2021-08-30 00:03:12 +03:00
wowario
c2f2be5084 update checkpoints 2021-08-30 00:02:45 +03:00
wowario
aad83a7965 Update 'README.md' 2021-08-30 00:01:45 +03:00
wowario
85840ebae7 bump to RandomWOW v1.1.9 2021-08-30 00:01:33 +03:00
qvqc
85197effd5 wow colors 2021-08-30 00:01:22 +03:00
wowario
71fc01aaf2 v0.10 ASCII art 2021-08-30 00:01:11 +03:00
wowario
e1ff02c1c5 support old BP 2021-08-30 00:00:54 +03:00
wowario
952b0492d9 initial commit 2021-08-29 23:56:47 +03:00
luigi1111
2222bea92f Merge pull request #7902
0ae1cd2 v0.17: Fix Boost-1.77: Add missing algorithm header to i18n.cpp (mj-xmr)
2021-08-29 12:30:57 -04:00
luigi1111
f12e75b5e4 Merge pull request #7888
3c15eb8 python-rpc: add missing python api for new freeze/thaw/frozen RPC (moneromooo-monero)
2021-08-29 12:29:57 -04:00
mj-xmr
0ae1cd2413 v0.17: Fix Boost-1.77: Add missing algorithm header to i18n.cpp 2021-08-28 15:32:50 +02:00
luigi1111
317eceb725 Merge pull request #7894
c0ce4d5 Wallet2: fix optimize-coinbase for p2pool payouts (SChernykh)
2021-08-26 21:14:12 -04:00
luigi1111
d98787eb1b Merge pull request #7825
ccfed60 cmake: test is a reserved keyword (selsta)
f0fa959 cmake: fix ccache detection (anon)
8dbe2e5 Daemon: Update average block size table (rbrunner7)
94bad34 wallet2: Don't auto lock device on process parsed blocks (tobtoht)
3c23aca ledger: don't lock for software device (tobtoht)
49beb8d ledger: use software device if we have view key (tobtoht)
d188b5f wallet_api: getPassword (tobtoht)
a395f36 depends, docker: fix bintray links (selsta)
0fecd7e blocks: fix cmake syntax (selsta)
76824bf Stop adding more outputs than bulletproof allows (Alex Opie)
67ba733 unit_tests: fix wipeable_string parse_hexstr test with latest gtest (xiphon)
402ba04 cmake: use CMAKE_CURRENT_LIST_DIR in FindLibUSB (selsta)
1565bcb epee: include public openssl header in cmake (selsta)
2e9af2a cmake: treat warnings as error in compiler flag tests (selsta)
db564ef wallet_api: fix typo in exportKeyImages (selsta)
8507917 depends: add getmonero package mirror (selsta)
8716d2a cmake: fix non portable code (selsta)
2021-08-26 21:10:56 -04:00
luigi1111
ca1b1b7332 Merge pull request #7822
99bee1c Apply gamma distr from chain tip when selecting decoys (j-berman)
2021-08-26 21:08:56 -04:00
luigi1111
27c5013acd Merge pull request #7805
1e037d3 build: prepare v0.17.2.3 (selsta)
2021-08-26 21:08:04 -04:00
SChernykh
c0ce4d5089 Wallet2: fix optimize-coinbase for p2pool payouts
RefreshOptimizeCoinbase was an optimization to speed up scanning of coinbase transactions before RingCT (tx version 2) where they split miner reward into multiple denominations, all to the same wallet.

When RingCT was introduced, all coinbase transactions became 1 output only, so this optimization does nothing now.

With p2pool, this optimization will skip scanning p2pool payouts because they use more than 1 output in coinbase transaction.

Fix it by applying this optimization only to pre-RingCT transactions (version < 2).
2021-08-26 11:51:07 +02:00
moneromooo-monero
3c15eb8e81 python-rpc: add missing python api for new freeze/thaw/frozen RPC 2021-08-24 00:25:10 +02:00
luigi1111
c61c09a567 Merge pull request #7882
e48fae3 epee: link with Boost_SYSTEM_LIBRARY (selsta)
2021-08-20 16:51:39 -04:00
luigi1111
b864817629 Merge pull request #7879
be6c61e wallet_api: add make_uri (tobtoht)
2021-08-20 16:50:54 -04:00
luigi1111
a520234c51 Merge pull request #7848
adcf440 Make sure node returns to wallet that real output is unlocked (j-berman)
2021-08-20 16:49:19 -04:00
luigi1111
715ebcb744 Merge pull request #7846
2285c66 Protect client from divide by 0 caused by integer truncation (j-berman)
2021-08-20 16:48:14 -04:00
luigi1111
4073599aaf Merge pull request #7838
6ec9fd6 support freeze, thaw, and frozen in wallet rpc (woodser)
2021-08-20 16:43:18 -04:00
j-berman
2285c66ef1 Protect client from divide by 0 caused by integer truncation 2021-08-19 15:00:59 -07:00
j-berman
99bee1ccf0 Apply gamma distr from chain tip when selecting decoys
- matches the paper by Miller et al to apply the gamma from chain tip, rather than after unlock time
- if the gamma produces an output more recent than the unlock time, the algo packs that output into one of the first 50 spendable blocks, respecting the block density factor
2021-08-19 14:59:12 -07:00
selsta
e48fae3177 epee: link with Boost_SYSTEM_LIBRARY 2021-08-19 19:06:05 +02:00
tobtoht
be6c61e2ee wallet_api: add make_uri 2021-08-19 15:52:01 +02:00
selsta
1e037d372a build: prepare v0.17.2.3 2021-08-19 15:00:42 +02:00
woodser
6ec9fd6c08 support freeze, thaw, and frozen in wallet rpc 2021-08-12 09:13:09 -04:00
selsta
ccfed6008a cmake: test is a reserved keyword 2021-08-12 04:52:51 +02:00
anon
f0fa959383 cmake: fix ccache detection 2021-08-12 04:52:36 +02:00
rbrunner7
8dbe2e57ac Daemon: Update average block size table 2021-08-12 04:42:46 +02:00
luigi1111
64c320130f Merge pull request #7839
925c6b6 provide key images of spent outputs in wallet rpc (woodser)
2021-08-11 22:41:04 -04:00
luigi1111
8f95eaa0b0 Merge pull request #7817
1510b1e unit_tests: fix broken tests (anon)
2021-08-11 22:39:42 -04:00
luigi1111
9f93fe1539 Merge pull request #7810
8eb2b79 p2p: remove blocked addresses/hosts from peerlist (moneromooo-monero)
2021-08-11 22:36:50 -04:00
luigi1111
db6688f584 Merge pull request #7801
07d82af Fixed json serialization of rct::RCTTypeNull (SChernykh)
2021-08-11 22:33:04 -04:00
luigi1111
f00db20a5f Merge pull request #7792
9b84043 fix #7784 - deinit wallet in wallet dtor (Dusan Klinec)
2021-08-11 22:30:53 -04:00
j-berman
adcf440dcd Make sure node returns to wallet that real output is unlocked 2021-08-11 07:26:56 -07:00
woodser
925c6b60e3 provide key images of spent outputs in wallet rpc 2021-08-07 09:36:45 -04:00
tobtoht
94bad34c26 wallet2: Don't auto lock device on process parsed blocks 2021-08-07 03:04:24 +02:00
tobtoht
3c23aca26b ledger: don't lock for software device 2021-08-07 03:04:15 +02:00
tobtoht
49beb8da17 ledger: use software device if we have view key 2021-08-07 03:04:04 +02:00
tobtoht
d188b5f51f wallet_api: getPassword 2021-08-07 03:03:40 +02:00
moneromooo-monero
8eb2b79bad p2p: remove blocked addresses/hosts from peerlist 2021-08-05 19:05:02 +00:00
luigi1111
3eb8f1458b Merge pull request #7791
7e3f211 wallet: rephrase error message on invalid device address (Dusan Klinec)
2021-08-02 18:53:40 -04:00
selsta
a395f363e7 depends, docker: fix bintray links 2021-08-01 18:16:09 +02:00
selsta
0fecd7eb86 blocks: fix cmake syntax 2021-08-01 15:47:11 +02:00
Alex Opie
76824bf827 Stop adding more outputs than bulletproof allows
If more outputs are requested, they are split across
multiple transactions.

#7322
2021-08-01 15:47:11 +02:00
xiphon
67ba733de1 unit_tests: fix wipeable_string parse_hexstr test with latest gtest
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973196
2021-08-01 15:47:11 +02:00
selsta
402ba046e0 cmake: use CMAKE_CURRENT_LIST_DIR in FindLibUSB 2021-08-01 15:47:11 +02:00
selsta
1565bcb1fb epee: include public openssl header in cmake 2021-08-01 15:47:08 +02:00
selsta
2e9af2a1c8 cmake: treat warnings as error in compiler flag tests 2021-08-01 15:47:05 +02:00
selsta
db564efe0b wallet_api: fix typo in exportKeyImages 2021-08-01 15:47:05 +02:00
selsta
85079173db depends: add getmonero package mirror 2021-08-01 15:47:05 +02:00
selsta
8716d2ad9d cmake: fix non portable code 2021-08-01 15:47:05 +02:00
luigi1111
5a34eae063 Merge pull request #7815
7128f73 cmake: don't forbid undefined symbols on openbsd (selsta)
2021-07-28 14:02:43 -04:00
anon
1510b1e550 unit_tests: fix broken tests
boosted_tcp_server: check condition before sleep too
cryptonote_protocol_handler: each instance of BlockchainLMDB requires separate thread due to private thread local fields
2021-07-28 13:38:23 +00:00
selsta
7128f73ec2 cmake: don't forbid undefined symbols on openbsd 2021-07-28 01:23:03 +02:00
luigi1111
8b63bb3c75 Merge pull request #7789
2161bd0 device: set correct ledger min version (selsta)
2021-07-27 17:05:11 -04:00
luigi1111
56ce7fca6f Merge pull request #7781
4f7c38a device_trezor_base: fix typo (anon)
2021-07-27 17:03:46 -04:00
luigi1111
bc252794f0 Merge pull request #7693
ec6ff0d cmake: export all symbols (anon)
ceb8e7c cmake: fix undefined symbols and multiple definitions (anon)
72af8a5 cmake: forbid undefined symbols (anon)
2021-07-27 16:52:59 -04:00
SChernykh
07d82af979 Fixed json serialization of rct::RCTTypeNull
rct::RCTTypeNull doesn't have these fields (ecdhInfo, outPk, txnFee).
2021-07-18 17:19:32 +02:00
Dusan Klinec
9b840439b9 fix #7784 - deinit wallet in wallet dtor 2021-07-14 15:08:06 +02:00
Dusan Klinec
7e3f211791 wallet: rephrase error message on invalid device address 2021-07-14 15:05:28 +02:00
selsta
2161bd0f3a device: set correct ledger min version 2021-07-14 08:31:11 +02:00
anon
ec6ff0d002 cmake: export all symbols 2021-07-13 08:01:26 +02:00
anon
ceb8e7c508 cmake: fix undefined symbols and multiple definitions 2021-07-13 08:01:23 +02:00
anon
72af8a5fce cmake: forbid undefined symbols 2021-07-13 08:01:09 +02:00
anon
4f7c38a444 device_trezor_base: fix typo 2021-07-10 23:52:15 +00:00
luigi1111
7d2e717ee8 Merge pull request #7734
a2d8f87 randomx: bump submodule to v1.1.9 (selsta)
2021-06-16 14:40:45 -05:00
luigi1111
83e378740a Merge pull request #7736
c28d2f7 Fix boost 1.76.0 compatibility (loqs)
2021-06-01 22:12:42 -05:00
loqs
c28d2f7c11 Fix boost 1.76.0 compatibility
Add missing header boost/mpl/contains.hpp
monero-project/monero/issues/7728
2021-05-24 05:32:24 +02:00
selsta
a2d8f876ca randomx: bump submodule to v1.1.9 2021-05-22 23:13:23 +02:00
luigi1111
3701257d61 Merge pull request #7695
1d6f211 workflows: fix windows build (selsta)
2021-05-12 17:00:58 -05:00
luigi1111
90703ba8bd Merge pull request #7687
cb9a2e4 add -framework AppKit for Apple (woodser)
2021-05-12 16:57:02 -05:00
luigi1111
a080c0be9c Merge pull request #7678
dedcd63 wallet_api: import / export output function (tobtoht)
6e22710 expose set_offline to wallet api (benevanoff)
02e9a41 wallet_api: add isDeterministic() (tobtoht)
def5819 wallet_api: add seed_offset param to seed() (tobtoht)
73959c6 wallet_api: store fee for incoming txs in history (Ben Evanoff)
712f362 wallet api: allow wallet to fetch all key images via api (benevanoff)
153d08d Allow tx note edits via TransactionHistory object in wallet/api (dsc)
2abd7b1 wallet_api: TransactionHistory - fill unconfirmed out payments dests (xiphon)
9a50bef Extend TransactionInfo with coinbase and description attributes in wallet/api (dsc)
22bb6a6 Allow AddressBook description edits via wallet/api interface (dsc)
2021-05-12 16:55:38 -05:00
luigi1111
de7565069e Merge pull request #7680
70c5c81 wallet2: Fix rescan_bc keep_ki option (Nathan Dorfman)
2021-05-12 15:29:31 -05:00
selsta
1d6f2114b8 workflows: fix windows build 2021-04-27 14:45:22 +02:00
woodser
cb9a2e4471 add -framework AppKit for Apple 2021-04-26 18:30:32 -04:00
Nathan Dorfman
70c5c81670 wallet2: Fix rescan_bc keep_ki option 2021-04-22 16:15:01 -06:00
luigi1111
d59cd3d222 Merge pull request #7657
6305b90 ITS#9496 fix mdb_env_open bug from #8704 (Howard Chu)
2021-04-22 01:44:50 -04:00
tobtoht
dedcd6304c wallet_api: import / export output function 2021-04-22 04:33:11 +02:00
benevanoff
6e22710f0e expose set_offline to wallet api 2021-04-22 04:33:03 +02:00
tobtoht
02e9a41cbe wallet_api: add isDeterministic() 2021-04-22 04:32:50 +02:00
tobtoht
def58196da wallet_api: add seed_offset param to seed() 2021-04-22 04:32:41 +02:00
Ben Evanoff
73959c623c wallet_api: store fee for incoming txs in history 2021-04-22 04:32:32 +02:00
benevanoff
712f362150 wallet api: allow wallet to fetch all key images via api 2021-04-22 04:32:24 +02:00
dsc
153d08d026 Allow tx note edits via TransactionHistory object in wallet/api 2021-04-22 04:32:14 +02:00
xiphon
2abd7b174b wallet_api: TransactionHistory - fill unconfirmed out payments dests 2021-04-22 04:32:06 +02:00
dsc
9a50bef3cd Extend TransactionInfo with coinbase and description attributes in wallet/api 2021-04-22 04:31:44 +02:00
dsc
22bb6a654d Allow AddressBook description edits via wallet/api interface 2021-04-22 04:31:36 +02:00
luigi1111
38958f722b Merge pull request #7655
9fc9c7d gitian: remove osslsigncode (selsta)
2021-04-16 12:53:55 -05:00
luigi1111
36a68b0cba Merge pull request #7654
df03288 unit_tests: fix boost 1.58 compatibility (anon)
2021-04-16 12:53:28 -05:00
Howard Chu
6305b90596 ITS#9496 fix mdb_env_open bug from #8704
Broken in 9c6eb75c65
2021-04-09 14:25:51 +01:00
selsta
9fc9c7d695 gitian: remove osslsigncode
Unused and archive is offline
2021-04-08 17:13:57 +02:00
anon
df032882a8 unit_tests: fix boost 1.58 compatibility 2021-04-08 11:45:26 +00:00
luigi1111
f6e63ef260 Merge pull request #7647
d7b74a4 Tests: Fix test node_server.bind_same_p2p_port from randomly crashing (mj-xmr)
2021-04-06 12:25:41 -05:00
luigi1111
298208d92b Merge pull request #7350
4a9ae3e fix serialization being different on mac (moneromooo-monero)
2021-04-06 12:21:28 -05:00
mj-xmr
d7b74a4fb0 Tests: Fix test node_server.bind_same_p2p_port from randomly crashing 2021-04-05 17:51:54 +02:00
luigi1111
f719b74cd1 Merge pull request #7638
c18cdd3 build: prepare v0.17.2.0 (selsta)
2021-03-29 22:00:40 -04:00
luigi1111
1d597ad910 Merge pull request #7637
13978a9 depends: openssl 1.1.1i -> 1.1.1k (selsta)
2021-03-29 22:00:06 -04:00
luigi1111
4f6eea9021 Merge pull request #7631
fd869a7 cmake: Don't default to -march=native on OpenBSD (Nathan Dorfman)
2021-03-29 21:58:31 -04:00
luigi1111
076254d113 Merge pull request #7623
c8c7c40 ITS#9500 fix regression from ITS#8662 (Howard Chu)
2021-03-29 21:57:26 -04:00
luigi1111
daa1376370 Merge pull request #7621
21ab1de cryptonote_protocol_handler: fix race condition (anon)
699e82c cryptonote_protocol_handler: add race condition demo (anon)
2021-03-29 21:56:07 -04:00
luigi1111
eed63cef36 Merge pull request #7615
9ca9f12 Fixed issues found by static analysis (SChernykh)
2021-03-29 21:54:25 -04:00
luigi1111
dcdbf7ebcf Merge pull request #7459
d5b78c0 async_protocol_handler_config: fix deadlock (anon) f59b1d5 async_protocol_handler_config: add deadlock demo (anon)
2021-03-29 21:22:54 -04:00
selsta
c18cdd3623 build: prepare v0.17.2.0 2021-03-26 01:53:45 +01:00
selsta
13978a9887 depends: openssl 1.1.1i -> 1.1.1k 2021-03-25 21:45:03 +01:00
Nathan Dorfman
fd869a7b64 cmake: Don't default to -march=native on OpenBSD 2021-03-24 15:48:56 -06:00
Howard Chu
c8c7c40ac8 ITS#9500 fix regression from ITS#8662
mdb_load -a patch broke overwriting with MDB_CURRENT
2021-03-23 21:08:19 +00:00
anon
21ab1de89f cryptonote_protocol_handler: fix race condition 2021-03-22 19:42:45 +00:00
anon
699e82c282 cryptonote_protocol_handler: add race condition demo 2021-03-22 19:42:45 +00:00
luigi1111
9ec4ce36c7 Merge pull request #7419
25588de trezor: simplify recognition of integrated addresses (Dusan Klinec)
2021-03-20 01:54:52 -04:00
SChernykh
9ca9f1214a Fixed issues found by static analysis
- rolling_median: tried to free uninitialized pointer in a constructor
- net_node.inl: erase-remove idiom was used incorrectly. remove_if doesn't actually remove elements, see http://cpp.sh/6fcjv
- bulletproofs.cc: call to sizeof() instead of vector.size(), luckily it only impacts performance and not code logic there
2021-03-18 21:57:13 +01:00
anon
d5b78c08b6 async_protocol_handler_config: fix deadlock 2021-03-12 11:59:05 +00:00
anon
f59b1d5fb5 async_protocol_handler_config: add deadlock demo 2021-03-12 11:59:05 +00:00
moneromooo-monero
4a9ae3eb8b fix serialization being different on mac
On Mac, size_t is a distinct type from uint64_t, and some
types (in wallet cache as well as cold/hot wallet transfer
data) use pairs/containers with size_t as fields. Mac would
save those as full size, while other platforms would save
them as varints. Might apply to other platforms where the
types are distinct.

There's a nasty hack for backward compatibility, which can
go after a couple forks.
2021-03-05 23:41:19 +00:00
luigi1111
837c9aec22 Merge pull request #7390
7fd140e async_protocol_handler_config: remove connection correctly (anon)
c1776be async_protocol_handler_config: add segfault demo (anon)
2021-03-05 13:56:12 -05:00
luigi1111
af46a291ad Merge pull request #7336
d8137dc device_trezor: add redundant check (anon)
c6e1d7b device_trezor: wipe string fields properly (anon)
2021-03-05 13:53:00 -05:00
Dusan Klinec
25588de40c trezor: simplify recognition of integrated addresses
now it is possible to simplify integrated addresses recognition using transaction destination info directly
fixes https://github.com/monero-project/monero-gui/issues/3346
2021-03-03 15:39:12 +01:00
anon
7fd140e4f7 async_protocol_handler_config: remove connection correctly 2021-02-19 22:27:28 +00:00
anon
c1776be54f async_protocol_handler_config: add segfault demo 2021-02-19 22:27:28 +00:00
luigi1111
30bc575505 Merge pull request #7362
332b973 ITS#9007 don't free loose writemap pages (Kris Zyp)
2021-02-18 14:08:58 -05:00
luigi1111
aa408d1c72 Merge pull request #7333
b5667c9 p2p: allow CIDR notation in DNS blocklist (moneromooo-monero)
2021-02-16 11:45:38 -05:00
luigi1111
c8895ccbb7 Merge pull request #7309
6d5e210 boosted_tcp_server: fix connection lifetime (anon)
afec439 boosted_tcp_server: add segfault demo (anon)
2021-02-15 21:56:07 -05:00
luigi1111
975d390d00 Merge pull request #7284
32ab89a docs: Remove outdated bits about anonymity network seed nodes (Nathan Dorfman)
2021-02-15 21:49:50 -05:00
Kris Zyp
332b9734ff ITS#9007 don't free loose writemap pages
Broken in ITS#8756
2021-02-01 16:10:09 +00:00
moneromooo-monero
b5667c9f6c p2p: allow CIDR notation in DNS blocklist 2021-01-21 01:41:31 +00:00
anon
d8137dc523 device_trezor: add redundant check 2021-01-20 22:07:13 +01:00
anon
c6e1d7bcdf device_trezor: wipe string fields properly 2021-01-20 22:07:13 +01:00
anon
6d5e2106b3 boosted_tcp_server: fix connection lifetime 2021-01-19 18:16:01 +01:00
anon
afec439953 boosted_tcp_server: add segfault demo 2021-01-19 18:16:01 +01:00
luigi1111
25670398b1 Merge pull request #7295
fe6dda9 p2p: only log to global when a blocked IP is not already blocked (moneromooo-monero)
2021-01-15 23:53:40 -05:00
moneromooo-monero
fe6dda9453 p2p: only log to global when a blocked IP is not already blocked 2021-01-08 15:50:10 +00:00
Alexander Blair
8fef32e45c Merge pull request #7292
ba3c627c5 Command max_bytes moved from dynamic map to static switch (Lee Clagett)
2021-01-07 17:55:23 -08:00
Alexander Blair
7f1a83b852 Merge pull request #7287
89fe0e1c8 storages: overridable limits for loading portable_storage from binary (moneromooo-monero)
2021-01-07 17:55:13 -08:00
moneromooo-monero
89fe0e1c81 storages: overridable limits for loading portable_storage from binary 2021-01-07 20:24:51 +00:00
luigi1111
b06ccc0416 Merge pull request #7282
5d2dd7a epee: also limit number of strings in portable_storage (moneromooo-monero)
2021-01-06 21:11:53 -05:00
luigi1111
83fa752a84 Merge pull request #7267
c2295f5 protocol: handle receiving a block hash we've not added yet (moneromooo-monero)
2021-01-06 21:09:36 -05:00
luigi1111
7ecdc53e11 Merge pull request #7248
3c7eec1 add a max levin packet size by command type (moneromooo-monero)
2021-01-06 21:08:11 -05:00
Nathan Dorfman
32ab89aa86 docs: Remove outdated bits about anonymity network seed nodes 2021-01-05 23:05:05 -07:00
moneromooo-monero
5d2dd7a328 epee: also limit number of strings in portable_storage
They require at least 24 bytes
2021-01-05 17:56:11 +00:00
Alexander Blair
f3de67bc21 Merge pull request #7269
1128146c4 blockchain: lock access to m_blocks_hash_of_hashes (moneromooo-monero)
2021-01-03 18:29:39 -08:00
Alexander Blair
51057105b9 Merge pull request #7264
31b2572ec build: prepare v0.17.1.9 (selsta)
2021-01-03 18:29:19 -08:00
Alexander Blair
54cf799f0f Merge pull request #7262
0add7ec1c portable_storage: better sanity checking (moneromooo-monero)
2021-01-03 18:28:50 -08:00
moneromooo-monero
3c7eec152c add a max levin packet size by command type 2021-01-03 14:07:58 +00:00
moneromooo-monero
1128146c49 blockchain: lock access to m_blocks_hash_of_hashes
it is accessed both when adding and when prevalidating a set
of new hashes from a peer
2021-01-02 22:20:24 +00:00
moneromooo-monero
c2295f55b8 protocol: handle receiving a block hash we've not added yet 2021-01-02 22:10:44 +00:00
selsta
31b2572ec7 build: prepare v0.17.1.9 2021-01-02 18:13:47 +01:00
moneromooo-monero
0add7ec1cd portable_storage: better sanity checking 2021-01-02 12:36:42 +00:00
Alexander Blair
2107337999 Merge pull request #7251
f0b867b13 Restrict duplicate keys in epee binary format (Lee Clagett)
2021-01-01 22:44:24 -08:00
Alexander Blair
f4e34d50cf Merge pull request #7249
cb296b39b portable_storage: forbid unnamed sections (xiphon)
2021-01-01 22:44:02 -08:00
Alexander Blair
a4ffad75ac Merge pull request #7247
57f7c2e53 protocol: more sanity checks in new chain block hashes (moneromooo-monero)
2021-01-01 22:43:46 -08:00
Alexander Blair
024783f73a Merge pull request #7244
531069859 portable_storage: check object limit where appropriate (moneromooo)
2021-01-01 22:42:43 -08:00
Alexander Blair
db686707cb Merge pull request #7239
e685f52e2 p2p: fix deadlock banning while updating peer lists (moneromooo)
2021-01-01 22:42:17 -08:00
Alexander Blair
5767e6db90 Merge pull request #7235
00253b717 protocol: don't reset last request time on an idle timer (moneromooo-monero)
2021-01-01 22:41:54 -08:00
xiphon
cb296b39bd portable_storage: forbid unnamed sections 2021-01-01 02:06:39 +01:00
moneromooo-monero
57f7c2e53f protocol: more sanity checks in new chain block hashes 2020-12-31 23:34:26 +00:00
moneromooo
531069859f portable_storage: check object limit where appropriate
also fix pedantic off by one in check
2020-12-31 22:35:32 +00:00
binaryFate
00b3502749 Merge pull request #7228 from vtnerd/fix/p2p_memory_usage_017
Add aggressive restrictions to pre-handshake p2p buffer limit
2020-12-31 21:35:00 +01:00
moneromooo
e685f52e25 p2p: fix deadlock banning while updating peer lists 2020-12-31 03:15:11 +00:00
moneromooo-monero
00253b717c protocol: don't reset last request time on an idle timer
this prevents losing time of "idle time" for a peer, which could
otherwise be reset by another timed sync command from the peer
2020-12-30 14:21:57 +00:00
Lee Clagett
7d67a2dde0 Add aggressive restrictions to pre-handshake p2p buffer limit 2020-12-29 19:58:53 -05:00
Alexander Blair
36dfd41e01 Merge pull request #7222
218a10967 rpc: limit the number of txes for get_blocks.bin (moneromooo-monero)
2020-12-29 10:48:05 -08:00
Alexander Blair
bcd7f63a54 Merge pull request #7219
b39ee13d7 portable_storage: remove array element limit (moneromooo-monero)
2020-12-29 10:45:46 -08:00
Alexander Blair
3a477a54a2 Merge pull request #7208
b8bc4d77b ssl: buffered handshake detection (anon)
2020-12-29 10:45:03 -08:00
moneromooo-monero
218a109677 rpc: limit the number of txes for get_blocks.bin 2020-12-29 04:32:33 +00:00
anon
b8bc4d77b7 ssl: buffered handshake detection 2020-12-28 22:21:17 +01:00
moneromooo-monero
b39ee13d70 portable_storage: remove array element limit
some people don't want it
2020-12-28 21:05:12 +00:00
Alexander Blair
a99d6e56b6 Merge pull request #7193
31ae533d6 epee: fix some issues using connections after shutdown (moneromooo-monero)
2020-12-28 11:49:42 -08:00
Alexander Blair
5804add75b Merge pull request #7206
8c8f3d73b protocol: fix false positives dropping peers (moneromooo-monero)
2020-12-28 11:40:26 -08:00
Alexander Blair
75e9e7b39a Merge pull request #7203
0fc927dfb portable_storage: remove overly aggressive cutoff (moneromooo-monero)
2020-12-28 11:40:15 -08:00
Alexander Blair
a87eca5e7d Merge pull request #7197
0443cccb5 cryptonote_basic: guess what got lost porting patches to branches again (moneromooo-monero)
2020-12-28 11:39:58 -08:00
moneromooo-monero
8c8f3d73b5 protocol: fix false positives dropping peers
it'd trigger on reorgs
2020-12-27 14:42:59 +00:00
moneromooo-monero
0fc927dfba portable_storage: remove overly aggressive cutoff 2020-12-27 12:45:13 +00:00
Alexander Blair
d3e582e517 Merge pull request #7198
e42bb297b Revert "Reject existing claimed blocks in sync mode" (luigi1111)
2020-12-26 21:25:52 -08:00
luigi1111
e42bb297b8 Revert "Reject existing claimed blocks in sync mode" 2020-12-27 00:16:56 -05:00
moneromooo-monero
0443cccb5d cryptonote_basic: guess what got lost porting patches to branches again 2020-12-26 23:44:34 +00:00
Alexander Blair
b42d08995e Merge pull request #7191
d5be31ee2 portable_storage: add some sanity checks on data size (moneromooo-monero)
2020-12-26 14:14:31 -08:00
Alexander Blair
138092ddc9 Merge pull request #7189
adcbcd8f8 protocol: drop nodes if they claim new data but only give stale data (moneromooo-monero)
2020-12-26 14:14:16 -08:00
Alexander Blair
4ddde36c50 Merge pull request #7183
ba60541f3 build: prepare v0.17.1.8 (selsta)
2020-12-26 14:00:06 -08:00
Alexander Blair
0873f3193a Merge pull request #7181
e35bbb1e8 ban lists may now include subnets (moneromooo-monero)
2020-12-26 13:59:51 -08:00
Alexander Blair
cbeaeb904b Merge pull request #7174
5c3e84b6a restrict public node checks a little (moneromooo-monero)
2020-12-26 13:59:09 -08:00
Alexander Blair
355be543c7 Merge pull request #7161
07b50c42d rpc: get_info - add 'synchronized' field (xiphon)
2020-12-26 13:58:19 -08:00
Alexander Blair
6cea8ca895 Merge pull request #7155
42ee30929 protocol: reject claimed block hashes that already are in the chain (moneromooo-monero)
a436c3625 protocol: drop peers we can't download anything from in sync mode (moneromooo-monero)
2020-12-26 13:58:06 -08:00
Alexander Blair
e08d37fc7b Merge pull request #7146
3bb748ad9 p2p: remove peers from grey and anchors lists when blocked (moneromooo-monero)
2020-12-26 13:57:54 -08:00
Alexander Blair
1c14b7b3b2 Merge pull request #7139
fb9ef2426 Optional DNS based blocklist (moneromooo-monero)
2020-12-26 13:57:25 -08:00
moneromooo-monero
31ae533d6d epee: fix some issues using connections after shutdown 2020-12-26 14:15:12 +00:00
moneromooo-monero
d5be31ee21 portable_storage: add some sanity checks on data size
especially when allocated size is >> serialized data size
2020-12-26 03:23:12 +00:00
moneromooo-monero
adcbcd8f8b protocol: drop nodes if they claim new data but only give stale data
Some joker is spending time actually doing this
2020-12-25 20:31:23 +00:00
Lee Clagett
ba3c627c57 Command max_bytes moved from dynamic map to static switch 2020-12-23 23:53:27 +00:00
xiphon
07b50c42dd rpc: get_info - add 'synchronized' field 2020-12-23 10:43:47 +00:00
selsta
ba60541f3e build: prepare v0.17.1.8 2020-12-23 02:13:16 +01:00
moneromooo-monero
5c3e84b6ae restrict public node checks a little
do not include blocked hosts in peer lists or public node lists by default,
warn about no https on clearnet and about untrusted peers likely being spies
2020-12-22 23:39:19 +00:00
moneromooo-monero
e35bbb1e88 ban lists may now include subnets 2020-12-22 02:12:58 +00:00
moneromooo-monero
fb9ef24267 Optional DNS based blocklist
If enabled, pulls IPs to block on blocklist.moneropulse.*, and
blocks then for 8 days (so IPs dropping from the list will
eventually get unblocked, and DNS failures don't result in
instant clearing of the blocklist).

Enable with --enable-dns-blocklist
2020-12-20 02:34:24 +00:00
luigi1111
ee8d740cba Merge pull request #7152
cf4461f Fix byte_stream::put_n (Lee Clagett)
2020-12-19 17:26:51 -06:00
luigi1111
e0e2eb2bf5 Merge pull request #7144
a569483 p2p: ignore incoming peer list entries when we have them blocked (moneromooo-monero)
2020-12-19 17:25:11 -06:00
luigi1111
ecedaf2975 Merge pull request #7142
905cc07 daemon: the ban command can now load IPs from a file (ban @filename) (moneromooo-monero)
2020-12-19 17:23:52 -06:00
luigi1111
94897cf8f7 Merge pull request #7140
55e4007 Depends: Bump qt to 5.15.1 (TheCharlatan)
2020-12-19 17:21:05 -06:00
luigi1111
e38f3dbfb2 Merge pull request #7157
a4cdcd9 rpc: add a busy_syncing field to get_info (moneromooo-monero)
2020-12-17 14:33:51 -06:00
moneromooo-monero
a4cdcd9bd0 rpc: add a busy_syncing field to get_info
true if and pretty much only if new blocks are being added
2020-12-17 18:11:56 +00:00
moneromooo-monero
42ee309292 protocol: reject claimed block hashes that already are in the chain 2020-12-17 03:00:39 +00:00
Lee Clagett
f0b867b13d Restrict duplicate keys in epee binary format 2020-12-17 01:04:00 +00:00
moneromooo-monero
a436c36256 protocol: drop peers we can't download anything from in sync mode
instead of the (incorrect) check for whether we think we might have
a user for it at some point in the near future. We can reconnect.
2020-12-16 20:20:17 +00:00
Lee Clagett
cf4461f40b Fix byte_stream::put_n 2020-12-14 16:20:51 +00:00
moneromooo-monero
905cc07c8b daemon: the ban command can now load IPs from a file (ban @filename) 2020-12-14 12:26:37 +00:00
moneromooo-monero
3bb748ad94 p2p: remove peers from grey and anchors lists when blocked 2020-12-13 23:27:56 +00:00
moneromooo-monero
a569483c19 p2p: ignore incoming peer list entries when we have them blocked 2020-12-13 23:14:22 +00:00
TheCharlatan
55e4007c48 Depends: Bump qt to 5.15.1 2020-12-13 16:09:00 +01:00
luigi1111
54a4071473 Merge pull request #7131
c1d6547 protocol: include first new block in chain entry response (moneromooo-monero)
2020-12-12 22:05:41 -06:00
luigi1111
4f70af3af1 Merge pull request #7128
b6b2c9b protocol: stricter checks on received chain hash list (moneromooo)
2020-12-12 22:03:59 -06:00
luigi1111
31390dce4d Merge pull request #7124
d6069f7 protocol: revert incoming chain height check against local chain (moneromooo-monero)
2020-12-12 22:02:20 -06:00
moneromooo-monero
c1d654708f protocol: include first new block in chain entry response 2020-12-12 01:36:56 +00:00
moneromooo
b6b2c9b8e8 protocol: stricter checks on received chain hash list 2020-12-11 18:47:28 +00:00
moneromooo-monero
d6069f7ded protocol: revert incoming chain height check against local chain
We can actually request a chain that's further away from what we
have as we buffer more and more
2020-12-11 02:37:33 +00:00
Alexander Blair
7a9ba3f154 Merge pull request #7122
3a3370096 protocol: one more sanity check on usable data from a peer (moneromooo-monero)
2020-12-10 17:57:18 -08:00
Alexander Blair
575f6b5f13 Merge pull request #7120
105afa555 protocol: fix asking for pruned blocks for v10 (moneromooo-monero)
2020-12-10 17:57:07 -08:00
Alexander Blair
d6b2c676a9 Merge pull request #7118
ef1524ecc protocol: add a sanity check to the number of block hashes sent (moneromooo-monero)
2020-12-10 17:56:53 -08:00
Alexander Blair
5d39df5d92 Merge pull request #7116
a700e6103 build: prepare v0.17.1.7 (selsta)
2020-12-10 17:56:38 -08:00
Alexander Blair
91f941120d Merge pull request #7115
45d9a282d cmake: fix "release" version string on tagged releases (moneromooo-monero)
2020-12-10 17:56:15 -08:00
Alexander Blair
f9eee6f193 Merge pull request #7111
d729730d3 protocol: drop origin IP if a block fails to verify in sync mode (moneromooo-monero)
2020-12-10 17:55:59 -08:00
Alexander Blair
37800ceb5b Merge pull request #7107
f47f1a069 protocol: more restrictive checks on chain entry response (moneromooo-monero)
2020-12-10 17:55:42 -08:00
Alexander Blair
b311043ec6 Merge pull request #7101
b4b3cd3ad depends: Update OpenSSL to 1.1.1i (Howard Chu)
2020-12-10 17:55:27 -08:00
moneromooo-monero
3a3370096e protocol: one more sanity check on usable data from a peer 2020-12-10 23:02:38 +00:00
moneromooo-monero
105afa5557 protocol: fix asking for pruned blocks for v10
Old format is still alloewd there, this is a two fork update
2020-12-10 22:56:52 +00:00
moneromooo-monero
d729730d38 protocol: drop origin IP if a block fails to verify in sync mode
It would otherwise be possible for a peer to send bad blocks,
then disconnect and reconnect again, escaping bans
2020-12-10 22:00:01 +00:00
luigi1111
f570ce1349 Merge pull request #7109
e83a220 protocol: fix switchting to adding blocks if noone's adding the next span (moneromooo-monero)
2020-12-10 15:49:20 -06:00
moneromooo-monero
ef1524ecca protocol: add a sanity check to the number of block hashes sent 2020-12-10 19:26:50 +00:00
moneromooo-monero
45d9a282d1 cmake: fix "release" version string on tagged releases
It would not say "release" if we're on a previous tag
2020-12-10 19:12:41 +00:00
selsta
a700e6103b build: prepare v0.17.1.7 2020-12-10 20:12:27 +01:00
moneromooo-monero
f47f1a0691 protocol: more restrictive checks on chain entry response 2020-12-10 17:24:16 +00:00
moneromooo-monero
e83a220603 protocol: fix switchting to adding blocks if noone's adding the next span 2020-12-10 15:46:29 +00:00
Howard Chu
b4b3cd3ad3 depends: Update OpenSSL to 1.1.1i
Remove some obsolete patches (they were integrated upstream).
Tweak to work with Android support (they second-guess our CC definition, etc).
2020-12-09 19:20:34 +00:00
luigi1111
f7aa91f70d Merge pull request #7076
37bb594 Do not use peer_id tracking method over i2p/tor (Lee Clagett)
2020-12-07 10:26:15 -06:00
luigi1111
f9a70e4260 Merge pull request #7073
446b3c8 p2p: drop peers that spam peer lists (moneromooo-monero)
2020-12-07 10:25:38 -06:00
luigi1111
f105a0ef38 Merge pull request #7071
21b3ff2 p2p: fix race condition accessing a deleted context (moneromooo-monero)
2020-12-07 10:23:57 -06:00
luigi1111
1cb3ea0447 Merge pull request #7065
b34d50f build: prepare v0.17.1.6 (selsta)
2020-12-07 10:22:38 -06:00
luigi1111
43788ffd2a Merge pull request #7063
7982ef5 crypto: fix non zero scalar being 0 after reducing (moneromooo-monero)
2020-12-07 10:20:19 -06:00
luigi1111
6d35b667cf Merge pull request #7054
ce26c5b protocol: drop peers that don't reply to queries (moneromooo)
9427b5a keep only the last seen node on a given host in the white list (moneromooo)
fa79148 protocol: drop peers that decrease claimed height (moneromooo)
1382b17 protocol: add scoring system to drop peers that don't behave (moneromooo)
2020-12-07 10:04:08 -06:00
moneromooo
ce26c5b2dd protocol: drop peers that don't reply to queries 2020-12-06 15:57:23 +00:00
moneromooo-monero
21b3ff2c90 p2p: fix race condition accessing a deleted context 2020-12-06 12:42:11 +00:00
moneromooo-monero
446b3c865b p2p: drop peers that spam peer lists
There's always some people who just want to abuse things
2020-12-05 13:41:48 +00:00
moneromooo
9427b5a6d5 keep only the last seen node on a given host in the white list 2020-12-04 01:55:05 +00:00
moneromooo
fa79148e0c protocol: drop peers that decrease claimed height 2020-12-04 01:55:04 +00:00
moneromooo
1382b17aa1 protocol: add scoring system to drop peers that don't behave 2020-12-04 01:55:01 +00:00
moneromooo-monero
7982ef5a73 crypto: fix non zero scalar being 0 after reducing 2020-12-04 01:00:22 +00:00
selsta
b34d50fa76 build: prepare v0.17.1.6 2020-12-03 21:37:33 +01:00
Alexander Blair
0833680c74 Merge pull request #7059
93135907d wallet2: set propagation timeout to current max timeout (selsta)
2020-12-03 12:20:14 -08:00
selsta
93135907dd wallet2: set propagation timeout to current max timeout 2020-12-03 02:24:52 +01:00
Alexander Blair
065bb292df Merge pull request #7010
a8cd073fc Add rpc-restricted-bind-ip option (Howard Chu)
2020-12-01 14:22:39 -08:00
luigi1111
3942a1cd04 Merge pull request #7044
efca5b8 wallet2: check imported multisig curve points are in main subgroup (moneromooo-monero)
2020-11-25 09:31:25 -06:00
luigi1111
e4c0cb0ff3 Merge pull request #7039
9d7f473 cryptonote_core: dandelion - use local height or median height if syncing (xiphon)
2020-11-25 09:14:26 -06:00
xiphon
9d7f473af0 cryptonote_core: dandelion - use local height or median height if syncing 2020-11-25 01:26:03 +00:00
Alexander Blair
41652c9aa1 Merge pull request #7040
af4fb4729 rpc: skip non-synced bootstrap daemons in --no-sync mode too (xiphon)
2020-11-24 11:21:40 -08:00
Alexander Blair
0a0ceb62f0 Merge pull request #7038
5bb83ab04 build: prepare v0.17.1.5 (selsta)
2020-11-24 11:20:33 -08:00
Alexander Blair
8e7b762092 Merge pull request #7037
8e829e034 rpc: on_send_raw_tx - add missing CHECK_CORE_READY (xiphon)
2020-11-24 11:19:32 -08:00
Alexander Blair
551e6c9168 Merge pull request #7028
9b7ed2fd8 Change Dandelion++ fluff probability to 20%, and embargo timeout to 39s (Lee Clagett)
2020-11-24 11:19:07 -08:00
Alexander Blair
c09d142972 Merge pull request #7026
e8468c5dc Fix timeout checks for forwarded and Dandelion++ stem txes (Lee Clagett)
2020-11-24 11:17:59 -08:00
Crypto City
efca5b8af9 wallet2: check imported multisig curve points are in main subgroup 2020-11-24 16:24:03 +00:00
luigi1111
251c64f195 Merge pull request #7011
398e64c Better log message for unusable anon networks (hyc)
2020-11-23 16:15:50 -06:00
selsta
5bb83ab042 build: prepare v0.17.1.5 2020-11-23 15:22:35 +01:00
xiphon
af4fb4729e rpc: skip non-synced bootstrap daemons in --no-sync mode too 2020-11-23 12:24:01 +00:00
xiphon
8e829e034f rpc: on_send_raw_tx - add missing CHECK_CORE_READY 2020-11-22 16:11:19 +00:00
Howard Chu
398e64ccbe Better log message for unusable anon networks 2020-11-16 12:37:40 +00:00
Howard Chu
a8cd073fcc Add rpc-restricted-bind-ip option
Fixes #6369
2020-11-11 12:19:13 +00:00
luigi1111
f690e4984d Merge pull request #6997
752837b build: prepare v0.17.1.3 (selsta)
2020-11-07 13:10:15 -06:00
luigi1111
ebc9197326 Merge pull request #6996
981e0b5 epee: readline_buffer - fix thread safety, fix sync() after stop() (xiphon)
2020-11-07 13:09:18 -06:00
luigi1111
81f9fa947b Merge pull request #6994
6f48a14 Fix i2p/tor seed nodes (vtnerd)
2020-11-07 13:08:00 -06:00
selsta
752837b2c8 build: prepare v0.17.1.3 2020-11-07 18:19:08 +01:00
xiphon
981e0b5cc3 epee: readline_buffer - fix thread safety, fix sync() after stop() 2020-11-07 15:32:02 +00:00
Lee Clagett
6f48a146f8 Fix i2p/tor seed nodes 2020-11-07 00:37:49 -05:00
luigi1111
1a3bef15b9 Merge pull request #6993
44c93bb p2p: fix accessing non existent element of map (moneromooo-monero)
2020-11-06 18:53:22 -06:00
moneromooo-monero
44c93bb47a p2p: fix accessing non existent element of map 2020-11-07 00:17:47 +00:00
luigi1111
c3fc96f0cf Merge pull request #6992
f3dd25c build: prepare v0.17.1.2 (selsta)
2020-11-06 17:34:32 -06:00
luigi1111
07f6ecd227 Merge pull request #6991
4985afd p2p: add a tor seed (moneromooo-monero)
2020-11-06 17:32:28 -06:00
moneromooo-monero
4985afddb3 p2p: add a tor seed 2020-11-06 23:21:10 +00:00
luigi1111
4191dc8981 Merge pull request #6990
263579b Add support for i2p and tor seed nodes (vtnerd)
2020-11-06 17:15:11 -06:00
luigi1111
32581fb223 Merge pull request #6985
91f1be9 net_node: add tor / i2p seed nodes (selsta)
2020-11-06 17:12:42 -06:00
selsta
f3dd25c0e0 build: prepare v0.17.1.2 2020-11-07 00:12:39 +01:00
luigi1111
33dc825d6f Merge pull request #6983
35186b1 p2p: fix endianness when checking IPv6 addresses mapping to IPv4 (moneromooo-monero)
2020-11-05 19:09:43 -06:00
selsta
91f1be9ea2 net_node: add tor / i2p seed nodes 2020-11-05 21:41:11 +01:00
moneromooo-monero
35186b1b84 p2p: fix endianness when checking IPv6 addresses mapping to IPv4 2020-11-05 16:05:54 +00:00
luigi1111
bddd5653e1 Merge pull request #6981
b36c4f3 p2p: make this work with boost <= 1.65 (pffff) (moneromooo-monero)
2020-11-04 20:57:49 -06:00
moneromooo-monero
b36c4f354b p2p: make this work with boost <= 1.65 (pffff) 2020-11-04 23:01:47 +00:00
luigi1111
1ba4c8dbc2 Merge pull request #6979
92d19c4 p2p: rewrite boost's make_address_v4 to cater for < 1.66 (moneromooo-monero)
2020-11-04 16:28:43 -06:00
moneromooo
92d19c48da p2p: rewrite boost's make_address_v4 to cater for < 1.66 2020-11-04 20:26:50 +00:00
luigi1111
01606ee52e Merge pull request #6974
58cde83 Switch to Dandelion++ fluff mode if no out connections for stem mode (vtnerd)
2020-11-04 10:40:49 -06:00
luigi1111
81d2389c24 Merge pull request #6972
8965489 protocol: reject empty incoming block messages (moneromooo-monero)
2020-11-04 10:39:53 -06:00
luigi1111
ef64c4e22f Merge pull request #6967
fa63d4b Fix tx flush callback queueing (vtnerd)
2020-11-04 10:38:08 -06:00
luigi1111
7fa01f342c Merge pull request #6966
42403c7 Fix CLI and unrestricted RPC relay_tx with stempool (vtnerd)
2020-11-04 10:37:18 -06:00
luigi1111
4603ec9765 Merge pull request #6962
1a627e1 p2p: use /16 filtering on IPv4-within-IPv6 addresses (moneromooo-monero)
2020-11-04 10:36:23 -06:00
luigi1111
0be71bcea9 Merge pull request #6961
f55f3fe net_node: add --ban-list option (selsta)
2020-11-04 10:35:07 -06:00
moneromooo-monero
1a627e1f89 p2p: use /16 filtering on IPv4-within-IPv6 addresses
IPv6 addresses include a range that can map IPv4 addresses,
which allowed those mapped addresses to bypass filtering.

This filter should be replaced by AS filtering at some point.
2020-11-03 17:36:25 +00:00
luigi1111
c1229a4432 Merge pull request #6965
d695340 rpc: on_send_raw_tx (bootstrap) - send to bootstrap daemon and P2P (xiphon)
2020-11-03 11:23:17 -06:00
luigi1111
9f68111b69 Merge pull request #6964
5090cdc p2p: remove banned peers from the white list (moneromooo-monero)
2020-11-03 11:22:27 -06:00
luigi1111
d1e79f2086 Merge pull request #6963
df1061c p2p: give all hosts the same chance of being picked for connecting (moneromooo-monero)
2020-11-03 11:21:26 -06:00
moneromooo-monero
8965489acb protocol: reject empty incoming block messages 2020-11-03 13:08:19 +00:00
xiphon
d6953406c9 rpc: on_send_raw_tx (bootstrap) - send to bootstrap daemon and P2P 2020-11-02 19:47:54 +00:00
moneromooo
5090cdc9f5 p2p: remove banned peers from the white list 2020-11-02 19:03:12 +00:00
moneromooo
df1061c87d p2p: give all hosts the same chance of being picked for connecting
even if some run more than one node
2020-11-02 19:01:43 +00:00
selsta
f55f3fe81c net_node: add --ban-list option 2020-11-02 17:26:02 +01:00
Lee Clagett
9b7ed2fd8b Change Dandelion++ fluff probability to 20%, and embargo timeout to 39s
A 20% fluff probability increases the precision of a spy connected to
every node by 10% on average, compared to a network using 0% fluff
probability. The current value (10% fluff) should increase precision by
~5% compared to baseline.

This decreases the expected stem length from 10 to 5. The embargo
timeout was therefore lowered to 39s; the fifth node in a stem is
expected to have a 90% chance of being the first to timeout, which is
the same probability we currently have with an expected stem length of
10 nodes.
2020-10-21 13:11:07 +00:00
Lee Clagett
e8468c5dcf Fix timeout checks for forwarded and Dandelion++ stem txes 2020-10-21 00:02:11 +00:00
Riccardo Spagni
76cc82c292 Merge pull request #6916
81aaa4ec7 bump default number of connections from 8 to 12 (moneromooo-monero)
2020-10-18 17:40:24 +02:00
Riccardo Spagni
81a23c73d2 Merge pull request #6914
f9a9d2ee2 wallet2: wait for propagation timeout before marking tx as failed (xiphon)
2020-10-18 17:40:05 +02:00
Riccardo Spagni
4b86583492 Merge pull request #6912
6e594e53b Allow setting start block on export (Howard Chu)
2020-10-18 17:39:43 +02:00
Riccardo Spagni
30918a27ab Merge pull request #6907
39e30d548 wallet2_api: implement stop() to interrupt refresh() loop once (xiphon)
2020-10-18 17:38:47 +02:00
Riccardo Spagni
940b042e28 Merge pull request #6911
c028f4c4d build: prepare v0.17.1.1 (selsta)
2020-10-18 17:25:33 +02:00
selsta
c028f4c4d8 build: prepare v0.17.1.1 2020-10-18 16:11:37 +02:00
xiphon
f9a9d2ee28 wallet2: wait for propagation timeout before marking tx as failed 2020-10-18 13:59:54 +00:00
moneromooo-monero
81aaa4ec7b bump default number of connections from 8 to 12 2020-10-18 13:25:38 +00:00
Howard Chu
6e594e53bb Allow setting start block on export
And make import honor the starting block# recorded in a bootstrap file
2020-10-18 14:02:30 +01:00
Alexander Blair
e88b9170db Merge pull request #6906
1120df3c5 blockchain: fix sync at v14 boundary (moneromooo-monero)
2020-10-18 05:55:36 -07:00
xiphon
39e30d5481 wallet2_api: implement stop() to interrupt refresh() loop once 2020-10-18 11:59:23 +00:00
moneromooo-monero
1120df3c53 blockchain: fix sync at v14 boundary
Miners with MLSAG txes which they'd already verified included
a couple in that block, but the consensus rules had changed
in the meantime, so that block is technically invalid and any
node which did not already have those two txes in their txpool
could not sync. Grandfather them in, since it has no effect in
practice.
2020-10-18 11:50:32 +00:00
Lee Clagett
42403c7acc Fix CLI and unrestricted RPC relay_tx with stempool 2020-10-14 13:02:27 +00:00
Lee Clagett
fa63d4b3f0 Fix tx flush callback queueing 2020-10-14 13:01:34 +00:00
luigi1111
4d855fcca7 Merge pull request #6894
e49ad98 fix next_seed_height regression in getblocktemplate rpc (xnbya)
2020-10-13 10:54:21 -05:00
luigi1111
8ae0110d54 Merge pull request #6893
4cf3545 core_rpc_server: on_get_blocks - forward bootstrap daemon error (xiphon)
2020-10-13 10:53:20 -05:00
luigi1111
a9178e3584 Merge pull request #6888
a2e37eb build: prepare v0.17.1.0 (selsta)
2020-10-13 10:51:07 -05:00
luigi1111
bbe6ee39e5 Merge pull request #6887
518a2cd Force CMAKE_SKIP_RPATH=ON (hyc)
2020-10-13 10:49:58 -05:00
luigi1111
94a86cf855 Merge pull request #6884
6352090 Dandelion++: skip desynced peers in stem phase (xiphon)
2020-10-13 10:48:00 -05:00
luigi1111
745d90c4a4 Merge pull request #6883
c407b92 wallet2: fix missing m_state field in wallet serialization (moneromooo-monero)
2020-10-13 10:46:37 -05:00
luigi1111
e60be2289e Merge pull request #6880
250c48a tx_pool: silence spammy harmless warning till we fix the bug (moneromooo-monero)
2020-10-13 10:45:26 -05:00
luigi1111
5ef94b29c3 Merge pull request #6870
826a844 cmake: Version - use CMAKE_CURRENT_LIST_DIR (xiphon)
2020-10-13 10:43:31 -05:00
luigi1111
33281c1e2e Merge pull request #6869
b4c7756 cmake: CheckTrezor - use ${CMAKE_CURRENT_LIST_DIR} to locate tests (xiphon)
2020-10-13 10:42:08 -05:00
Howard Chu
518a2cdab4 Force CMAKE_SKIP_RPATH=ON
Fix empty RPATH token issue. Only affects Linux and FreeBSD.
2020-10-13 14:22:50 +01:00
luigi1111
8235854e8a Merge pull request #6868
4665906 Fix lgamma/signgam dependency (hyc)
2020-10-12 20:21:18 -05:00
xiphon
4cf3545a31 core_rpc_server: on_get_blocks - forward bootstrap daemon error 2020-10-13 00:44:59 +00:00
selsta
a2e37eb3d8 build: prepare v0.17.1.0 2020-10-13 01:13:06 +02:00
xiphon
6352090e6d Dandelion++: skip desynced peers in stem phase 2020-10-12 16:39:40 +00:00
moneromooo-monero
c407b92e80 wallet2: fix missing m_state field in wallet serialization 2020-10-12 15:35:37 +00:00
moneromooo-monero
250c48a289 tx_pool: silence spammy harmless warning till we fix the bug 2020-10-12 13:41:12 +00:00
Alexis Enston
e49ad98a9b fix next_seed_height regression in getblocktemplate rpc 2020-10-12 14:08:35 +01:00
Lee Clagett
37bb59485f Do not use peer_id tracking method over i2p/tor 2020-10-11 13:19:25 +00:00
Lee Clagett
263579b217 Add support for i2p and tor seed nodes 2020-10-09 14:07:40 +00:00
Howard Chu
4665906ddd Fix lgamma/signgam dependency
This is a new indirect dependency due to the use of poisson_distribution,
introduced in PR#6354 commit 67ade8005
2020-10-08 02:08:00 +01:00
xiphon
826a84478d cmake: Version - use CMAKE_CURRENT_LIST_DIR 2020-10-07 20:21:25 +00:00
xiphon
b4c775663a cmake: CheckTrezor - use ${CMAKE_CURRENT_LIST_DIR} to locate tests 2020-10-06 14:37:00 +00:00
Lee Clagett
58cde83fb0 Switch to Dandelion++ fluff mode if no out connections for stem mode 2020-10-06 13:52:01 +00:00
luigi1111
1a9a984d26 Merge pull request #6845
0473abf link libzmq against libgssapi_krb5 if found (moneromooo-monero)
2020-09-25 18:19:47 -05:00
luigi1111
05405024c0 Merge pull request #6843
c02d24f build: prepare v0.17.0.1 (selsta)
2020-09-25 18:18:51 -05:00
luigi1111
d65f9a3064 Merge pull request #6842
9e6187a fix a couple bugs found by OSS-fuzz (moneromooo-monero)
2020-09-25 18:17:53 -05:00
luigi1111
d39f8237e0 Merge pull request #6835
4846743 daemon: Windows - fix FAT32 warning, trailing backslash is required (xiphon)
2020-09-25 18:16:19 -05:00
moneromooo-monero
0473abf51d link libzmq against libgssapi_krb5 if found 2020-09-25 14:38:12 +00:00
selsta
c02d24f838 build: prepare v0.17.0.1 2020-09-25 02:15:13 +02:00
moneromooo-monero
9e6187a736 fix a couple bugs found by OSS-fuzz
- index out of bounds when importing outputs
- accessing invalid CLSAG data
2020-09-24 15:33:40 +00:00
xiphon
4846743fdc daemon: Windows - fix FAT32 warning, trailing backslash is required 2020-09-20 13:57:44 +00:00
265 changed files with 8172 additions and 284518 deletions

View File

@@ -1,10 +0,0 @@
---
kind: pipeline
type: docker
name: linux-build
steps:
- name: linux-build
image: wownero/wow-dependencies:v1.0
commands:
- make release-static-linux-x86_64

1
.github/FUNDING.yml vendored
View File

@@ -1 +0,0 @@
custom: https://dev-funding.webui.wowkira.com

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: eine/setup-msys2@v1
- uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git

3
.gitignore vendored
View File

@@ -23,7 +23,6 @@ cscope.po.out
external/miniupnpc/Makefile
miniupnpcstrings.h
version/
ClangBuildAnalyzerSession.txt
# Created by https://www.gitignore.io
### C++ ###
@@ -110,3 +109,5 @@ nbproject
/testnet
__pycache__/
*.pyc
*.log

16
.gitmodules vendored
View File

@@ -1,19 +1,19 @@
[submodule "external/unbound"]
path = external/unbound
url = https://git.wownero.com/wownero/unbound
url = https://github.com/monero-project/unbound
branch = monero
[submodule "external/miniupnp"]
path = external/miniupnp
url = https://git.wownero.com/wownero/miniupnp
url = https://github.com/monero-project/miniupnp
branch = monero
[submodule "external/rapidjson"]
path = external/rapidjson
url = https://git.wownero.com/wownero/rapidjson
url = https://github.com/Tencent/rapidjson
[submodule "external/supercop"]
path = external/supercop
url = https://github.com/monero-project/supercop
branch = monero
[submodule "external/RandomWOW"]
path = external/RandomWOW
url = https://git.wownero.com/wownero/RandomWOW
branch = 1.1.8-wow
[submodule "external/supercop"]
path = external/supercop
url = https://git.wownero.com/wownero/supercop
branch = monero
branch = 1.1.9-wow

View File

@@ -36,10 +36,6 @@ with additional exclusive IPv4 address(es).
## Usage
Anonymity networks have no seed nodes (the feature is still considered
experimental), so a user must specify an address. If configured properly,
additional peers can be found through typical p2p peerlist sharing.
### Outbound Connections
Connecting to an anonymous address requires the command line option
@@ -54,8 +50,9 @@ separate process. On most systems the configuration will look like:
which tells `monerod` that ".onion" p2p addresses can be forwarded to a socks
proxy at IP 127.0.0.1 port 9050 with a max of 10 outgoing connections and
".b32.i2p" p2p addresses can be forwarded to a socks proxy at IP 127.0.0.1 port
9000 with the default max outgoing connections. Since there are no seed nodes
for anonymity connections, peers must be manually specified:
9000 with the default max outgoing connections.
If desired, peers can be manually specified:
```
--add-exclusive-node rveahdfho7wo4b2m.onion:28083

View File

@@ -54,13 +54,6 @@ if (USE_CCACHE)
else()
message(STATUS "ccache deselected")
endif()
option (USE_COMPILATION_TIME_PROFILER "Use compilation time profiler (for CLang >= 9 only)" OFF)
if (USE_COMPILATION_TIME_PROFILER)
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
message(FATAL_ERROR "The flag USE_COMPILATION_TIME_PROFILER is meant to be set only for CLang compiler!")
endif()
add_compile_options("-ftime-trace")
endif()
# Job pool feature requires Ninja.
if (${CMAKE_VERSION} VERSION_GREATER "3.0.0")
@@ -75,20 +68,6 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.0.0")
set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${WOWNERO_PARALLEL_LINK_JOBS})
set(CMAKE_JOB_POOL_LINK link_job_pool)
endif ()
endif ()
option (USE_CLANG_TIDY_C "Lint the code with clang-tidy - variant C" OFF)
option (USE_CLANG_TIDY_CXX "Lint the code with clang-tidy - variant C++" OFF)
if (USE_CLANG_TIDY_C AND USE_CLANG_TIDY_CXX)
message(FATAL_ERROR "Enabling both USE_CLANG_TIDY_C and USE_CLANG_TIDY_CXX simultaneously crashes clang-tidy.")
endif()
if (USE_CLANG_TIDY_C OR USE_CLANG_TIDY_CXX)
include(SetClangTidy)
endif()
if (USE_CLANG_TIDY_C)
monero_clang_tidy("C")
elseif (USE_CLANG_TIDY_CXX)
monero_clang_tidy("CXX")
endif()
enable_language(C ASM)
@@ -107,16 +86,18 @@ function (die msg)
endfunction ()
function (add_c_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_c)
check_c_compiler_flag(${flag} ${supported})
set(TMP "-Werror ${flag}")
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c)
check_c_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_cxx_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_cxx)
check_cxx_compiler_flag(${flag} ${supported})
set(TMP "-Werror ${flag}")
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx)
check_cxx_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
@@ -147,23 +128,65 @@ function (add_definition_if_library_exists library function header var)
endif()
endfunction()
option(RELINK_TARGETS "Relink targets, when just a dependant .so changed, but not its header?" OFF)
function (monero_set_target_no_relink target)
if (RELINK_TARGETS MATCHES OFF)
# Will not relink the target, when just its dependant .so has changed, but not it's interface
set_target_properties("${target}" PROPERTIES LINK_DEPENDS_NO_SHARED true)
endif()
# Function to forbid undefined symbols and also verify
# 1) Test project with all types of libraries and without undefined symbols can compile successfully
# 2) Test project with all types of libraries and undefined symbols can not compile successfully
function(forbid_undefined_symbols)
unset(TMP)
# https://www.unix.com/man-page/linux/1/ld, --no-undefined, Report unresolved symbol references from regular object files.
add_linker_flag_if_supported(-Wl,--no-undefined TMP)
# https://www.unix.com/man-page/osx/1/ld/, -undefined, Specifies how undefined symbols are to be treated.
add_linker_flag_if_supported(-Wl,-undefined,error TMP)
string(APPEND CMAKE_SHARED_LINKER_FLAGS ${TMP})
string(APPEND CMAKE_MODULE_LINKER_FLAGS ${TMP})
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} PARENT_SCOPE)
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_project")
foreach(EXPECT IN ITEMS TRUE FALSE)
file(REMOVE_RECURSE "${TEST_PROJECT}")
file(MAKE_DIRECTORY "${TEST_PROJECT}")
file(WRITE "${TEST_PROJECT}/CMakeLists.txt"
[=[
cmake_minimum_required(VERSION 3.1)
project(test)
option(EXPECT_SUCCESS "" ON)
file(WRITE "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" "void undefined_symbol(); void symbol() { undefined_symbol(); }")
if (EXPECT_SUCCESS)
file(APPEND "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" " void undefined_symbol() {}; ")
endif()
add_library(l0 SHARED incorrect_source.cpp)
add_library(l1 MODULE incorrect_source.cpp)
add_library(l2 STATIC incorrect_source.cpp)
add_library(l3 OBJECT incorrect_source.cpp)
]=]
)
try_compile(SUCCESS "${TEST_PROJECT}/build" "${TEST_PROJECT}" test
CMAKE_FLAGS
"-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}"
"-DCMAKE_MODULE_LINKER_FLAGS=${CMAKE_MODULE_LINKER_FLAGS}"
"-DEXPECT_SUCCESS=${EXPECT}"
)
if (NOT ${SUCCESS} STREQUAL ${EXPECT})
message(FATAL_ERROR "Undefined symbols test failure: expect(${EXPECT}), success(${SUCCESS})")
endif()
file(REMOVE_RECURSE "${TEST_PROJECT}")
endforeach()
endfunction()
if (NOT (CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*"))
forbid_undefined_symbols()
endif()
function (monero_add_minimal_executable name)
source_group("${name}"
FILES
${ARGN})
add_executable("${name}"
${ARGN})
monero_set_target_no_relink( ${name} )
endfunction()
if (MINGW)
function(export_all_symbols)
unset(TMP)
add_linker_flag_if_supported(-Wl,--export-all-symbols TMP)
string(APPEND CMAKE_SHARED_LINKER_FLAGS ${TMP})
string(APPEND CMAKE_MODULE_LINKER_FLAGS ${TMP})
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} PARENT_SCOPE)
endfunction()
export_all_symbols()
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
@@ -457,7 +480,7 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
set(DEFAULT_STACK_TRACE ON)
set(STACK_TRACE_LIB "easylogging++") # for diag output only
set(LIBUNWIND_LIBRARIES "")
elseif (ARM)
elseif (ARM AND STATIC)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
else()
@@ -511,6 +534,10 @@ if(STATIC AND NOT IOS)
endif()
endif()
if (WIN32)
list(APPEND OPENSSL_LIBRARIES ws2_32 crypt32)
endif()
find_package(HIDAPI)
add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S)
@@ -563,6 +590,17 @@ endif()
# Trezor support check
include(CheckTrezor)
# As of OpenBSD 6.8, -march=<anything> breaks the build
function(set_default_arch)
if (OPENBSD)
set(ARCH default)
else()
set(ARCH native)
endif()
set(ARCH ${ARCH} CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endfunction()
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -576,7 +614,7 @@ if(MSVC)
else()
include(TestCXXAcceptsFlag)
if (NOT ARCH)
set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
set_default_arch()
endif()
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default")

View File

@@ -1,28 +1,18 @@
ARG DEBIAN_VERSION="${DEBIAN_VERSION:-stable-slim}"
FROM debian:${DEBIAN_VERSION} as git-wow
# Multistage docker build, requires docker 17.05
WORKDIR /data
# builder stage
FROM ubuntu:16.04 as builder
#Cmake
ARG CMAKE_VERSION=3.14.6
ARG CMAKE_VERSION_DOT=v3.14
ARG CMAKE_HASH=4e8ea11cabe459308671b476469eace1622e770317a15951d7b55a82ccaaccb9
## Boost
ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
ENV CFLAGS='-fPIC -O2 -g'
ENV CXXFLAGS='-fPIC -O2 -g'
ENV LDFLAGS='-static-libstdc++'
ENV BASE_DIR /usr/local
RUN apt-get update -qq && apt-get --no-install-recommends -yqq install \
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install \
ca-certificates \
cmake \
g++ \
make \
pkg-config \
graphviz \
doxygen \
git \
curl \
libtool-bin \
@@ -31,193 +21,191 @@ RUN apt-get update -qq && apt-get --no-install-recommends -yqq install \
bzip2 \
xsltproc \
gperf \
unzip > /dev/null \
&& cd /data || exit 1 \
&& echo "\e[32mbuilding: Cmake\e[39m" \
&& set -ex \
&& curl -s -O https://cmake.org/files/${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION}.tar.gz > /dev/null \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf cmake-${CMAKE_VERSION}.tar.gz > /dev/null \
&& cd cmake-${CMAKE_VERSION} || exit 1 \
&& echo "\e[32mmatrix style build text redirected to /dev/null. This will take some time. Go ahead make some coffee and check your emails.\e[39m" \
&& ./configure --prefix=$BASE_DIR > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/cmake-${CMAKE_VERSION} \
&& rm -rf /data/cmake-${CMAKE_VERSION}.tar.gz \
&& echo "\e[32mbuilding: Boost\e[39m" \
&& set -ex \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 > /dev/null \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 > /dev/null \
&& cd boost_${BOOST_VERSION} || exit 1 \
&& ./bootstrap.sh > /dev/null \
&& ./b2 -a install --prefix=$BASE_DIR --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale threading=multi threadapi=pthread cflags="$CFLAGS" cxxflags="$CXXFLAGS" stage > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/boost_${BOOST_VERSION} \
&& rm -rf /data/boost_${BOOST_VERSION}.tar.bz2
unzip
WORKDIR /data
ENV BASE_DIR /usr/local
WORKDIR /usr/local
ENV CFLAGS='-fPIC'
ENV CXXFLAGS='-fPIC'
#Cmake
ARG CMAKE_VERSION=3.14.6
ARG CMAKE_VERSION_DOT=v3.14
ARG CMAKE_HASH=4e8ea11cabe459308671b476469eace1622e770317a15951d7b55a82ccaaccb9
RUN set -ex \
&& curl -s -O https://cmake.org/files/${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION}.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf cmake-${CMAKE_VERSION}.tar.gz \
&& cd cmake-${CMAKE_VERSION} \
&& ./configure \
&& make \
&& make install
## Boost
ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
RUN set -ex \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \
&& ./bootstrap.sh \
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale threading=multi threadapi=pthread cflags="$CFLAGS" cxxflags="$CXXFLAGS" stage
ENV BOOST_ROOT /usr/local/boost_${BOOST_VERSION}
# OpenSSL
ARG OPENSSL_VERSION=1.1.1
ARG OPENSSL_FIX=g
ARG OPENSSL_VERSION=1.1.1g
ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
RUN set -ex \
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
&& cd openssl-${OPENSSL_VERSION} \
&& ./Configure linux-x86_64 no-shared --static "$CFLAGS" \
&& make build_generated \
&& make libcrypto.a \
&& make install
ENV OPENSSL_ROOT_DIR=/usr/local/openssl-${OPENSSL_VERSION}
# ZMQ
ARG ZMQ_VERSION=v4.3.2
ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
RUN set -ex \
&& git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
&& cd libzmq \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh \
&& ./configure --enable-static --disable-shared \
&& make \
&& make install \
&& ldconfig
# zmq.hpp
ARG CPPZMQ_VERSION=v4.4.1
ARG CPPZMQ_HASH=f5b36e563598d48fcc0d82e589d3596afef945ae
RUN set -ex \
&& git clone https://github.com/zeromq/cppzmq.git -b ${CPPZMQ_VERSION} \
&& cd cppzmq \
&& test `git rev-parse HEAD` = ${CPPZMQ_HASH} || exit 1 \
&& mv *.hpp /usr/local/include
# Readline
ARG READLINE_VERSION=8.0
ARG READLINE_HASH=e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461
RUN set -ex \
&& curl -s -O https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz \
&& echo "${READLINE_HASH} readline-${READLINE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf readline-${READLINE_VERSION}.tar.gz \
&& cd readline-${READLINE_VERSION} \
&& ./configure \
&& make \
&& make install
# Sodium
ARG SODIUM_VERSION=1.0.18
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
ENV CFLAGS='-fPIC -O2 -g'
ENV CXXFLAGS='-fPIC -O2 -g'
ENV LDFLAGS='-static-libstdc++'
RUN echo "\e[32mbuilding: Openssl\e[39m" \
&& set -ex \
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz > /dev/null \
# && curl -s -O https://www.openssl.org/source/old/${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz > /dev/null \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz > /dev/null \
&& cd openssl-${OPENSSL_VERSION}${OPENSSL_FIX} || exit 1 \
&& ./Configure --prefix=$BASE_DIR linux-x86_64 no-shared --static "$CFLAGS" > /dev/null \
&& make build_generated > /dev/null \
&& make libcrypto.a > /dev/null \
&& echo "\e[32mblah, blah, shared libraries from the glib, something, something. Don't worry about it.\e[39m" \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/openssl-${OPENSSL_VERSION}${OPENSSL_FIX} \
&& rm -rf /data/openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz \
&& echo "\e[32mbuilding: ZMQ\e[39m" \
&& set -ex \
&& git clone --branch ${ZMQ_VERSION} --single-branch --depth 1 https://github.com/zeromq/libzmq.git > /dev/null \
&& cd libzmq || exit 1 \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh > /dev/null \
&& ./configure --prefix=$BASE_DIR --enable-libunwind=no --enable-static --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& ldconfig > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/libzmq \
&& echo "\e[32mbuilding: zmq.hpp\e[39m" \
&& set -ex \
&& git clone --branch ${CPPZMQ_VERSION} --single-branch --depth 1 https://github.com/zeromq/cppzmq.git > /dev/null \
&& cd cppzmq || exit 1 \
&& test `git rev-parse HEAD` = ${CPPZMQ_HASH} || exit 1 \
&& mv *.hpp $BASE_DIR/include \
&& cd /data || exit 1 \
&& rm -rf /data/cppzmq \
&& echo "\e[32mbuilding: Readline\e[39m" \
&& set -ex \
&& curl -s -O https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz > /dev/null \
&& echo "${READLINE_HASH} readline-${READLINE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf readline-${READLINE_VERSION}.tar.gz > /dev/null \
&& cd readline-${READLINE_VERSION} || exit 1 \
&& ./configure --prefix=$BASE_DIR > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/readline-${READLINE_VERSION} \
&& rm -rf readline-${READLINE_VERSION}.tar.gz \
&& echo "\e[32mbuilding: Sodium\e[39m" \
&& set -ex \
&& git clone --branch ${SODIUM_VERSION} --single-branch --depth 1 https://github.com/jedisct1/libsodium.git > /dev/null \
&& cd libsodium || exit 1 \
RUN set -ex \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} \
&& cd libsodium \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \
&& ./configure --prefix=$BASE_DIR > /dev/null \
&& make > /dev/null \
&& make check > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/libsodium
WORKDIR /data
ENV BASE_DIR /usr/local
&& ./configure \
&& make \
&& make check \
&& 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 \
&& test `git rev-parse HEAD` = ${UDEV_HASH} || exit 1 \
&& ./autogen.sh \
&& ./configure --disable-gudev --disable-introspection --disable-hwdb --disable-manpages --disable-shared \
&& make \
&& make install
# Libusb
ARG USB_VERSION=v1.0.22
ARG USB_HASH=0034b2afdcdb1614e78edaa2a9e22d5936aeae5d
RUN set -ex \
&& git clone https://github.com/libusb/libusb.git -b ${USB_VERSION} \
&& cd libusb \
&& test `git rev-parse HEAD` = ${USB_HASH} || exit 1 \
&& ./autogen.sh \
&& ./configure --disable-shared \
&& make \
&& make install
# Hidapi
ARG HIDAPI_VERSION=hidapi-0.8.0-rc1
ARG HIDAPI_HASH=40cf516139b5b61e30d9403a48db23d8f915f52c
RUN set -ex \
&& git clone https://github.com/signal11/hidapi -b ${HIDAPI_VERSION} \
&& cd hidapi \
&& test `git rev-parse HEAD` = ${HIDAPI_HASH} || exit 1 \
&& ./bootstrap \
&& ./configure --enable-static --disable-shared \
&& make \
&& make install
# Protobuf
ARG PROTOBUF_VERSION=v3.7.1
ARG PROTOBUF_HASH=6973c3a5041636c1d8dc5f7f6c8c1f3c15bc63d6
ENV CFLAGS='-fPIC -O2 -g'
ENV CXXFLAGS='-fPIC -O2 -g'
ENV LDFLAGS='-static-libstdc++'
RUN echo "\e[32mbuilding: Udev\e[39m" \
&& set -ex \
&& git clone --branch ${UDEV_VERSION} --single-branch --depth 1 https://github.com/gentoo/eudev > /dev/null \
&& cd eudev || exit 1 \
&& test `git rev-parse HEAD` = ${UDEV_HASH} || exit 1 \
&& ./autogen.sh \
&& ./configure --prefix=$BASE_DIR --disable-gudev --disable-introspection --disable-hwdb --disable-manpages --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/eudev \
&& echo "\e[32mbuilding: Libusb. Ahh, a dependency that shouldn't have been included in the codebase. Hardware wallets are way overrated.\e[39m" \
&& set -ex \
&& git clone --branch ${USB_VERSION} --single-branch --depth 1 https://github.com/libusb/libusb.git > /dev/null \
&& cd libusb || exit 1 \
&& test `git rev-parse HEAD` = ${USB_HASH} || exit 1 \
&& ./autogen.sh > /dev/null \
&& ./configure --prefix=$BASE_DIR --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/libusb \
&& echo "\e[32mbuilding: Hidapi\e[39m" \
&& set -ex \
&& git clone --branch ${HIDAPI_VERSION} --single-branch --depth 1 https://github.com/signal11/hidapi > /dev/null \
&& cd hidapi || exit 1 \
&& test `git rev-parse HEAD` = ${HIDAPI_HASH} || exit 1 \
&& ./bootstrap \
&& ./configure --prefix=$BASE_DIR --enable-static --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/hidapi \
&& echo "\e[32mbuilding: Protobuf <- fuck you protobuf, you worthless piece of shit!\e[39m" \
&& set -ex \
&& git clone --branch ${PROTOBUF_VERSION} --single-branch --depth 1 https://github.com/protocolbuffers/protobuf > /dev/null \
&& cd protobuf || exit 1 \
RUN set -ex \
&& git clone https://github.com/protocolbuffers/protobuf -b ${PROTOBUF_VERSION} \
&& cd protobuf \
&& test `git rev-parse HEAD` = ${PROTOBUF_HASH} || exit 1 \
&& git submodule update --init --recursive > /dev/null \
&& ./autogen.sh > /dev/null \
&& ./configure --prefix=$BASE_DIR --enable-static --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& ldconfig \
&& cd /data || exit 1 \
&& rm -rf /data/protobuf
&& git submodule update --init --recursive \
&& ./autogen.sh \
&& ./configure --enable-static --disable-shared \
&& make \
&& make install \
&& ldconfig
WORKDIR /src
COPY . .
WORKDIR /home
ENV USE_SINGLE_BUILDDIR=1
ARG NPROC
RUN set -ex && \
git submodule init && git submodule update && \
rm -rf build && \
if [ -z "$NPROC" ] ; \
then make -j$(nproc) release-static ; \
else make -j$NPROC release-static ; \
fi
# runtime stage
FROM ubuntu:16.04
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt
COPY --from=builder /src/build/release/bin /usr/local/bin/
# Create wownero user
RUN adduser --system --group --disabled-password wownero && \
mkdir -p /wallet /home/wownero/.wownero && \
chown -R wownero:wownero /home/wownero/.wownero && \
chown -R wownero:wownero /wallet
# Contains the blockchain
VOLUME /home/wownero/.wownero
# Generate your wallet via accessing the container and run:
# cd /wallet
# wownero-wallet-cli
VOLUME /wallet
EXPOSE 34567
EXPOSE 34568
# Wownero
RUN echo "\e[32mbuilding: Wownero\e[39m" \
&& set -ex \
&& git clone https://git.wownero.com/wownero/wownero \
&& cd wownero \
&& make -j2 release-static-linux-x86_64 \
&& echo "\e[32mdone building Wownero, binaries located in: /home/wownero/build/release/bin\e[39m"
# switch to user wownero
USER wownero
ENTRYPOINT ["wownerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=34567", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=34568", "--non-interactive", "--confirm-external-bind"]

View File

@@ -1,4 +1,4 @@
Copyright (c) 2014-2021, The Monero Project
Copyright (c) 2014-2020, The Monero Project
All rights reserved.

View File

@@ -1,64 +0,0 @@
# Maintainer: wowario <wowario[at]protonmail[dot]com>
pkgname=wownero-git
pkgver=0.8.0.0
pkgrel=1
pkgdesc="Wownero: a fairly launched privacy-centric meme coin with no premine and a finite supply"
license=('BSD')
arch=('x86_64')
url="https://wownero.org/"
depends=('boost-libs' 'libunwind' 'openssl' 'readline' 'zeromq' 'pcsclite' 'hidapi' 'protobuf')
makedepends=('git' 'cmake' 'boost')
source=(
"${pkgname}"::"git+https://github.com/wownero/wownero#tag=v${pkgver}"
"git+https://github.com/monero-project/unbound.git"
"git+https://github.com/monero-project/miniupnp.git"
"git+https://github.com/Tencent/rapidjson.git"
"git+https://github.com/trezor/trezor-common.git"
"git+https://github.com/wownero/RandomWOW.git"
"wownero.sysusers"
"wownero.tmpfiles")
sha512sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP')
prepare() {
cd "${pkgname}"
git submodule init
git config submodule.external/unbound.url "$srcdir/unbound"
git config submodule.external/miniupnp.url "$srcdir/miniupnp"
git config submodule.external/rapidjson.url "$srcdir/rapidjson"
git config submodule.external/RandomWOW.url "$srcdir/RandomWOW"
git submodule update
}
build() {
cd "${pkgname}"
mkdir -p build && cd build
cmake -D BUILD_TESTS=OFF -D CMAKE_BUILD_TYPE=release -D ARCH=default ../
make
}
package() {
backup=('etc/wownerod.conf')
cd "${pkgname}"
install -Dm644 "LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
install -Dm644 "utils/conf/wownerod.conf" "${pkgdir}/etc/wownerod.conf"
install -Dm644 "utils/systemd/wownerod.service" "${pkgdir}/usr/lib/systemd/system/wownerod.service"
install -Dm644 "../wownero.sysusers" "${pkgdir}/usr/lib/sysusers.d/wownero.conf"
install -Dm644 "../wownero.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/wownero.conf"
install -Dm755 "build/bin/wownero-wallet-cli" \
"build/bin/wownero-wallet-rpc" \
"build/bin/wownerod" \
-t "${pkgdir}/usr/bin"
}
# vim: ts=2 sw=2 et:

118
README.md
View File

@@ -1,11 +1,11 @@
[![Build Status](https://ci.wownero.com/api/badges/wownero/wownero/status.svg)](https://ci.wownero.com/wownero/wownero)
# ~~Mo~~Wownero - Such privacy! Many coins! Wow! 🐕
Copyright (c) 2014-2021 The Monero Project.
Copyright (c) 2014-2023 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Resources
- IRC: [OFTC #wownero](https://webchat.oftc.net/?channels=wownero)
- Web: [wownero.org](https://wownero.org)
- Twitter: [@w0wn3r0](https://twitter.com/w0wn3r0)
- Reddit: [/r/wownero](https://www.reddit.com/r/wownero)
@@ -13,22 +13,24 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
- Git: [git.wownero.com/wownero/wownero](https://git.wownero.com/wownero/wownero)
- Wownero Funding System: [funding.wownero.com](https://funding.wownero.com)
- Wownero Forum: [forum.wownero.com](https://forum.wownero.com)
- Discord: [discord.gg/ENbgme4bWq](https://discord.com/invite/ENbgme4bWq)
- Discord: [discord.gg/ykZyAzJhDK](https://discord.com/invite/ykZyAzJhDK)
- Telegram: [t.me/wownero](https://t.me/wownero)
- Feather-WOW Desktop Wallet: [featherwallet.org/wownero](https://featherwallet.org/wownero)
- WOW Stash Web Wallet: [wowstash.app](https://wowstash.app)
- Wowlet Desktop Wallet: [git.wownero.com/wowlet/wowlet](https://git.wownero.com/wowlet/wowlet/releases)
- Stack Wallet iOS & Android Mobile Wallet: [stackwallet.com](https://stackwallet.com)
- Wonerujo Android Mobile Wallet: [google store](https://play.google.com/store/apps/details?id=com.m2049r.wowwallet)
- Public Node Status: [monero.fail](https://monero.fail/?crypto=wownero)
- Map of Nodes: [wownero.fyi](https://wownero.fyi)
- Wownero Memes: [suchwow.xyz]https://suchwow.xyz/posts/top)
- XMR/WOW Swap: [nero Swap](https://neroswap.com)
- Mining Pools: [miningpoolstats.stream](https://miningpoolstats.stream/wownero)
- Wownero Memes: [suchwow.xyz](https://suchwow.xyz/posts/top)
- Market Info: [coinmarketcap.com](https://coinmarketcap.com/currencies/wownero), [coingecko.com](https://www.coingecko.com/en/coins/wownero/usd)
## Exchanges
- [AltQuick](https://altquick.com/market/Wownero)
- [Majestic Bank](https://majesticbank.sc)
- [TradeOgre](https://tradeogre.com/exchange/BTC-WOW)
### Blockchain Explorers
- https://explore.wownero.com
- http://wow5eqtzqvsg5jctqzg5g7uk3u62sfqiacj5x6lo4by7bvnj6jkvubyd.onion
- https://wownero.club
- https://explorer.wownero.fyi
## Introduction
@@ -39,11 +41,11 @@ Wownero is a privacy-centric memecoin that was fairly launched on April 1, 2018
Wownero is a 100% community-sponsored endeavor. Supporting services are also graciously provided by sponsors:
[<img src="https://git.wownero.com/wownero/meta/raw/branch/master/images/macstadium.png"
alt="MacStadium"
height="100">](https://www.macstadium.com)
alt="MacStadium"
height="100">](https://www.macstadium.com)
[<img src="https://git.wownero.com/wownero/meta/raw/branch/master/images/jetbrains.png"
alt="JetBrains"
height="100">](https://www.jetbrains.com)
alt="JetBrains"
height="100">](https://www.jetbrains.com)
Developers are volunteers doing this mostly for shits and giggles. If you would like to support our shenanigans and stimulant addictions, please consider donating to [WFS proposals](https://funding.wownero.com/proposals) or the dev slush fund.
@@ -59,32 +61,40 @@ 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!**
**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.
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 freenode to participate in development conversation.
Join `#wownero` on IRC OFTC to participate in development conversation.
## Scheduled software upgrades
## Scheduled software/network upgrades
Wownero uses a fixed-schedule software upgrade (hard fork) mechanism to implement new features. This means that users of Wownero (end users and service providers) should run current versions and upgrade their software on a regular schedule. The required software for these upgrades will be available prior to the scheduled date. Please check the repository prior to this date for the proper Wownero software version. Below is the historical schedule and the projected schedule for the next upgrade.
Dates are provided in the format YYYY-MM-DD.
Dates are provided in the format YYYY-MM-DD.
| Software upgrade block height | Date | Release Name | Minimum Wownero version | Recommended Wownero version | Details |
| ------------------------------ | -----------| ----------------- | ---------------------- | -------------------------- | ---------------------------------------------------------------------------------- |
| 1 | 2018-04-01 | Awesome Akita | v0.1.0.0 | v0.1.0.0 | Cryptonight variant 1, ringsize >= 8, sorted inputs
| 69,69 | 2018-04-24 | Busty Brazzers | v0.2.0.0 | v0.2.0.0 | Bulletproofs, LWMA difficulty algorithm, ringsize >= 10, reduce unlock to 4
| 53,666 | 2018-10-06 | Cool Cage | v0.3.0.0 | v0.3.1.3 | Cryptonight variant 2, LWMA v2, ringsize = 22, MMS
| 63,469 | 2018-11-11 | Dank Doge | v0.4.0.0 | v0.4.0.0 | LWMA v4
| 81,769 | 2019-02-19 | Erotic EggplantEmoji | v0.5.0.0 | v0.5.0.2 | Cryptonight/wow, LWMA v1 with N=144, Updated Bulletproofs, Fee Per Byte, Auto-churn
| 114,969 | 2019-06-14 | F For Fappening | v0.6.1.0 | v0.6.1.2 | RandomWOW, new block weight algorithm, slightly more efficient RingCT format
| 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.2 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
|-------------------------------|------------| ----------------- |-------------------------|-----------------------------| ---------------------------------------------------------------------------------- |
| 1 | 2018-04-01 | Awesome Akita | v0.1.0.0 | v0.1.0.0 | Cryptonight variant 1, ringsize >= 8, sorted inputs
| 69,69 | 2018-04-24 | Busty Brazzers | v0.2.0.0 | v0.2.0.0 | Bulletproofs, LWMA difficulty algorithm, ringsize >= 10, reduce unlock to 4
| 53,666 | 2018-10-06 | Cool Cage | v0.3.0.0 | v0.3.1.3 | Cryptonight variant 2, LWMA v2, ringsize = 22, MMS
| 63,469 | 2018-11-11 | Dank Doge | v0.4.0.0 | v0.4.0.0 | LWMA v4
| 81,769 | 2019-02-19 | Erotic EggplantEmoji | v0.5.0.0 | v0.5.0.2 | Cryptonight/wow, LWMA v1 with N=144, Updated Bulletproofs, Fee Per Byte, Auto-churn
| 114,969 | 2019-06-14 | F For Fappening | v0.6.1.0 | v0.6.1.2 | RandomWOW, new block weight algorithm, slightly more efficient RingCT format
| 160,777 | 2019-11-20 | Gaping Goatse | v0.7.0.0 | v0.7.1.0 | Only allow >= 2 outputs, change to the block median used to calculate penalty, rct sigs in coinbase forbidden, 4 unlock time as protocol rule
| - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.3.3 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
| 331,170 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.2.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
| XXX,XXX | 2023-XX-XX | Kunty Karen | v0.11.0.0 | v0.11.0.0 | View tags, fee changes, adjusted dynamic block weight algorithm, multisig security fixes, RPC broadcast node donation sub-address
X's indicate that these details have not been determined as of commit date.
@@ -110,13 +120,6 @@ Packages are available for
nix-shell -p wownero
* Ubuntu 18.04/Ubuntu 16.04/Debian 9/Debian 8 (amd64)
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8BC34ABB48E565F0
sudo add-apt-repository "deb http://ppa.wownero.com/ bionic main"
sudo apt-get update
sudo apt-get install wownero
Packaging for your favorite distribution would be a welcome contribution!
**DISCLAIMER: These packages are not part of this repository, and as such, do not go through the same review process to ensure their trustworthiness and security.**
@@ -163,10 +166,10 @@ To run in background:
To run as a systemd service, copy
[wownerod.service](utils/systemd/wownerod.service) to `/etc/systemd/system/` and
[wownerod.conf](utils/conf/wownerod.conf) to `/etc/`. The [example
[wownerod.conf](wownerod.conf) to `/etc/`. The [example
service](utils/systemd/wownerod.service) assumes that the user `wownero` exists
and its home is the data directory specified in the [example
config](utils/conf/wownerod.conf).
config](wownerod.conf).
Once node is synced to network, run the CLI wallet by entering:
@@ -176,26 +179,37 @@ Type `help` in CLI wallet to see standard commands (for advanced options, type `
## Tor Anonymity Network
* Install [Tor Browser](https://www.torproject.org/download/)
* Open `torrc` file in a text editor ([installation directory]/Browser/TorBrowser/Data/Tor/torrc) and add hidden service information as follows:
### Ubuntu
* `sudo apt-get update && sudo apt-get install tor -y`
* `sudo nano /etc/tor/torrc`
add the following:
```
HiddenServiceDir [installation directory]/Browser/TorBrowser/Data/Tor/wow_node
HiddenServiceDir /var/lib/tor/wownero/
HiddenServicePort 34569 127.0.0.1:34569
HiddenServicePort 34566 127.0.0.1:34566
HiddenServiceVersion 3
HiddenServicePort 44568 127.0.0.1:44568
```
* Save `torrc` file and restart Tor Browser (keep open)
* Change directory to the `wow_node` folder, open `hostname` file, and copy your node's ".onion" address
* Start wownerod with the following parameters:
save and close nano
* `sudo /etc/init.d/tor restart && sudo systemctl enable tor`
* copy [wownerod.conf](https://git.wownero.com/wownero/wownero/raw/branch/master/wownerod.conf) file and save it in same directory as `wownerod`.
* start wownerod like this:
```
./wownerod --tx-proxy tor,127.0.0.1:9150,10 --add-peer hdps3qwnusz64r7odvynmae6myc2uyvrsc2emap6636qeuzll72eouid.onion:44568 --anonymous-inbound YOUR_NODE_ADDRESS.onion:44568,127.0.0.1:44568,25
./wownerod --config-file=wownerod.conf
```
* `sudo cat /var/lib/tor/wownero/hostname`
copy your onion address and share node with others [here](https://monero.fail/?crypto=wownero) and [here](https://forum.wownero.com/t/wownero-tor-onion-sites/623)
To share your node over p2p, uncomment first line of wownerod.conf and add your onion address.
More information on running Tor and i2p nodes is available [here](https://forum.wownero.com/t/how-to-setup-a-full-node-with-tor-i2p/588)
### Access remote Tor node from CLI wallet
```
./wownero-wallet-cli --proxy 127.0.0.1:9150 --daemon-address wow7dhbgiljnkspkzpjyy66auegbrye2ptfv4gucgbhireg5rrjza5ad.onion:34568
```
Use port `9050` instead of `9150` if you installed Tor as a standalone daemon. For more information, check out [ANONYMITY_NETWORKS](https://git.wownero.com/wownero/wownero/src/branch/master/ANONYMITY_NETWORKS.md).
./wownero-wallet-cli --proxy 127.0.0.1:9050 --daemon-address iy6ry6uudpzvbd72zsipepukp6nsazjdu72n52vg3isfnxqn342flzad.onion:34568
```

View File

@@ -91,7 +91,7 @@ endif()
# Protobuf compilation test
if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON)
execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} -I "${CMAKE_SOURCE_DIR}/cmake" -I "${Protobuf_INCLUDE_DIR}" "${CMAKE_SOURCE_DIR}/cmake/test-protobuf.proto" --cpp_out ${CMAKE_BINARY_DIR} RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} -I "${CMAKE_CURRENT_LIST_DIR}" -I "${Protobuf_INCLUDE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/test-protobuf.proto" --cpp_out ${CMAKE_BINARY_DIR} RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
if(RET)
message(STATUS "Protobuf test generation failed: ${OUT} ${ERR}")
endif()
@@ -100,7 +100,7 @@ if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON)
"${CMAKE_BINARY_DIR}"
SOURCES
"${CMAKE_BINARY_DIR}/test-protobuf.pb.cc"
"${CMAKE_SOURCE_DIR}/cmake/test-protobuf.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test-protobuf.cpp"
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${Protobuf_INCLUDE_DIR};${CMAKE_BINARY_DIR}"
"-DCMAKE_CXX_STANDARD=11"

View File

@@ -42,12 +42,19 @@
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
# Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups)
# Create a temporary file with a simple program.
set(TEMP_CPP_FILE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/test-program.cpp")
file(WRITE "${TEMP_CPP_FILE}" "int main() { return 0; }")
# And run the found ccache on it.
execute_process(COMMAND "${CCACHE_FOUND}" "${CMAKE_CXX_COMPILER}" "${TEMP_CPP_FILE}" RESULT_VARIABLE RET)
if (${RET} EQUAL 0)
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp")
file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[
cmake_minimum_required(VERSION 3.1)
project(test)
option (CCACHE "")
file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}")
add_executable(main test.cpp)
]=])
try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}")
unset(TEST_PROJECT)
if (${RET})
# Success
message(STATUS "Found usable ccache: ${CCACHE_FOUND}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")

View File

@@ -134,7 +134,7 @@ if ( LibUSB_FOUND )
try_compile(LibUSB_COMPILE_TEST_PASSED
${CMAKE_BINARY_DIR}
"${CMAKE_SOURCE_DIR}/cmake/test-libusb-version.c"
"${CMAKE_CURRENT_LIST_DIR}/test-libusb-version.c"
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${LibUSB_INCLUDE_DIRS}"
"-DLINK_DIRECTORIES=${LibUSB_LIBRARIES}"

View File

@@ -1,72 +0,0 @@
# Copyright (c) 2014-2020, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html
# This module sets the following variables:
# CMAKE_C_CLANG_TIDY
# CMAKE_CXX_CLANG_TIDY
# when clang-tidy is found in PATH. Afterwards, the code is being linted by the tool.
# The checks to be enabled can be manipulated with the variable MONERO_CLANG_TIDY_CHECKS
macro (monero_clang_tidy LANGUAGE)
set(TOOL_NAME "clang-tidy")
set(MONERO_CLANG_TIDY_MIN_VERSION "3.6")
if(${CMAKE_VERSION} VERSION_LESS "${MONERO_CLANG_TIDY_MIN_VERSION}")
message(FATAL_ERROR "Sorry, ${TOOL_NAME} is available for CMake from version ${MONERO_CLANG_TIDY_MIN_VERSION}")
else()
message(STATUS "Trying to enable ${TOOL_NAME}")
find_program(MONERO_CLANG_BIN ${TOOL_NAME})
if(NOT MONERO_CLANG_BIN)
message(FATAL_ERROR "${TOOL_NAME} not found! Try running: sudo apt install ${TOOL_NAME}")
else()
message(STATUS "Found ${MONERO_CLANG_BIN}")
set(MONERO_CLANG_TIDY_CHECKS
-header-filter=.; # By default the headers are excluded. This line enables them.
-checks=*; # Currently enabling all checks
# An example of selectively enabling checks:
#-checks=bugprone-*,cppcoreguidelines-avoid-goto # Have to be in one line :(
)
# Current list of checks is avaibale under:
# https://clang.llvm.org/extra/clang-tidy/
if (${LANGUAGE} STREQUAL "C")
set(CMAKE_C_CLANG_TIDY
${MONERO_CLANG_BIN}; # Mind the semicolon
${MONERO_CLANG_TIDY_CHECKS}
)
elseif (${LANGUAGE} STREQUAL "CXX")
set(CMAKE_CXX_CLANG_TIDY
${MONERO_CLANG_BIN}; # Mind the semicolon
${MONERO_CLANG_TIDY_CHECKS}
)
else()
message(FATAL_ERROR "${TOOL_NAME}: Unsupported language: ${LANGUAGE}")
endif()
endif()
endif()
endmacro()

View File

@@ -3,7 +3,7 @@
SOURCES_PATH ?= $(BASEDIR)/sources
BASE_CACHE ?= $(BASEDIR)/built
SDK_PATH ?= $(BASEDIR)/SDKs
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources
BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)

View File

@@ -32,7 +32,7 @@ endef
define fetch_file
( test -f $$($(1)_source_dir)/$(4) || \
( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(4),$(4),$(5))))
endef
define int_get_build_recipe_hash

View File

@@ -1,6 +1,6 @@
package=boost
$(package)_version=1_64_0
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
$(package)_download_path=https://downloads.sourceforge.net/project/boost/boost/1.64.0/
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
$(package)_dependencies=libiconv

View File

@@ -1,7 +1,8 @@
package=eudev
$(package)_version=v3.2.6
$(package)_download_path=https://github.com/gentoo/eudev/archive/
$(package)_file_name=$($(package)_version).tar.gz
$(package)_download_file=$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=a96ecb8637667897b8bd4dee4c22c7c5f08b327be45186e912ce6bc768385852
define $(package)_set_vars

View File

@@ -1,7 +1,8 @@
package=gtest
$(package)_version=1.8.1
$(package)_download_path=https://github.com/google/googletest/archive/
$(package)_file_name=release-$($(package)_version).tar.gz
$(package)_download_file=release-$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
$(package)_cxxflags=-std=c++11
$(package)_cxxflags_linux=-fPIC

View File

@@ -1,7 +1,8 @@
package=native_cctools
$(package)_version=807d6fd1be5d2224872e381870c0a75387fe05e6
$(package)_download_path=https://github.com/theuni/cctools-port/archive
$(package)_file_name=$($(package)_version).tar.gz
$(package)_download_file=$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=a09c9ba4684670a0375e42d9d67e7f12c1f62581a27f28f7c825d6d7032ccc6a
$(package)_build_subdir=cctools
$(package)_clang_version=3.7.1

View File

@@ -1,8 +1,8 @@
package=openssl
$(package)_version=1.1.1i
$(package)_version=1.1.1k
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
$(package)_sha256_hash=892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"

View File

@@ -58,6 +58,7 @@ namespace epee
byte_buffer buffer_; //! Beginning of buffer
std::uint8_t* next_write_; //! Current write position
const std::uint8_t* end_; //! End of buffer
std::size_t increase_size_; //! Minimum buffer size increase
//! \post `requested <= available()`
void overflow(const std::size_t requested);
@@ -74,17 +75,29 @@ namespace epee
using char_type = std::uint8_t;
using Ch = char_type;
//! \return Default minimum size increase on buffer overflow
static constexpr std::size_t default_increase() noexcept { return 4096; }
//! Increase internal buffer by at least `byte_stream_increase` bytes.
byte_stream() noexcept
: byte_stream(default_increase())
{}
//! Increase internal buffer by at least `increase` bytes.
explicit byte_stream(const std::size_t increase) noexcept
: buffer_(nullptr),
next_write_(nullptr),
end_(nullptr)
end_(nullptr),
increase_size_(increase)
{}
byte_stream(byte_stream&& rhs) noexcept;
~byte_stream() noexcept = default;
byte_stream& operator=(byte_stream&& rhs) noexcept;
//! \return The minimum increase size on buffer overflow
std::size_t increase_size() const noexcept { return increase_size_; }
const std::uint8_t* data() const noexcept { return buffer_.get(); }
std::uint8_t* tellp() const noexcept { return next_write_; }
std::size_t available() const noexcept { return end_ - next_write_; }

View File

@@ -70,7 +70,7 @@ namespace http
virtual bool connect(std::chrono::milliseconds timeout) = 0;
virtual bool disconnect() = 0;
virtual bool is_connected(bool *ssl = NULL) = 0;
virtual bool invoke(const boost::string_ref uri, const boost::string_ref method, const boost::string_ref body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
virtual bool invoke(const boost::string_ref uri, const boost::string_ref method, const std::string& body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
virtual bool invoke_get(const boost::string_ref uri, std::chrono::milliseconds timeout, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
virtual bool invoke_post(const boost::string_ref uri, const std::string& body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
virtual uint64_t get_bytes_sent() const = 0;

View File

@@ -269,8 +269,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
//_dbg3("[sock " << socket().native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
CRITICAL_REGION_LOCAL(self->m_self_refs_lock);
//_dbg3("[sock " << socket().native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
if(m_was_shutdown)
return false;
++m_reference_count;
m_self_ref = std::move(self);
return true;

View File

@@ -233,7 +233,7 @@ namespace net_utils
}
//---------------------------------------------------------------------------
inline bool invoke(const boost::string_ref uri, const boost::string_ref method, const boost::string_ref body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) override
inline bool invoke(const boost::string_ref uri, const boost::string_ref method, const std::string& body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) override
{
CRITICAL_REGION_LOCAL(m_lock);
if(!is_connected())

View File

@@ -118,10 +118,8 @@
return true; \
} \
uint64_t ticks2 = misc_utils::get_tick_count(); \
epee::byte_slice buffer; \
epee::serialization::store_t_to_binary(static_cast<command_type::response&>(resp), buffer, 64 * 1024); \
epee::serialization::store_t_to_binary(static_cast<command_type::response&>(resp), response_info.m_body); \
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_body.assign(reinterpret_cast<const char*>(buffer.data()), buffer.size()); \
response_info.m_mime_tipe = " application/octet-stream"; \
response_info.m_header_info.m_content_type = " application/octet-stream"; \
MDEBUG( s_pattern << "() processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms"); \

View File

@@ -31,6 +31,7 @@
#include <cstdint>
#include "byte_slice.h"
#include "net_utils_base.h"
#include "span.h"
@@ -38,7 +39,6 @@
namespace epee
{
class byte_slice;
namespace levin
{
#pragma pack(push)
@@ -87,7 +87,7 @@ namespace levin
template<class t_connection_context = net_utils::connection_context_base>
struct levin_commands_handler
{
virtual int invoke(int command, const epee::span<const uint8_t> in_buff, byte_slice& buff_out, t_connection_context& context)=0;
virtual int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, t_connection_context& context)=0;
virtual int notify(int command, const epee::span<const uint8_t> in_buff, t_connection_context& context)=0;
virtual void callback(t_connection_context& context){};

View File

@@ -526,7 +526,7 @@ public:
{
if(m_current_head.m_have_to_return_data)
{
byte_slice return_buff;
std::string return_buff;
const uint32_t return_code = m_config.m_pcommands_handler->invoke(
m_current_head.m_command, buff_to_invoke, return_buff, m_connection_context
);
@@ -537,8 +537,9 @@ public:
bucket_head2 head = make_header(m_current_head.m_command, return_buff.size(), LEVIN_PACKET_RESPONSE, false);
head.m_return_code = SWAP32LE(return_code);
return_buff.insert(0, reinterpret_cast<const char*>(&head), sizeof(head));
if(!m_pservice_endpoint->do_send(byte_slice{{epee::as_byte_span(head), epee::to_span(return_buff)}}))
if(!m_pservice_endpoint->do_send(byte_slice{std::move(return_buff)}))
return false;
MDEBUG(m_connection_context << "LEVIN_PACKET_SENT. [len=" << head.m_cb
@@ -799,36 +800,32 @@ void async_protocol_handler_config<t_connection_context>::del_connection(async_p
template<class t_connection_context>
void async_protocol_handler_config<t_connection_context>::delete_connections(size_t count, bool incoming)
{
std::vector <boost::uuids::uuid> connections;
std::vector<typename connections_map::mapped_type> connections;
auto scope_exit_handler = misc_utils::create_scope_leave_handler([&connections]{
for (auto &aph: connections)
aph->finish_outer_call();
});
CRITICAL_REGION_BEGIN(m_connects_lock);
for (auto& c: m_connects)
{
if (c.second->m_connection_context.m_is_income == incoming)
connections.push_back(c.first);
if (c.second->start_outer_call())
connections.push_back(c.second);
}
// close random connections from the provided set
// TODO or better just keep removing random elements (performance)
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(connections.begin(), connections.end(), std::default_random_engine(seed));
while (count > 0 && connections.size() > 0)
{
try
{
auto i = connections.end() - 1;
async_protocol_handler<t_connection_context> *conn = m_connects.at(*i);
del_connection(conn);
conn->close();
connections.erase(i);
}
catch (const std::out_of_range &e)
{
MWARNING("Connection not found in m_connects, continuing");
}
--count;
}
for (size_t i = 0; i < connections.size() && i < count; ++i)
m_connects.erase(connections[i]->get_connection_id());
CRITICAL_REGION_END();
for (size_t i = 0; i < connections.size() && i < count; ++i)
connections[i]->close();
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
@@ -890,23 +887,35 @@ int async_protocol_handler_config<t_connection_context>::invoke_async(int comman
template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::foreach_connection(const callback_t &cb)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
for(auto& c: m_connects)
{
async_protocol_handler<t_connection_context>* aph = c.second;
if(!cb(aph->get_context_ref()))
std::vector<typename connections_map::mapped_type> conn;
auto scope_exit_handler = misc_utils::create_scope_leave_handler([&conn]{
for (auto &aph: conn)
aph->finish_outer_call();
});
CRITICAL_REGION_BEGIN(m_connects_lock);
conn.reserve(m_connects.size());
for (auto &e: m_connects)
if (e.second->start_outer_call())
conn.push_back(e.second);
CRITICAL_REGION_END()
for (auto &aph: conn)
if (!cb(aph->get_context_ref()))
return false;
}
return true;
}
//------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
async_protocol_handler<t_connection_context>* aph = nullptr;
if (find_and_lock_connection(connection_id, aph) != LEVIN_OK)
return false;
auto scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler<t_connection_context>::finish_outer_call, aph));
if(!cb(aph->get_context_ref()))
return false;
return true;
@@ -969,12 +978,14 @@ int async_protocol_handler_config<t_connection_context>::send(byte_slice message
template<class t_connection_context>
bool async_protocol_handler_config<t_connection_context>::close(boost::uuids::uuid connection_id)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
async_protocol_handler<t_connection_context>* aph = nullptr;
if (find_and_lock_connection(connection_id, aph) != LEVIN_OK)
return false;
auto scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler<t_connection_context>::finish_outer_call, aph));
if (!aph->close())
return false;
CRITICAL_REGION_LOCAL(m_connects_lock);
m_connects.erase(connection_id);
return true;
}

View File

@@ -44,7 +44,6 @@
#include <boost/lambda/lambda.hpp>
#include <boost/interprocess/detail/atomic.hpp>
#include <boost/system/error_code.hpp>
#include <boost/utility/string_ref.hpp>
#include <functional>
#include "net/net_utils_base.h"
#include "net/net_ssl.h"
@@ -281,7 +280,7 @@ namespace net_utils
inline
bool send(const boost::string_ref buff, std::chrono::milliseconds timeout)
bool send(const std::string& buff, std::chrono::milliseconds timeout)
{
try
@@ -299,7 +298,7 @@ namespace net_utils
// object is used as a callback and will update the ec variable when the
// operation completes. The blocking_udp_client.cpp example shows how you
// can use boost::bind rather than boost::lambda.
async_write(buff.data(), buff.size(), ec);
async_write(buff.c_str(), buff.size(), ec);
// Block until the asynchronous operation has completed.
while (ec == boost::asio::error::would_block)

View File

@@ -131,8 +131,8 @@ namespace net_utils
inline
bool parse_url_ipv6(const std::string url_str, http::url_content& content)
{
STATIC_REGEXP_EXPR_1(rexp_match_uri, "^(([^:]*?)://)?(\\[(.*)\\](:(\\d+))?)(.*)?", boost::regex::icase | boost::regex::normal);
// 12 3 4 5 6 7
STATIC_REGEXP_EXPR_1(rexp_match_uri, "^((.*?)://)?(\\[(.*)\\](:(\\d+))?)(.*)?", boost::regex::icase | boost::regex::normal);
// 12 3 4 5 6 7
content.port = 0;
boost::smatch result;
@@ -175,8 +175,8 @@ namespace net_utils
///iframe_test.html?api_url=http://api.vk.com/api.php&api_id=3289090&api_settings=1&viewer_id=562964060&viewer_type=0&sid=0aad8d1c5713130f9ca0076f2b7b47e532877424961367d81e7fa92455f069be7e21bc3193cbd0be11895&secret=368ebbc0ef&access_token=668bc03f43981d883f73876ffff4aa8564254b359cc745dfa1b3cde7bdab2e94105d8f6d8250717569c0a7&user_id=0&group_id=0&is_app_user=1&auth_key=d2f7a895ca5ff3fdb2a2a8ae23fe679a&language=0&parent_language=0&ad_info=ElsdCQBaQlxiAQRdFUVUXiN2AVBzBx5pU1BXIgZUJlIEAWcgAUoLQg==&referrer=unknown&lc_name=9834b6a3&hash=
//STATIC_REGEXP_EXPR_1(rexp_match_uri, "^([^?#]*)(\\?([^#]*))?(#(.*))?", boost::regex::icase | boost::regex::normal);
STATIC_REGEXP_EXPR_1(rexp_match_uri, "^(([^:]*?)://)?(([^/:]*)(:(\\d+))?)(.*)?", boost::regex::icase | boost::regex::normal);
// 12 34 5 6 7
STATIC_REGEXP_EXPR_1(rexp_match_uri, "^((.*?)://)?(([^/:]*)(:(\\d+))?)(.*)?", boost::regex::icase | boost::regex::normal);
// 12 34 5 6 7
content.port = 0;
boost::smatch result;
if(!(boost::regex_search(url_str, result, rexp_match_uri, boost::match_default) && result[0].matched))

View File

@@ -236,6 +236,7 @@ namespace net_utils
virtual address_type get_type_id() const = 0;
virtual zone get_zone() const = 0;
virtual bool is_blockable() const = 0;
virtual std::uint16_t port() const = 0;
};
template<typename T>
@@ -266,6 +267,7 @@ namespace net_utils
virtual address_type get_type_id() const override { return value.get_type_id(); }
virtual zone get_zone() const override { return value.get_zone(); }
virtual bool is_blockable() const override { return value.is_blockable(); }
virtual std::uint16_t port() const override { return value.port(); }
};
std::shared_ptr<interface> self;
@@ -312,6 +314,7 @@ namespace net_utils
address_type get_type_id() const { return self ? self->get_type_id() : address_type::invalid; }
zone get_zone() const { return self ? self->get_zone() : zone::invalid; }
bool is_blockable() const { return self ? self->is_blockable() : false; }
std::uint16_t port() const { return self ? self->port() : 0; }
template<typename Type> const Type &as() const { return as_mutable<const Type>(); }
BEGIN_KV_SERIALIZE_MAP()

View File

@@ -29,7 +29,6 @@
#include <boost/utility/string_ref.hpp>
#include <chrono>
#include <string>
#include "byte_slice.h"
#include "portable_storage_template_helper.h"
#include "net/http_base.h"
#include "net/http_server_handlers_map2.h"
@@ -75,12 +74,12 @@ namespace epee
template<class t_request, class t_response, class t_transport>
bool invoke_http_bin(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref method = "POST")
{
byte_slice req_param;
if(!serialization::store_t_to_binary(out_struct, req_param, 16 * 1024))
std::string req_param;
if(!serialization::store_t_to_binary(out_struct, req_param))
return false;
const http::http_response_info* pri = NULL;
if(!transport.invoke(uri, method, boost::string_ref{reinterpret_cast<const char*>(req_param.data()), req_param.size()}, timeout, std::addressof(pri)))
if(!transport.invoke(uri, method, req_param, timeout, std::addressof(pri)))
{
LOG_PRINT_L1("Failed to invoke http request to " << uri);
return false;

View File

@@ -27,10 +27,8 @@
#pragma once
#include "portable_storage_template_helper.h"
#include <boost/utility/string_ref.hpp>
#include <boost/utility/value_init.hpp>
#include <functional>
#include "byte_slice.h"
#include "span.h"
#include "net/levin_base.h"
@@ -117,12 +115,11 @@ namespace epee
const boost::uuids::uuid &conn_id = context.m_connection_id;
typename serialization::portable_storage stg;
out_struct.store(stg);
byte_slice buff_to_send;
std::string buff_to_recv;
stg.store_to_binary(buff_to_send, 16 * 1024);
std::string buff_to_send, buff_to_recv;
stg.store_to_binary(buff_to_send);
on_levin_traffic(context, true, true, false, buff_to_send.size(), command);
int res = transport.invoke(command, boost::string_ref{reinterpret_cast<const char*>(buff_to_send.data()), buff_to_send.size()}, buff_to_recv, conn_id);
int res = transport.invoke(command, buff_to_send, buff_to_recv, conn_id);
if( res <=0 )
{
LOG_PRINT_L1("Failed to invoke command " << command << " return code " << res);
@@ -145,10 +142,10 @@ namespace epee
const boost::uuids::uuid &conn_id = context.m_connection_id;
typename serialization::portable_storage stg;
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
byte_slice buff_to_send;
stg.store_to_binary(buff_to_send, 16 * 1024);
std::string buff_to_send;
stg.store_to_binary(buff_to_send);
on_levin_traffic(context, true, true, false, buff_to_send.size(), command);
int res = transport.invoke_async(command, epee::to_span(buff_to_send), conn_id, [cb, command](int code, const epee::span<const uint8_t> buff, typename t_transport::connection_context& context)->bool
int res = transport.invoke_async(command, epee::strspan<uint8_t>(buff_to_send), conn_id, [cb, command](int code, const epee::span<const uint8_t> buff, typename t_transport::connection_context& context)->bool
{
t_result result_struct = AUTO_VAL_INIT(result_struct);
if( code <=0 )
@@ -192,11 +189,11 @@ namespace epee
const boost::uuids::uuid &conn_id = context.m_connection_id;
serialization::portable_storage stg;
out_struct.store(stg);
byte_slice buff_to_send;
std::string buff_to_send;
stg.store_to_binary(buff_to_send);
on_levin_traffic(context, true, true, false, buff_to_send.size(), command);
int res = transport.notify(command, epee::to_span(buff_to_send), conn_id);
int res = transport.notify(command, epee::strspan<uint8_t>(buff_to_send), conn_id);
if(res <=0 )
{
MERROR("Failed to notify command " << command << " return code " << res);
@@ -207,7 +204,7 @@ namespace epee
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
template<class t_owner, class t_in_type, class t_out_type, class t_context, class callback_t>
int buff_to_t_adapter(int command, const epee::span<const uint8_t> in_buff, byte_slice& buff_out, callback_t cb, t_context& context )
int buff_to_t_adapter(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, callback_t cb, t_context& context )
{
serialization::portable_storage strg;
if(!strg.load_from_binary(in_buff, &default_levin_limits))
@@ -230,7 +227,7 @@ namespace epee
serialization::portable_storage strg_out;
static_cast<t_out_type&>(out_struct).store(strg_out);
if(!strg_out.store_to_binary(buff_out, 32 * 1024))
if(!strg_out.store_to_binary(buff_out))
{
LOG_ERROR("Failed to store_to_binary in command" << command);
return -1;
@@ -262,7 +259,7 @@ namespace epee
}
#define CHAIN_LEVIN_INVOKE_MAP2(context_type) \
int invoke(int command, const epee::span<const uint8_t> in_buff, epee::byte_slice& buff_out, context_type& context) \
int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, context_type& context) \
{ \
bool handled = false; \
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
@@ -271,13 +268,13 @@ namespace epee
#define CHAIN_LEVIN_NOTIFY_MAP2(context_type) \
int notify(int command, const epee::span<const uint8_t> in_buff, context_type& context) \
{ \
bool handled = false; epee::byte_slice fake_str; \
bool handled = false; std::string fake_str;\
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
}
#define CHAIN_LEVIN_INVOKE_MAP() \
int invoke(int command, const epee::span<const uint8_t> in_buff, epee::byte_slice& buff_out, epee::net_utils::connection_context_base& context) \
int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, epee::net_utils::connection_context_base& context) \
{ \
bool handled = false; \
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
@@ -297,7 +294,7 @@ namespace epee
}
#define BEGIN_INVOKE_MAP2(owner_type) \
template <class t_context> int handle_invoke_map(bool is_notify, int command, const epee::span<const uint8_t> in_buff, epee::byte_slice& buff_out, t_context& context, bool& handled) \
template <class t_context> int handle_invoke_map(bool is_notify, int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, t_context& context, bool& handled) \
{ \
try { \
typedef owner_type internal_owner_type_name;

View File

@@ -32,6 +32,7 @@
#include "misc_language.h"
#include "portable_storage_base.h"
#include "portable_storage_to_bin.h"
#include "portable_storage_from_bin.h"
#include "portable_storage_to_json.h"
#include "portable_storage_from_json.h"
@@ -39,9 +40,10 @@
#include "span.h"
#include "int-util.h"
#include <boost/mpl/contains.hpp>
namespace epee
{
class byte_slice;
namespace serialization
{
/************************************************************************/
@@ -90,7 +92,7 @@ namespace epee
bool delete_entry(const std::string& pentry_name, hsection hparent_section = nullptr);
//-------------------------------------------------------------------------------
bool store_to_binary(byte_slice& target, std::size_t initial_buffer_size = 8192);
bool store_to_binary(binarybuffer& target);
bool load_from_binary(const epee::span<const uint8_t> target, const limits_t *limits = NULL);
bool load_from_binary(const std::string& target, const limits_t *limits = NULL) { return load_from_binary(epee::strspan<uint8_t>(target), limits); }
template<class trace_policy>
@@ -140,6 +142,22 @@ namespace epee
{
return false;//TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
}
inline
bool portable_storage::store_to_binary(binarybuffer& target)
{
TRY_ENTRY();
std::stringstream ss;
storage_block_header sbh = AUTO_VAL_INIT(sbh);
sbh.m_signature_a = SWAP32LE(PORTABLE_STORAGE_SIGNATUREA);
sbh.m_signature_b = SWAP32LE(PORTABLE_STORAGE_SIGNATUREB);
sbh.m_ver = PORTABLE_STORAGE_FORMAT_VER;
ss.write((const char*)&sbh, sizeof(storage_block_header));
pack_entry_to_buff(ss, m_root);
target = ss.str();
return true;
CATCH_ENTRY("portable_storage::store_to_binary", false)
}
inline
bool portable_storage::load_from_binary(const epee::span<const uint8_t> source, const limits_t *limits)
{

View File

@@ -29,7 +29,6 @@
#pragma once
#include "misc_language.h"
#include "misc_log_ex.h"
#include "portable_storage_base.h"
#include "portable_storage_bin_utils.h"

View File

@@ -28,7 +28,6 @@
#include <string>
#include "byte_slice.h"
#include "parserse_base_utils.h"
#include "portable_storage.h"
#include "file_io_utils.h"
@@ -112,18 +111,18 @@ namespace epee
}
//-----------------------------------------------------------------------------------------------------------
template<class t_struct>
bool store_t_to_binary(t_struct& str_in, byte_slice& binary_buff, size_t initial_buffer_size = 8192)
bool store_t_to_binary(t_struct& str_in, std::string& binary_buff, size_t indent = 0)
{
portable_storage ps;
str_in.store(ps);
return ps.store_to_binary(binary_buff, initial_buffer_size);
return ps.store_to_binary(binary_buff);
}
//-----------------------------------------------------------------------------------------------------------
template<class t_struct>
byte_slice store_t_to_binary(t_struct& str_in, size_t initial_buffer_size = 8192)
std::string store_t_to_binary(t_struct& str_in, size_t indent = 0)
{
byte_slice binary_buff;
store_t_to_binary(str_in, binary_buff, initial_buffer_size);
std::string binary_buff;
store_t_to_binary(str_in, binary_buff, indent);
return binary_buff;
}
}

View File

@@ -27,9 +27,9 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add_library(epee STATIC byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp
add_library(epee byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp
wipeable_string.cpp levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp
int-util.cpp portable_storage.cpp)
int-util.cpp)
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
add_library(epee_readline STATIC readline_buffer.cpp)
@@ -60,14 +60,23 @@ target_link_libraries(epee
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${OPENSSL_LIBRARIES}
PRIVATE
${EXTRA_LIBRARIES})
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
target_link_libraries(epee_readline
PUBLIC
easylogging
${Boost_SYSTEM_LIBRARY}
PRIVATE
${GNU_READLINE_LIBRARY})
endif()
target_include_directories(epee
PUBLIC
"${EPEE_INCLUDE_DIR_BASE}"
"${OPENSSL_INCLUDE_DIR}")

View File

@@ -26,6 +26,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <limits>
#include <string.h>
#include "net/buffer.h"

View File

@@ -34,11 +34,6 @@
#include <iostream>
namespace
{
constexpr const std::size_t minimum_increase = 4096;
}
namespace epee
{
void byte_stream::overflow(const std::size_t requested)
@@ -51,7 +46,7 @@ namespace epee
const std::size_t len = size();
const std::size_t cap = capacity();
const std::size_t increase = std::max(std::max(need, cap), minimum_increase);
const std::size_t increase = std::max(need, increase_size());
next_write_ = nullptr;
end_ = nullptr;
@@ -67,7 +62,8 @@ namespace epee
byte_stream::byte_stream(byte_stream&& rhs) noexcept
: buffer_(std::move(rhs.buffer_)),
next_write_(rhs.next_write_),
end_(rhs.end_)
end_(rhs.end_),
increase_size_(rhs.increase_size_)
{
rhs.next_write_ = nullptr;
rhs.end_ = nullptr;
@@ -80,6 +76,7 @@ namespace epee
buffer_ = std::move(rhs.buffer_);
next_write_ = rhs.next_write_;
end_ = rhs.end_;
increase_size_ = rhs.increase_size_;
rhs.next_write_ = nullptr;
rhs.end_ = nullptr;
}

View File

@@ -1,29 +0,0 @@
#include "byte_slice.h"
#include "byte_stream.h"
#include "misc_log_ex.h"
#include "span.h"
#include "storages/portable_storage.h"
#include "storages/portable_storage_to_bin.h"
namespace epee
{
namespace serialization
{
bool portable_storage::store_to_binary(byte_slice& target, const std::size_t initial_buffer_size)
{
TRY_ENTRY();
byte_stream ss;
ss.reserve(initial_buffer_size);
storage_block_header sbh{};
sbh.m_signature_a = SWAP32LE(PORTABLE_STORAGE_SIGNATUREA);
sbh.m_signature_b = SWAP32LE(PORTABLE_STORAGE_SIGNATUREB);
sbh.m_ver = PORTABLE_STORAGE_FORMAT_VER;
ss.write(epee::as_byte_span(sbh));
pack_entry_to_buff(ss, m_root);
target = epee::byte_slice{std::move(ss)};
return true;
CATCH_ENTRY("portable_storage::store_to_binary", false)
}
}
}

View File

@@ -6,7 +6,6 @@
#include <boost/thread/lock_guard.hpp>
#include <boost/algorithm/string.hpp>
static bool same_as_last_line(const std::string&);
static void install_line_handler();
static void remove_line_handler();
@@ -176,11 +175,8 @@ static void handle_line(char* line)
boost::trim_right(test_line);
if(!test_line.empty())
{
if (!same_as_last_line(test_line))
{
add_history(test_line.c_str());
history_set_pos(history_length);
}
add_history(test_line.c_str());
history_set_pos(history_length);
if (test_line == "exit" || test_line == "q")
exit = true;
}
@@ -196,16 +192,6 @@ static void handle_line(char* line)
return;
}
// same_as_last_line returns true, if the last line in the history is
// equal to test_line.
static bool same_as_last_line(const std::string& test_line)
{
// Note that state->offset == state->length, when a new line was entered.
HISTORY_STATE* state = history_get_history_state();
return state->length > 0
&& test_line.compare(state->entries[state->length-1]->line) == 0;
}
static char* completion_matches(const char* text, int state)
{
static size_t list_index;

View File

@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/optional/optional.hpp>
#include <limits>
#include <string.h>
#include "memwipe.h"
#include "misc_log_ex.h"

View File

@@ -14,8 +14,8 @@ then
exit 1
fi
case "$type" in
block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof|utf8) ;;
*) echo "usage: $0 block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof|utf8"; exit 1 ;;
block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof) ;;
*) echo "usage: $0 block|transaction|signature|cold-outputs|cold-transaction|load-from-binary|load-from-json|base58|parse-url|http-client|levin|bulletproof"; exit 1 ;;
esac
if test -d "fuzz-out/$type"

View File

@@ -126,7 +126,7 @@ Setup for LXC:
```bash
GH_USER=fluffypony
VERSION=v0.17.0.0
VERSION=v0.17.2.0
./gitian-build.py --setup $GH_USER $VERSION
```
@@ -182,13 +182,12 @@ If you chose to do detached signing using `--detach-sign` above (recommended), y
```bash
GH_USER=fluffypony
VERSION=v0.17.0.0
VERSION=v0.17.2.0
gpg --detach-sign ${VERSION}-linux/${GH_USER}/monero-linux-*-build.assert
gpg --detach-sign ${VERSION}-win/${GH_USER}/monero-win-*-build.assert
gpg --detach-sign ${VERSION}-osx/${GH_USER}/monero-osx-*-build.assert
gpg --detach-sign ${VERSION}-android/${GH_USER}/monero-android-*-build.assert
gpg --detach-sign ${VERSION}-freebsd/${GH_USER}/monero-freebsd-*-build.assert
```
This will create a `.sig` file for each `.assert` file above (2 files for each platform).

View File

@@ -1,5 +1,5 @@
---
name: "wownero-android-0.9"
name: "wownero-android-0.10"
enable_cache: true
suites:
- "bionic"

View File

@@ -94,10 +94,6 @@ def build():
os.chdir('builder')
os.makedirs('inputs', exist_ok=True)
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])
subprocess.check_output(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
subprocess.check_output(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
subprocess.check_call(['make', '-C', 'inputs/wownero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])
rebuild()

View File

@@ -1,5 +1,5 @@
---
name: "wownero-freebsd-0.9"
name: "wownero-freebsd-0.10"
enable_cache: true
suites:
- "bionic"

View File

@@ -1,5 +1,5 @@
---
name: "wownero-linux-0.9"
name: "wownero-linux-0.10"
enable_cache: true
suites:
- "bionic"

View File

@@ -1,5 +1,5 @@
---
name: "wownero-osx-0.9"
name: "wownero-osx-0.10"
enable_cache: true
suites:
- "bionic"

View File

@@ -1,5 +1,5 @@
---
name: "wownero-win-0.9"
name: "wownero-win-0.10"
enable_cache: true
suites:
- "bionic"
@@ -23,12 +23,6 @@ packages:
- "rename"
- "cmake"
alternatives:
-
package: "i686-w64-mingw32-g++"
path: "/usr/bin/i686-w64-mingw32-g++-posix"
-
package: "i686-w64-mingw32-gcc"
path: "/usr/bin/i686-w64-mingw32-gcc-posix"
-
package: "x86_64-w64-mingw32-g++"
path: "/usr/bin/x86_64-w64-mingw32-g++-posix"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1,76 +0,0 @@
name: wownero
version: 0.5.0.0
summary: "Wownero: the secure, private, untraceable cryptocurrency http://wownero.org"
description: |
Wownero: a fairly launched privacy-centric meme coin with no premine and a finite supply.
grade: devel
confinement: strict
apps:
wownerod:
daemon: forking
command: |
wownerod-wrapper --detach --data-dir ${SNAP_COMMON} --config-file ${SNAP_USER_DATA}/etc/wownerod.conf
plugs:
- network
- network-bind
wownero-wallet-rpc:
command: |
wownero-wallet-rpc --log-file ${SNAP_USER_DATA}
plugs:
- home
- network
- network-bind
wownero-wallet-cli:
command: |
wownero-wallet-cli --log-file ${SNAP_USER_DATA}
plugs:
- home
- network
parts:
cmake-build:
plugin: cmake
configflags:
- -DBDB_STATIC=1
- -DBoost_USE_STATIC_LIBS=1
- -DBoost_USE_STATIC_RUNTIME=1
- -DARCH=default
source: .
build-packages:
- gcc
- pkg-config
- libunbound-dev
- libevent-dev
- libboost-all-dev
- libzmqpp-dev
- libzmq3-dev
- libsodium-dev
- libdb-dev
- libunwind-dev
- libminiupnpc-dev
- libldns-dev
- libexpat1-dev
- libreadline6-dev
- bison
- doxygen
- graphviz
stage-packages:
- libminiupnpc10
- libunbound2
- libunwind8
prime:
- bin
- usr/lib/
- -usr/lib/gcc
- -usr/share
dist-files:
plugin: dump
source: .
organize:
contrib/snap/wownerod.conf: etc/wownerod.conf
contrib/snap/wownerod-wrapper: bin/wownerod-wrapper
prime:
- etc
- bin

View File

@@ -1,8 +0,0 @@
#!/bin/sh
if [ ! -d "$SNAP_USER_DATA/etc" ]; then
mkdir $SNAP_USER_DATA/etc/
cp -R $SNAP/etc/wownerod.conf $SNAP_USER_DATA/etc/wownerod.conf
fi
exec "$SNAP/bin/wownerod" "$@"

View File

@@ -1,10 +0,0 @@
# Configuration for monerod
# Syntax: any command line option may be specified as 'clioptionname=value'.
# Boolean options such as 'no-igd' are specified as 'no-igd=1'.
# See 'monerod --help' for all available options.
# Overridden by snap:
# data-dir=/var/lib/wownero
# log-file=/var/log/wownero/wownero.log
log-level=0

101
contrib/tor/wownero-over-tor.sh Executable file
View File

@@ -0,0 +1,101 @@
#!/bin/bash
DIR=$(realpath $(dirname $0))
echo "Checking wownerod..."
monerod=""
for dir in \
. \
"$DIR" \
"$DIR/../.." \
"$DIR/build/release/bin" \
"$DIR/../../build/release/bin" \
"$DIR/build/Linux/master/release/bin" \
"$DIR/../../build/Linux/master/release/bin" \
"$DIR/build/Windows/master/release/bin" \
"$DIR/../../build/Windows/master/release/bin"
do
if test -x "$dir/wownerod"
then
monerod="$dir/wownerod"
break
fi
done
if test -z "$wownerod"
then
echo "wownerod not found"
exit 1
fi
echo "Found: $wownerod"
TORDIR="$DIR/wownero-over-tor"
TORRC="$TORDIR/torrc"
HOSTNAMEFILE="$TORDIR/hostname"
echo "Creating configuration..."
mkdir -p "$TORDIR"
chmod 700 "$TORDIR"
rm -f "$TORRC"
cat << EOF > "$TORRC"
ControlSocket $TORDIR/control
ControlSocketsGroupWritable 1
CookieAuthentication 1
CookieAuthFile $TORDIR/control.authcookie
CookieAuthFileGroupReadable 1
HiddenServiceDir $TORDIR
HiddenServicePort 34568 127.0.0.1:34568
HiddenServicePort 34566 127.0.0.1:34566
HiddenServiceVersion 3
EOF
echo "Starting Tor..."
nohup tor -f "$TORRC" 2> "$TORDIR/tor.stderr" 1> "$TORDIR/tor.stdout" &
ready=0
for i in `seq 10`
do
sleep 1
if test -f "$HOSTNAMEFILE"
then
ready=1
break
fi
done
if test "$ready" = 0
then
echo "Error starting Tor"
cat "$TORDIR/tor.stdout"
exit 1
fi
echo "Starting wownerod..."
HOSTNAME=$(cat "$HOSTNAMEFILE")
"$monerod" \
--anonymous-inbound "$HOSTNAME":34566,127.0.0.1:34566,25 --tx-proxy tor,127.0.0.1:9050,10 \
--add-priority-node v2admi6gbeprxnk6i2oscizhgy4v5ixu6iezkhj5udiwbfjjs2w7dnid.onion:34568 \
--add-priority-node iy6ry6uudpzvbd72zsipepukp6nsazjdu72n52vg3isfnxqn342flzad.onion:34568 \
--add-priority-node 7ftpbpp6rbgqi5kjmhyin46essnh3eqb3m3rhfi7r2fr33iwkeuer3yd.onion:34568 \
--add-priority-node j7rf2jcccizcp47y5moehguyuqdpg4lusk642sw4nayuruitqaqbc7ad.onion:34568 \
--add-priority-node aje53o5z5twne5q2ljw44zkahhsuhjtwaxuburxddbf7n4pfsj4rj6qd.onion:34568 \
--add-priority-node nepc4lxndsooj2akn7ofrj3ooqc25242obchcag6tw3f2mxrms2uuvyd.onion:34568 \
--add-priority-node 666l2ajxqjgj5lskvbokvworjysgvqag4oitokjuy7wz6juisul4jqad.onion:34568 \
--add-priority-node ty7ppqozzodz75audgvkprekiiqsovbyrkfdjwadrkbe3etyzloatxad.onion:34568 \
--detach
ready=0
for i in `seq 10`
do
sleep 1
status=$("$wownerod" status)
echo "$status" | grep -q "Height:"
if test $? = 0
then
ready=1
break
fi
done
if test "$ready" = 0
then
echo "Error starting wownerod"
tail -n 400 "$HOME/.wownero/wownero.log" | grep -Ev stacktrace\|"Error: Couldn't connect to daemon:"\|"src/daemon/main.cpp:.*Wownero\ \'" | tail -n 20
exit 1
fi
echo "Ready. Your Tor hidden service is $HOSTNAME"

View File

@@ -3461,9 +3461,9 @@ mdb_freelist_save(MDB_txn *txn)
} else {
x = mdb_mid2l_search(dl, mp->mp_pgno);
mdb_tassert(txn, dl[x].mid == mp->mp_pgno);
mdb_dpage_free(env, mp);
}
dl[x].mptr = NULL;
mdb_dpage_free(env, mp);
}
{
/* squash freed slots out of the dirty list */
@@ -4882,9 +4882,6 @@ mdb_env_open2(MDB_env *env, int prev)
#endif
env->me_maxpg = env->me_mapsize / env->me_psize;
if (env->me_txns)
env->me_txns->mti_txnid = meta.mm_txnid;
#if MDB_DEBUG
{
MDB_meta *meta = mdb_env_pick_meta(env);
@@ -4984,6 +4981,9 @@ static int ESECT
mdb_env_share_locks(MDB_env *env, int *excl)
{
int rc = 0;
MDB_meta *meta = mdb_env_pick_meta(env);
env->me_txns->mti_txnid = meta->mm_txnid;
#ifdef _WIN32
{
@@ -7867,7 +7867,7 @@ put_sub:
xdata.mv_size = 0;
xdata.mv_data = "";
leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
if (flags == MDB_CURRENT) {
if ((flags & (MDB_CURRENT|MDB_APPENDDUP)) == MDB_CURRENT) {
xflags = MDB_CURRENT|MDB_NOSPILL;
} else {
mdb_xcursor_init1(mc, leaf);

View File

@@ -75,8 +75,6 @@ function (monero_add_executable name)
PROPERTY
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
enable_stack_trace("${name}")
monero_set_target_no_relink("${name}")
endfunction ()
function (monero_add_library name)
@@ -94,7 +92,6 @@ function (monero_add_library_with_deps)
set(objlib obj_${MONERO_ADD_LIBRARY_NAME})
add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES})
add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>)
monero_set_target_no_relink("${MONERO_ADD_LIBRARY_NAME}")
if (MONERO_ADD_LIBRARY_DEPENDS)
add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS})
endif()

View File

@@ -248,8 +248,15 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const std::pair
}
else
{
rct::key commitment;
if (tx.version > 1)
{
commitment = tx.rct_signatures.outPk[i].mask;
if (rct::is_rct_bulletproof_plus(tx.rct_signatures.type))
commitment = rct::scalarmult8(commitment);
}
amount_output_indices[i] = add_output(tx_hash, tx.vout[i], i, tx.unlock_time,
tx.version > 1 ? &tx.rct_signatures.outPk[i].mask : NULL);
tx.version > 1 ? &commitment : NULL);
}
}
add_tx_amount_output_indices(tx_id, amount_output_indices);

View File

@@ -3001,7 +3001,7 @@ bool BlockchainLMDB::tx_exists(const crypto::hash& h) const
if (! tx_found)
{
LOG_PRINT_L3("transaction with hash " << epee::string_tools::pod_to_hex(h) << " not found in db");
LOG_PRINT_L1("transaction with hash " << epee::string_tools::pod_to_hex(h) << " not found in db");
return false;
}
@@ -3032,7 +3032,7 @@ bool BlockchainLMDB::tx_exists(const crypto::hash& h, uint64_t& tx_id) const
bool ret = false;
if (get_result == MDB_NOTFOUND)
{
LOG_PRINT_L3("transaction with hash " << epee::string_tools::pod_to_hex(h) << " not found in db");
LOG_PRINT_L1("transaction with hash " << epee::string_tools::pod_to_hex(h) << " not found in db");
}
else if (get_result)
throw0(DB_ERROR(lmdb_error("DB error attempting to fetch transaction from hash", get_result).c_str()));

View File

@@ -28,21 +28,33 @@
set(GENERATED_SOURCES "")
set(GENERATOR "${CMAKE_CURRENT_BINARY_DIR}/blocks_generator.cmake")
file(GENERATE OUTPUT ${GENERATOR} CONTENT [=[
file(READ "${INPUT_DAT_FILE}" DATA HEX)
string(REGEX REPLACE "[0-9a-fA-F][0-9a-fA-F]" "0x\\0," DATA "${DATA}")
file(WRITE "${OUTPUT_C_SOURCE}" "
#include <stddef.h>
const unsigned char ${BLOB_NAME}[]={
${DATA}
};
const size_t ${BLOB_NAME}_len = sizeof(${BLOB_NAME});
"
)
]=])
foreach(BLOB_NAME checkpoints)
set(OUTPUT_C_SOURCE "generated_${BLOB_NAME}.c")
list(APPEND GENERATED_SOURCES ${OUTPUT_C_SOURCE})
set(INPUT_DAT_FILE "${BLOB_NAME}.dat")
add_custom_command(
OUTPUT ${OUTPUT_C_SOURCE}
MAIN_DEPENDENCY ${INPUT_DAT_FILE}
COMMAND
cd ${CMAKE_CURRENT_BINARY_DIR} &&
echo "'#include\t<stddef.h>'" > ${OUTPUT_C_SOURCE} &&
echo "'const\tunsigned\tchar\t${BLOB_NAME}[]={'" >> ${OUTPUT_C_SOURCE} &&
od -v -An -tx1 ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_DAT_FILE} | sed -e "'s/[0-9a-fA-F]\\{1,\\}/0x&,/g'" -e "'$$s/.$$//'" >> ${OUTPUT_C_SOURCE} &&
echo "'};'" >> ${OUTPUT_C_SOURCE} &&
echo "'const\tsize_t\t${BLOB_NAME}_len\t=\tsizeof(${BLOB_NAME});'" >> ${OUTPUT_C_SOURCE}
OUTPUT ${OUTPUT_C_SOURCE}
MAIN_DEPENDENCY ${INPUT_DAT_FILE}
DEPENDS ${GENERATOR}
COMMAND ${CMAKE_COMMAND}
"-DINPUT_DAT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_DAT_FILE}"
"-DBLOB_NAME=${BLOB_NAME}"
"-DOUTPUT_C_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_C_SOURCE}"
-P "${GENERATOR}"
)
endforeach()
monero_add_library(blocks blocks.cpp ${GENERATED_SOURCES})
add_library(blocks STATIC blocks.cpp ${GENERATED_SOURCES})

Binary file not shown.

View File

@@ -182,17 +182,6 @@ namespace cryptonote
{
if (nettype == TESTNET)
{
ADD_CHECKPOINT2(1, "c47b8effcc84e22ddd1b876d059c8fbd3e26e4bdffb6bed8b8f4fe283104a7af", "0x2");
ADD_CHECKPOINT2(5, "292add330f6cf5f3845dc4cd2f28ce8d211dd487ddcfe1b5d1d545d7b90ff7d1", "0x5df"); //Hard fork to v8
ADD_CHECKPOINT2(10, "fbdf7d812aa6dd4c5915aadcbf023e722eab1d8ad47c24a230634e688d314798", "0xfa3"); //Hard fork to v9
ADD_CHECKPOINT2(15, "9b86e40b959d7cfe75366686dfd2657699e85b8c658aa8c20b23f7bc01b38af0", "0x1967"); //Hard fork to v10
ADD_CHECKPOINT2(20, "8f65c309ba3ed2bf25df2b7d91e1db40c864230aa3caaf823db81bc19e0bd6a3", "0x232b"); //Hard fork to v11
ADD_CHECKPOINT2(25, "35f2957fdba45d5421561ba2f126a61ec0101b5c2eb79b9e296310acbbdbbe58", "0x2cef"); //Hard fork to v12
ADD_CHECKPOINT2(30, "32cc5aacce8bea10ae869313e194ba51a30720810f3665433ffeea2818938429", "0x36b3"); //Hard fork to v13
ADD_CHECKPOINT2(35, "7f1cdd2c4a6002772343ad9de6c5dba743a0be1d326a6f63924511f08b15863a", "0x4077"); //Hard fork to v14
ADD_CHECKPOINT2(40, "63cf4f703489a881baf63bacd6a3af2b5bde79b558ce123e97313890be6f747f", "0x4a3b"); //Hard fork to v15
ADD_CHECKPOINT2(45, "65da4c966ae02983c6c8b7ab9b959df612863c379c5e48669061cbbb1e02a3ab", "0x53ff"); //Hard fork to v16
ADD_CHECKPOINT2(50, "8c68a444b6743a14152f130357be9751e42e82a84f69f25320eda532a830c7b0", "0x5dc3"); //Hard fork to v17
return true;
}
if (nettype == STAGENET)
@@ -226,6 +215,16 @@ namespace cryptonote
ADD_CHECKPOINT2(307800, "3594894b4231cfdfe911afed6552f9fb4cfe6048bacd0973a3a98623ec8548ce", "0x308b305ca7618");
ADD_CHECKPOINT2(307880, "659274b698f680c6cae2716cbd4e15ad5def23b5de98e53734c4af2c2e74bb7a", "0x30af6e91e8018");
ADD_CHECKPOINT2(307883, "9a8c35cd10963a14bba8a9628d1776df92fee5e3153b7249f5d15726efafaaea", "0x30b0965ba5a18");
ADD_CHECKPOINT2(312130, "e0da085bd273fff9f5f8e604fce0e91908bc62b6b004731a93e16e89cb9b1f54", "0x3cfe7148f2e18");
ADD_CHECKPOINT2(324600, "b24cd1ed7c192bbcf3d5b15729f2b032566687f96bda6f8cb73a5b16df4c6e6b", "0x69caecbe78718");
ADD_CHECKPOINT2(327700, "f113c8cbe077aab9296ecbfb41780c147aeb54edfece7e4b9946b8abd0f06de7", "0x732431429c818");
ADD_CHECKPOINT2(331170, "05243fba853fe375c671a6783eecac28777bca51f5977d5285c235424e52bb69", "0x7c3469310d218"); //Hard fork to v18
ADD_CHECKPOINT2(331458, "f79a664a5e4bc11fa7d804be2c3c72db50c87a27f1f540f337564cbb6314e4cd", "0x7c34d47adf218"); //Hard fork to v19
ADD_CHECKPOINT2(331891, "faceea4b4ab33fc962c24dfa2f98c2aeda4788f67c1e0044c62419912c1a64fe", "0x7c359086aeb58"); // restart DIFFICULTY_WINDOW
ADD_CHECKPOINT2(332100, "d32c409058c1eceb9a105190c7a5f480b2d6f49f318b18652b49ae971c710124", "0x7c538441cca36");
ADD_CHECKPOINT2(334000, "17d3b15f8e1a73e1c61335ee7979e9e3d211b9055e8a7fb2481e5f49a51b1c22", "0x7ddd5a79d69c4");
ADD_CHECKPOINT2(348500, "2d43a157f369e2aa26a329b56456142ecd1361f5808c688d97112a2e3bbd23f4", "0x90889ed877ada");
ADD_CHECKPOINT2(489400, "b14f49eae77398117ea93435676100d8b655a804689f73a5a4d0d5e71160d603", "0x1123c39bb52f7e");
return true;
}

View File

@@ -44,11 +44,6 @@ using namespace epee;
static const char *DEFAULT_DNS_PUBLIC_ADDR[] =
{
"194.150.168.168", // CCC (Germany)
"80.67.169.40", // FDN (France)
"89.233.43.71", // http://censurfridns.dk (Denmark)
"109.69.8.51", // punCAT (Spain)
"193.58.251.251", // SkyDNS (Russia)
};
static boost::mutex instance_lock;
@@ -405,7 +400,7 @@ namespace dns_utils
std::string address_from_txt_record(const std::string& s)
{
// make sure the txt record has "oa1:xmr" and find it
auto pos = s.find("oa1:xmr");
auto pos = s.find("oa1:wow");
if (pos == std::string::npos)
return {};
// search from there to find "recipient_address="
@@ -417,14 +412,14 @@ std::string address_from_txt_record(const std::string& s)
auto pos2 = s.find(";", pos);
if (pos2 != std::string::npos)
{
// length of address == 95, we can at least validate that much here
if (pos2 - pos == 95)
// length of address == 97, we can at least validate that much here
if (pos2 - pos == 97)
{
return s.substr(pos, 95);
return s.substr(pos, 97);
}
else if (pos2 - pos == 106) // length of address == 106 --> integrated address
else if (pos2 - pos == 108) // length of address == 108 --> integrated address
{
return s.substr(pos, 106);
return s.substr(pos, 108);
}
}
return {};

View File

@@ -34,6 +34,7 @@
#include "file_io_utils.h"
#include "common/i18n.h"
#include "translation_files.h"
#include <algorithm>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "i18n"

View File

@@ -1,26 +0,0 @@
#pragma once
#include <stdint.h>
namespace tools
{
template<uint64_t a, uint64_t b>
struct PowerOf
{
enum Data : uint64_t
{
// a^b = a * a^(b-1)
Value = a * PowerOf<a, b - 1>::Value,
};
};
template<uint64_t a>
struct PowerOf<a, 0>
{
enum Data : uint64_t
{
// a^0 = 1
Value = 1,
};
};
}

View File

@@ -1009,13 +1009,13 @@ std::string get_nix_version_display_string()
for (char c: val)
{
if (c == '*')
newval += escape ? "*" : ".*", escape = false;
newval += escape ? "*" : ".*";
else if (c == '?')
newval += escape ? "?" : ".", escape = false;
newval += escape ? "?" : ".";
else if (c == '\\')
newval += '\\', escape = !escape;
else
newval += c, escape = false;
newval += c;
}
return newval;
}
@@ -1355,8 +1355,12 @@ std::string get_nix_version_display_string()
100743, 92152, 57565, 22533, 37564, 21823, 19980, 18277, 18402, 14344,
12142, 15842, 13677, 17631, 18294, 22270, 41422, 39296, 36688, 33512,
33831, 27582, 22276, 27516, 27317, 25505, 24426, 20566, 23045, 26766,
28185, 26169, 27011,
28642 // Blocks 1,990,000 to 1,999,999 in December 2019
28185, 26169, 27011, 28642, 34994, 34442, 30682, 34357, 31640, 41167,
41301, 48616, 51075, 55061, 49909, 44606, 47091, 53828, 42520, 39023,
55245, 56145, 51119, 60398, 71821, 48142, 60310, 56041, 54176, 66220,
56336, 55248, 56656, 63305, 54029, 77136, 71902, 71618, 83587, 81068,
69062, 54848, 53681, 53555,
50616 // Blocks 2,400,000 to 2,409,999 in July 2021
};
const uint64_t block_range_size = 10000;

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,13 @@ enum V4_Settings
// Always generate at least 60 instructions
NUM_INSTRUCTIONS = 60,
// Always generate at least 60 instructions
NUM_INSTRUCTIONS_MIN = 60,
// Never generate more than 70 instructions (final RET instruction doesn't count here)
NUM_INSTRUCTIONS_MAX = 70,
// Available ALUs for MUL
// Modern CPUs typically have only 1 ALU which can do multiplications
ALU_COUNT_MUL = 1,

View File

@@ -36,6 +36,14 @@ if(APPLE)
endif()
endif()
monero_add_library(cryptonote_format_utils_basic
cryptonote_format_utils_basic.cpp
)
target_link_libraries(cryptonote_format_utils_basic
PUBLIC
cncrypto
)
set(cryptonote_basic_sources
account.cpp
connection_context.cpp
@@ -72,6 +80,7 @@ target_link_libraries(cryptonote_basic
common
cncrypto
checkpoints
cryptonote_format_utils_basic
device
${Boost_DATE_TIME_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}

View File

@@ -77,6 +77,8 @@ namespace cryptonote
int m_expect_response;
uint64_t m_expect_height;
size_t m_num_requested;
epee::copyable_atomic m_new_stripe_notification{0};
epee::copyable_atomic m_idle_peer_notification{0};
};
inline std::string get_protocol_state_string(cryptonote_connection_context::state s)

View File

@@ -450,6 +450,8 @@ namespace cryptonote
uint64_t timestamp;
crypto::hash prev_id;
uint32_t nonce;
crypto::signature signature;
uint16_t vote;
BEGIN_SERIALIZE()
VARINT_FIELD(major_version)
@@ -457,6 +459,11 @@ namespace cryptonote
VARINT_FIELD(timestamp)
FIELD(prev_id)
FIELD(nonce)
if (major_version >= BLOCK_HEADER_MINER_SIG)
{
FIELD(signature)
FIELD(vote)
}
END_SERIALIZE()
};

View File

@@ -185,6 +185,11 @@ namespace boost
a & b.timestamp;
a & b.prev_id;
a & b.nonce;
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
{
a & b.signature;
a & b.vote;
}
//------------------
a & b.miner_tx;
a & b.tx_hashes;
@@ -227,6 +232,20 @@ namespace boost
a & x.t;
}
template <class Archive>
inline void serialize(Archive &a, rct::BulletproofPlus &x, const boost::serialization::version_type ver)
{
a & x.V;
a & x.A;
a & x.A1;
a & x.B;
a & x.r1;
a & x.s1;
a & x.d1;
a & x.L;
a & x.R;
}
template <class Archive>
inline void serialize(Archive &a, rct::boroSig &x, const boost::serialization::version_type ver)
{
@@ -305,7 +324,7 @@ namespace boost
a & x.type;
if (x.type == rct::RCTTypeNull)
return;
if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof && x.type != rct::RCTTypeBulletproof2 && x.type != rct::RCTTypeFullBulletproof && x.type != rct::RCTTypeSimpleBulletproof && x.type != rct::RCTTypeCLSAG)
if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof && x.type != rct::RCTTypeBulletproof2 && x.type != rct::RCTTypeFullBulletproof && x.type != rct::RCTTypeSimpleBulletproof && x.type != rct::RCTTypeCLSAG && x.type != rct::RCTTypeBulletproofPlus)
throw boost::archive::archive_exception(boost::archive::archive_exception::other_exception, "Unsupported rct type");
// a & x.message; message is not serialized, as it can be reconstructed from the tx data
// a & x.mixRing; mixRing is not serialized, as it can be reconstructed from the offsets
@@ -321,7 +340,11 @@ namespace boost
{
a & x.rangeSigs;
if (x.rangeSigs.empty())
{
a & x.bulletproofs;
if (ver >= 2u)
a & x.bulletproofs_plus;
}
a & x.MGs;
if (ver >= 1u)
a & x.CLSAGs;
@@ -335,7 +358,7 @@ namespace boost
a & x.type;
if (x.type == rct::RCTTypeNull)
return;
if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof && x.type != rct::RCTTypeBulletproof2 && x.type != rct::RCTTypeFullBulletproof && x.type != rct::RCTTypeSimpleBulletproof && x.type != rct::RCTTypeCLSAG)
if (x.type != rct::RCTTypeFull && x.type != rct::RCTTypeSimple && x.type != rct::RCTTypeBulletproof && x.type != rct::RCTTypeBulletproof2 && x.type != rct::RCTTypeFullBulletproof && x.type != rct::RCTTypeSimpleBulletproof && x.type != rct::RCTTypeCLSAG && x.type != rct::RCTTypeBulletproofPlus)
throw boost::archive::archive_exception(boost::archive::archive_exception::other_exception, "Unsupported rct type");
// a & x.message; message is not serialized, as it can be reconstructed from the tx data
// a & x.mixRing; mixRing is not serialized, as it can be reconstructed from the offsets
@@ -347,11 +370,15 @@ namespace boost
//--------------
a & x.p.rangeSigs;
if (x.p.rangeSigs.empty())
{
a & x.p.bulletproofs;
if (ver >= 2u)
a & x.p.bulletproofs_plus;
}
a & x.p.MGs;
if (ver >= 1u)
a & x.p.CLSAGs;
if (x.type == rct::RCTTypeBulletproof || x.type == rct::RCTTypeBulletproof2 || x.type == rct::RCTTypeSimpleBulletproof || x.type == rct::RCTTypeCLSAG)
if (x.type == rct::RCTTypeBulletproof || x.type == rct::RCTTypeBulletproof2 || x.type == rct::RCTTypeSimpleBulletproof || x.type == rct::RCTTypeCLSAG || x.type == rct::RCTTypeBulletproofPlus)
a & x.p.pseudoOuts;
}
@@ -392,6 +419,6 @@ namespace boost
}
}
BOOST_CLASS_VERSION(rct::rctSigPrunable, 1)
BOOST_CLASS_VERSION(rct::rctSig, 1)
BOOST_CLASS_VERSION(rct::rctSigPrunable, 2)
BOOST_CLASS_VERSION(rct::rctSig, 2)
BOOST_CLASS_VERSION(rct::multisig_out, 1)

View File

@@ -105,7 +105,8 @@ namespace cryptonote
uint64_t get_transaction_weight_clawback(const transaction &tx, size_t n_padded_outputs)
{
const rct::rctSig &rv = tx.rct_signatures;
const uint64_t bp_base = 368;
const bool plus = rv.type == rct::RCTTypeBulletproofPlus;
const uint64_t bp_base = (32 * ((plus ? 6 : 9) + 7 * 2)) / 2; // notional size of a 2 output proof, normalized to 1 proof (ie, divided by 2)
const size_t n_outputs = tx.vout.size();
if (n_padded_outputs <= 2)
return 0;
@@ -113,7 +114,7 @@ namespace cryptonote
while ((1u << nlr) < n_padded_outputs)
++nlr;
nlr += 6;
const size_t bp_size = 32 * (9 + 2 * nlr);
const size_t bp_size = 32 * ((plus ? 6 : 9) + 2 * nlr);
CHECK_AND_ASSERT_THROW_MES_L1(n_outputs <= BULLETPROOF_MAX_OUTPUTS, "maximum number of outputs is " + std::to_string(BULLETPROOF_MAX_OUTPUTS) + " per transaction");
CHECK_AND_ASSERT_THROW_MES_L1(bp_base * n_padded_outputs >= bp_size, "Invalid bulletproof clawback: bp_base " + std::to_string(bp_base) + ", n_padded_outputs "
+ std::to_string(n_padded_outputs) + ", bp_size " + std::to_string(bp_size));
@@ -139,22 +140,6 @@ namespace cryptonote
return h;
}
//---------------------------------------------------------------
void get_transaction_prefix_hash(const transaction_prefix& tx, crypto::hash& h)
{
std::ostringstream s;
binary_archive<true> a(s);
::serialization::serialize(a, const_cast<transaction_prefix&>(tx));
crypto::cn_fast_hash(s.str().data(), s.str().size(), h);
}
//---------------------------------------------------------------
crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx)
{
crypto::hash h = null_hash;
get_transaction_prefix_hash(tx, h);
return h;
}
//---------------------------------------------------------------
bool expand_transaction_1(transaction &tx, bool base_only)
{
if (tx.version >= 2 && !is_coinbase(tx))
@@ -179,6 +164,31 @@ namespace cryptonote
if (!base_only)
{
const bool bulletproof_plus = rct::is_rct_bulletproof_plus(rv.type);
if (bulletproof_plus)
{
if (rv.p.bulletproofs_plus.size() != 1)
{
LOG_PRINT_L1("Failed to parse transaction from blob, bad bulletproofs_plus size in tx " << get_transaction_hash(tx));
return false;
}
if (rv.p.bulletproofs_plus[0].L.size() < 6)
{
LOG_PRINT_L1("Failed to parse transaction from blob, bad bulletproofs_plus L size in tx " << get_transaction_hash(tx));
return false;
}
const size_t max_outputs = 1 << (rv.p.bulletproofs_plus[0].L.size() - 6);
if (max_outputs < tx.vout.size())
{
LOG_PRINT_L1("Failed to parse transaction from blob, bad bulletproofs_plus max outputs in tx " << get_transaction_hash(tx));
return false;
}
const size_t n_amounts = tx.vout.size();
CHECK_AND_ASSERT_MES(n_amounts == rv.outPk.size(), false, "Internal error filling out V");
rv.p.bulletproofs_plus[0].V.resize(n_amounts);
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))
{
@@ -444,15 +454,16 @@ namespace cryptonote
if (tx.version < 2)
return blob_size;
const rct::rctSig &rv = tx.rct_signatures;
if (!rct::is_rct_bulletproof(rv.type))
const bool bulletproof = rct::is_rct_bulletproof(rv.type);
const bool bulletproof_plus = rct::is_rct_bulletproof_plus(rv.type);
if (!bulletproof && !bulletproof_plus)
return blob_size;
const size_t n_outputs = tx.vout.size();
if (n_outputs <= 2)
return blob_size;
if (rct::is_rct_old_bulletproof(rv.type))
return blob_size;
const uint64_t bp_base = 368;
const size_t n_padded_outputs = rct::n_bulletproof_max_amounts(rv.p.bulletproofs);
const size_t n_padded_outputs = bulletproof_plus ? rct::n_bulletproof_plus_max_amounts(rv.p.bulletproofs_plus) : rct::n_bulletproof_max_amounts(rv.p.bulletproofs);
uint64_t bp_clawback = get_transaction_weight_clawback(tx, n_padded_outputs);
CHECK_AND_ASSERT_THROW_MES_L1(bp_clawback <= std::numeric_limits<uint64_t>::max() - blob_size, "Weight overflow");
return blob_size + bp_clawback;
@@ -462,7 +473,7 @@ namespace cryptonote
{
CHECK_AND_ASSERT_MES(tx.pruned, std::numeric_limits<uint64_t>::max(), "get_pruned_transaction_weight does not support non pruned txes");
CHECK_AND_ASSERT_MES(tx.version >= 2, std::numeric_limits<uint64_t>::max(), "get_pruned_transaction_weight does not support v1 txes");
CHECK_AND_ASSERT_MES(tx.rct_signatures.type >= rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG,
CHECK_AND_ASSERT_MES(tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG || tx.rct_signatures.type == rct::RCTTypeBulletproofPlus,
std::numeric_limits<uint64_t>::max(), "get_pruned_transaction_weight does not support older range proof types");
CHECK_AND_ASSERT_MES(!tx.vin.empty(), std::numeric_limits<uint64_t>::max(), "empty vin");
CHECK_AND_ASSERT_MES(tx.vin[0].type() == typeid(cryptonote::txin_to_key), std::numeric_limits<uint64_t>::max(), "empty vin");
@@ -481,12 +492,12 @@ namespace cryptonote
while ((n_padded_outputs = (1u << nrl)) < tx.vout.size())
++nrl;
nrl += 6;
extra = 32 * (9 + 2 * nrl) + 2;
extra = 32 * ((rct::is_rct_bulletproof_plus(tx.rct_signatures.type) ? 6 : 9) + 2 * nrl) + 2;
weight += extra;
// calculate deterministic CLSAG/MLSAG data size
const size_t ring_size = boost::get<cryptonote::txin_to_key>(tx.vin[0]).key_offsets.size();
if (tx.rct_signatures.type == rct::RCTTypeCLSAG)
if (tx.rct_signatures.type == rct::RCTTypeCLSAG || tx.rct_signatures.type == rct::RCTTypeBulletproofPlus)
extra = tx.vin.size() * (ring_size + 2) * 32;
else
extra = tx.vin.size() * (ring_size * (1 + 1) * 32 + 32 /* cc */);
@@ -1002,9 +1013,9 @@ namespace cryptonote
switch (decimal_point)
{
case 11:
case 9:
case 6:
case 3:
case 8:
case 5:
case 2:
case 0:
default_decimal_point = decimal_point;
break;
@@ -1026,14 +1037,14 @@ namespace cryptonote
{
case 11:
return "wownero";
case 9:
return "millinero";
case 6:
return "micronero";
case 3:
return "nanonero";
case 8:
return "verywow";
case 5:
return "muchwow";
case 2:
return "suchwow";
case 0:
return "piconero";
return "dust";
default:
ASSERT_MES_AND_THROW("Invalid decimal point specification: " << decimal_point);
}
@@ -1302,6 +1313,25 @@ namespace cryptonote
return p;
}
//---------------------------------------------------------------
crypto::hash get_sig_data(const block& b)
{
crypto::hash sig_data;
blobdata blob = get_block_hashing_blob_sig_data(b);
crypto::cn_fast_hash(blob.data(), blob.size(), sig_data);
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

@@ -120,6 +120,8 @@ namespace cryptonote
bool calculate_block_hash(const block& b, crypto::hash& res, const blobdata_ref *blob = NULL);
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

@@ -1,4 +1,4 @@
// Copyright (c) 2020, The Monero Project
// Copyright (c) 2014-2021, The Monero Project
//
// All rights reserved.
//
@@ -25,30 +25,25 @@
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <cstdint>
#include <gtest/gtest.h>
#include "cryptonote_format_utils.h"
#include "storages/portable_storage.h"
TEST(epee_binary, two_keys)
namespace cryptonote
{
static constexpr const std::uint8_t data[] = {
0x01, 0x11, 0x01, 0x1, 0x01, 0x01, 0x02, 0x1, 0x1, 0x08, 0x01, 'a',
0x0B, 0x00, 0x01, 'b', 0x0B, 0x00
};
void get_transaction_prefix_hash(const transaction_prefix& tx, crypto::hash& h)
{
std::ostringstream s;
binary_archive<true> a(s);
::serialization::serialize(a, const_cast<transaction_prefix&>(tx));
crypto::cn_fast_hash(s.str().data(), s.str().size(), h);
}
epee::serialization::portable_storage storage{};
EXPECT_TRUE(storage.load_from_binary(data));
}
TEST(epee_binary, duplicate_key)
{
static constexpr const std::uint8_t data[] = {
0x01, 0x11, 0x01, 0x1, 0x01, 0x01, 0x02, 0x1, 0x1, 0x08, 0x01, 'a',
0x0B, 0x00, 0x01, 'a', 0x0B, 0x00
};
epee::serialization::portable_storage storage{};
EXPECT_FALSE(storage.load_from_binary(data));
crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx)
{
crypto::hash h = crypto::null_hash;
get_transaction_prefix_hash(tx, h);
return h;
}
}

View File

@@ -208,12 +208,16 @@ namespace cryptonote {
timestamps.resize(DIFFICULTY_WINDOW);
cumulative_difficulties.resize(DIFFICULTY_WINDOW);
}
size_t length = timestamps.size();
assert(length == cumulative_difficulties.size());
if (length <= 1) {
return 1;
}
if (HEIGHT < 200 && HEIGHT > 2 && m_nettype == TESTNET) { return 500; }
if (HEIGHT < 10 && HEIGHT > 2 && m_nettype == TESTNET) { return 500; }
if (HEIGHT <= 55 + DIFFICULTY_WINDOW && HEIGHT >= 55 && m_nettype == TESTNET) { return 1337; }
if (HEIGHT <= DIFFICULTY_RESET_HEIGHT + DIFFICULTY_WINDOW && HEIGHT >= DIFFICULTY_RESET_HEIGHT && m_nettype == MAINNET) { return DIFFICULTY_RESET_LEVEL; }
static_assert(DIFFICULTY_WINDOW >= 2, "Window is too small");
assert(length <= DIFFICULTY_WINDOW);
sort(timestamps.begin(), timestamps.end());
@@ -375,7 +379,16 @@ namespace cryptonote {
if (HEIGHT < 200 && m_nettype == TESTNET) { return 500; }
assert(timestamps.size() == N+1);
uint64_t L(0), next_D, i, this_timestamp(0), previous_timestamp(0), avg_D;
// hardcoding previously erroneously calculated difficulty entries
if(HEIGHT == 307686) return 25800000;
if(HEIGHT == 307692) return 1890000;
if(HEIGHT == 307735) return 17900000;
if(HEIGHT == 307742) return 21300000;
if(HEIGHT == 307750) return 10900000;
if(HEIGHT == 307766) return 2960000;
uint64_t i, this_timestamp(0), previous_timestamp(0);
difficulty_type L(0), next_D, avg_D;
previous_timestamp = timestamps[0]-T;
for ( i = 1; i <= N; i++) {
@@ -386,7 +399,7 @@ namespace cryptonote {
previous_timestamp = this_timestamp;
}
if (L < N*N*T/20 ) { L = N*N*T/20; }
avg_D = static_cast<uint64_t>(( cumulative_difficulties[N] - cumulative_difficulties[0] )/ N);
avg_D = ( cumulative_difficulties[N] - cumulative_difficulties[0] )/ N;
// Prevent round off error for small D and overflow for large D.
if (avg_D > 2000000*N*N*T && HEIGHT < 307800) {

View File

@@ -99,6 +99,8 @@ namespace cryptonote
const command_line::arg_descriptor<uint64_t> arg_bg_mining_min_idle_interval_seconds = {"bg-mining-min-idle-interval", "Specify min lookback interval in seconds for determining idle state", miner::BACKGROUND_MINING_DEFAULT_MIN_IDLE_INTERVAL_IN_SECONDS, 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<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};
}
@@ -291,10 +293,42 @@ namespace cryptonote
command_line::add_arg(desc, arg_bg_mining_min_idle_interval_seconds);
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)
{
if(command_line::has_arg(vm, arg_spendkey))
{
std::string skey_str = command_line::get_arg(vm, arg_spendkey);
crypto::secret_key spendkey;
epee::string_tools::hex_to_pod(skey_str, spendkey);
crypto::secret_key viewkey;
keccak((uint8_t *)&spendkey, 32, (uint8_t *)&viewkey, 32);
sc_reduce32((uint8_t *)&viewkey);
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;
@@ -525,7 +559,7 @@ namespace cryptonote
{
uint32_t th_local_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index);
MLOG_SET_THREAD_NAME(std::string("[miner ") + std::to_string(th_local_index) + "]");
MGINFO("Miner thread was started ["<< th_local_index << "]");
MGINFO_GREEN("*Spins roulette wheel*... Mining started. Good luck!");
uint32_t nonce = m_starter_nonce + th_local_index;
uint64_t height = 0;
difficulty_type local_diff = 0;
@@ -573,6 +607,28 @@ namespace cryptonote
}
b.nonce = nonce;
// Miner Block Header Signing
if (b.major_version >= BLOCK_HEADER_MINER_SIG)
{
// tx key derivation
crypto::key_derivation derivation;
cryptonote::keypair in_ephemeral;
crypto::secret_key eph_secret_key;
crypto::public_key tx_pub_key = get_tx_pub_key_from_extra(b.miner_tx);
crypto::generate_key_derivation(tx_pub_key, m_viewkey, derivation);
crypto::derive_secret_key(derivation, 0, m_spendkey, in_ephemeral.sec);
eph_secret_key = in_ephemeral.sec;
// keccak hash and sign block header data
crypto::signature signature;
crypto::hash sig_data = get_sig_data(b);
crypto::public_key eph_pub_key = boost::get<txout_to_key>(b.miner_tx.vout[0].target).key;
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;
m_gbh(b, height, NULL, tools::get_max_concurrency(), h);
@@ -580,7 +636,42 @@ namespace cryptonote
{
//we lucky!
++m_config.current_extra_message_index;
MGINFO_GREEN("Found block " << get_block_hash(b) << " at height " << height << " for difficulty: " << local_diff);
MGINFO_YELLOW(ENDL <<
" ╦ ╦┬┌┐┌┐┌┌─┐┬─┐ ┬ ┬┬┌┐┌┐┌┌─┐┬─┐ ┌─┐┬ ┬┬┌─┐┬┌─┌─┐┌┐┌ ┌┬┐┬┌┐┌┐┌┌─┐┬─┐ ||\n"
" ║║║││││││├┤ ├┬┘ │││││││││├┤ ├┬┘ │ ├─┤││ ├┴┐├┤ │││ ││││││││├┤ ├┬┘ ||\n"
" ╚╩╝┴┘└┘└┘└─┘┴└─ └┴┘┴┘└┘└┘└─┘┴└─ └─┘┴ ┴┴└─┘┴ ┴└─┘┘└┘ ─┴┘┴┘└┘└┘└─┘┴└─ ()\n"
<< ENDL);
MGINFO_MAGENTA(ENDL <<
"\n\n"
" //@@@@@@@@@@@@@@@@@// \n"
" //%%%%%%%%%%%%%%%%%%%%%%%%%%%/% \n"
" @/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/ \n"
" //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/& \n"
" /%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/ \n"
" &/%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%/ \n"
" ////////////%%%%%%%%%%%%%%%%%%%%%%#//////////// \n"
" /@@////////@@/%%%%%%%%%%%%%%%%%%%%%/@@////////@@/ \n"
" /@@////////@@/%%%%%%%%/@@#/%%%%%%%%/@@////////@@/ \n"
" /@@/////////@@/%%%%%%/@@@/@@@/%%%%%%/@@////////#@/ \n"
" /@&////////@@/%%%%/@@@/////@@@/%%%%/@@////////@@/ \n"
" /@@////////@@/%(/@@///////////@@/%%/@@////////@@/ \n"
" /@@////////@/@@@///////////////@@&@@////////@@/ \n"
" /@@///////@@@///////////////////@@@///////@@/ \n"
" /@@//////@///////////////////////@//////@@/ \n"
" #/@@/////////////////////////////////@@/ \n"
" /@@@///////////////////////////@@@/ \n"
" %/@@@@///////////////////@@@@/ \n"
" //@@@@@@@@@@@@@@@@@// \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

@@ -136,6 +136,10 @@ namespace cryptonote
i_miner_handler* m_phandler;
get_block_hash_t m_gbh;
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

@@ -40,9 +40,12 @@
#define CRYPTONOTE_MAX_TX_SIZE 1000000
#define CRYPTONOTE_MAX_TX_PER_BLOCK 0x10000000
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2 288
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60
#define CURRENT_TRANSACTION_VERSION 2
#define CURRENT_BLOCK_MAJOR_VERSION 7
#define CURRENT_BLOCK_MINOR_VERSION 7
#define BLOCK_HEADER_MINER_SIG 18
#define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V2 300*2
#define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2
#define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 4
@@ -87,6 +90,9 @@
#define DIFFICULTY_BLOCKS_COUNT_V3 DIFFICULTY_WINDOW_V3 + 1 // added +1 to make N=N
#define DIFFICULTY_BLOCKS_COUNT_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
#define DIFFICULTY_RESET_HEIGHT 331170// ~July 4, 2021 Pool Independence Day
#define DIFFICULTY_RESET_LEVEL 100000000 // 100 mill
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
@@ -161,7 +167,6 @@
#define RPC_IP_FAILS_BEFORE_BLOCK 3
#define CRYPTONOTE_NAME "wownero"
#define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin"
#define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "data.mdb"
#define CRYPTONOTE_BLOCKCHAINDATA_LOCK_FILENAME "lock.mdb"
#define P2P_NET_DATA_FILENAME "p2pstate.bin"
@@ -188,6 +193,8 @@
#define HF_VERSION_CLSAG 16
#define HF_VERSION_DETERMINISTIC_UNLOCK_TIME 16
#define HF_VERSION_DYNAMIC_UNLOCK 16
#define HF_VERSION_FIXED_UNLOCK 18
#define HF_VERSION_BULLETPROOF_PLUS 18
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8
@@ -196,6 +203,7 @@
#define DEFAULT_TXPOOL_MAX_WEIGHT 648000000ull // 3 days at 300000, in bytes
#define BULLETPROOF_MAX_OUTPUTS 16
#define BULLETPROOF_PLUS_MAX_OUTPUTS 16
#define CRYPTONOTE_PRUNING_STRIPE_SIZE 4096 // the smaller, the smoother the increase
#define CRYPTONOTE_PRUNING_LOG_STRIPES 3 // the higher, the more space saved
@@ -228,6 +236,8 @@ namespace config
// Hash domain separators
const char HASH_KEY_BULLETPROOF_EXPONENT[] = "bulletproof";
const char HASH_KEY_BULLETPROOF_PLUS_EXPONENT[] = "bulletproof_plus";
const char HASH_KEY_BULLETPROOF_PLUS_TRANSCRIPT[] = "bulletproof_plus_transcript";
const char HASH_KEY_RINGDB[] = "ringdsb";
const char HASH_KEY_SUBADDRESS[] = "SubAddr";
const unsigned char HASH_KEY_ENCRYPTED_PAYMENT_ID = 0x8d;

View File

@@ -865,7 +865,7 @@ start:
ss << "Re-locked, height " << height << ", tail id " << new_top_hash << (new_top_hash == top_hash ? "" : " (different)") << std::endl;
top_hash = new_top_hash;
uint8_t version = get_current_hard_fork_version();
uint64_t difficulty_blocks_count = version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
uint64_t difficulty_blocks_count = version <= 17 && version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
// ND: Speedup
// 1. Keep a list of the last 735 (or less) blocks that is used to compute difficulty,
@@ -948,7 +948,7 @@ start:
difficulty_type diff = next_difficulty(timestamps, m_nettype, difficulties, target, HEIGHT);
if (version >= 11) {
if (version <= 17 && version >= 11) {
diff = next_difficulty_v5(timestamps, m_nettype, difficulties, T, N, HEIGHT);
} else if (version == 10) {
diff = next_difficulty_v4(timestamps, m_nettype, difficulties, HEIGHT);
@@ -983,7 +983,7 @@ start:
MGINFO("START DUMP");
MGINFO(ss.str());
MGINFO("END DUMP");
MGINFO("Please send wowario on Freenode #wownero-dev the contents of this log, from a couple dozen lines before START DUMP to END DUMP");
MGINFO("Please send wowario on IRC OTFC #wownero-dev the contents of this log, from a couple dozen lines before START DUMP to END DUMP");
}
return diff;
}
@@ -1015,7 +1015,7 @@ size_t Blockchain::recalculate_difficulties(boost::optional<uint64_t> start_heig
const uint64_t top_height = m_db->height() - 1;
MGINFO("Recalculating difficulties from height " << start_height << " to height " << top_height);
uint8_t version = get_current_hard_fork_version();
uint64_t difficulty_blocks_count = version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
uint64_t difficulty_blocks_count = version <= 17 && version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
std::vector<uint64_t> timestamps;
std::vector<difficulty_type> difficulties;
timestamps.reserve(difficulty_blocks_count + 1);
@@ -1043,7 +1043,7 @@ size_t Blockchain::recalculate_difficulties(boost::optional<uint64_t> start_heig
size_t target = get_ideal_hard_fork_version(height) < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;
difficulty_type recalculated_diff = next_difficulty(timestamps, m_nettype, difficulties, target, HEIGHT);
if (version >= 11) {
if (version <= 17 && version >= 11) {
recalculated_diff = next_difficulty_v5(timestamps, m_nettype, difficulties, T, N, HEIGHT);
} else if (version == 10) {
recalculated_diff = next_difficulty_v4(timestamps, m_nettype, difficulties, HEIGHT);
@@ -1297,8 +1297,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
std::vector<difficulty_type> cumulative_difficulties;
uint8_t version = get_current_hard_fork_version();
size_t height = m_db->height();
size_t difficulty_blocks_count = version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
size_t difficulty_blocks_count = version <= 17 && version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
// if the alt chain isn't long enough to calculate the difficulty target
// based on its blocks alone, need to get more blocks from the main chain
@@ -1357,7 +1356,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
uint64_t HEIGHT = m_db->height();
// calculate the difficulty target for the block and return it
if (version >= 11) {
if (version <= 17 && version >= 11) {
return next_difficulty_v5(timestamps, m_nettype, cumulative_difficulties, T, N, HEIGHT);
} else if (version == 10) {
return next_difficulty_v4(timestamps, m_nettype, cumulative_difficulties, HEIGHT);
@@ -1378,6 +1377,40 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
// a non-overflowing tx amount (dubious necessity on this check)
bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height, uint8_t hf_version)
{
// Miner Block Header Signing
if (hf_version >= BLOCK_HEADER_MINER_SIG)
{
// sanity checks
if (b.miner_tx.vout.size() != 1)
{
MWARNING("Only 1 output in miner transaction allowed");
return false;
}
if (b.miner_tx.vout[0].target.type() != typeid(txout_to_key))
{
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);
crypto::signature signature = b.signature;
crypto::public_key eph_pub_key = boost::get<txout_to_key>(b.miner_tx.vout[0].target).key;
if (!crypto::check_signature(sig_data, eph_pub_key, signature))
{
MWARNING("Miner signature is invalid");
return false;
} else {
LOG_PRINT_L1("Miner signature is good");
LOG_PRINT_L1("Vote: " << b.vote);
}
}
LOG_PRINT_L3("Blockchain::" << __func__);
CHECK_AND_ASSERT_MES(b.miner_tx.vin.size() == 1, false, "coinbase transaction in the block has no inputs");
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type");
@@ -1396,12 +1429,11 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
}
MDEBUG("Miner tx hash: " << get_transaction_hash(b.miner_tx));
// Dynamic unlock time from HF 16
// To calculate unlock window, get the block hash at height-1337, convert the
// first 3 characters from hexadecimal to decimal, multiply by 2, and then add 288.
// Unlock minimum 1 day (288 blocks), maximum is ~29 days ((4095*2)+288 = 8478 blocks)
// unlock time = unlock_window + height
if (hf_version >= HF_VERSION_DYNAMIC_UNLOCK)
if (hf_version >= HF_VERSION_FIXED_UNLOCK)
{
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2, false, "coinbase transaction transaction has the wrong unlock time="
<< b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2);
} else if (hf_version < HF_VERSION_FIXED_UNLOCK && hf_version >= HF_VERSION_DYNAMIC_UNLOCK)
{
uint64_t N = m_nettype == MAINNET ? 1337 : 5;
crypto::hash blk_id = get_block_id_by_height(height-N);
@@ -1418,8 +1450,8 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
"\nblk_height: " << height-N << ", blk_id: " << blk_id <<
"\nhex_str: " << hex_str << ", blk_num: " << blk_num);
} else {
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + 60, false, "coinbase transaction transaction has the wrong unlock time="
<< b.miner_tx.unlock_time << ", expected " << height + 60);
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "coinbase transaction transaction has the wrong unlock time="
<< b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW);
}
//check outs overflow
@@ -1865,6 +1897,7 @@ bool Blockchain::complete_timestamps_vector(uint64_t start_top_height, std::vect
LOG_PRINT_L3("Blockchain::" << __func__);
uint8_t version = get_current_hard_fork_version();
size_t blockchain_timestamp_check_window = version >= 10 ? BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW_V2 : BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW;
if(timestamps.size() >= blockchain_timestamp_check_window)
return true;
@@ -3179,6 +3212,32 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
}
}
// from v18, allow bulletproofs plus
if (hf_version < HF_VERSION_BULLETPROOF_PLUS) {
if (tx.version >= 2) {
const bool bulletproof_plus = rct::is_rct_bulletproof_plus(tx.rct_signatures.type);
if (bulletproof_plus || !tx.rct_signatures.p.bulletproofs_plus.empty())
{
MERROR_VER("Bulletproofs plus are not allowed before v" << std::to_string(HF_VERSION_BULLETPROOF_PLUS));
tvc.m_invalid_output = true;
return false;
}
}
}
// from v19, forbid bulletproofs
if (hf_version > HF_VERSION_BULLETPROOF_PLUS) {
if (tx.version >= 2) {
const bool bulletproof = rct::is_rct_bulletproof(tx.rct_signatures.type);
if (bulletproof)
{
MERROR_VER("Bulletproof range proofs are not allowed after v" + std::to_string(HF_VERSION_BULLETPROOF_PLUS));
tvc.m_invalid_output = true;
return false;
}
}
}
return true;
}
//------------------------------------------------------------------
@@ -3219,7 +3278,7 @@ bool Blockchain::expand_transaction_2(transaction &tx, const crypto::hash &tx_pr
}
}
}
else if (rv.type == rct::RCTTypeSimple || rv.type == rct::RCTTypeBulletproof || rv.type == rct::RCTTypeBulletproof2 || rv.type == rct::RCTTypeSimpleBulletproof || rv.type == rct::RCTTypeCLSAG)
else if (rv.type == rct::RCTTypeSimple || rv.type == rct::RCTTypeBulletproof || rv.type == rct::RCTTypeBulletproof2 || rv.type == rct::RCTTypeSimpleBulletproof || rv.type == rct::RCTTypeCLSAG || rv.type == rct::RCTTypeBulletproofPlus)
{
CHECK_AND_ASSERT_MES(!pubkeys.empty() && !pubkeys[0].empty(), false, "empty pubkeys");
rv.mixRing.resize(pubkeys.size());
@@ -3232,6 +3291,14 @@ bool Blockchain::expand_transaction_2(transaction &tx, const crypto::hash &tx_pr
}
}
}
else if (rv.type == rct::RCTTypeCLSAG)
{
CHECK_AND_ASSERT_MES(rv.p.CLSAGs.size() == tx.vin.size(), false, "Bad CLSAGs size");
for (size_t n = 0; n < tx.vin.size(); ++n)
{
rv.p.CLSAGs[n].I = rct::ki2rct(boost::get<txin_to_key>(tx.vin[n]).k_image);
}
}
else
{
CHECK_AND_ASSERT_MES(false, false, "Unsupported rct tx type: " + boost::lexical_cast<std::string>(rv.type));
@@ -3260,7 +3327,7 @@ bool Blockchain::expand_transaction_2(transaction &tx, const crypto::hash &tx_pr
}
}
}
else if (rv.type == rct::RCTTypeCLSAG)
else if (rv.type == rct::RCTTypeCLSAG || rv.type == rct::RCTTypeBulletproofPlus)
{
if (!tx.pruned)
{
@@ -3365,9 +3432,9 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
}
}
if (((hf_version == HF_VERSION_MIN_MIXIN_21 || hf_version == HF_VERSION_MIN_MIXIN_21+1) && min_actual_mixin != 21) || (hf_version >= HF_VERSION_MIN_MIXIN_21+2 && min_actual_mixin > 21))
if (((hf_version == HF_VERSION_MIN_MIXIN_21 || hf_version == HF_VERSION_MIN_MIXIN_21+1) && min_actual_mixin != 10) || (hf_version >= HF_VERSION_MIN_MIXIN_21+2 && min_actual_mixin > 21))
{
MERROR_VER("Tx " << get_transaction_hash(tx) << " has invalid ring size (" << (min_actual_mixin + 1) << "), it should be 22");
MERROR_VER("Tx " << get_transaction_hash(tx) << " has invalid ring size (" << (min_actual_mixin + 1) << "), it should be 11");
tvc.m_low_mixin = true;
return false;
}
@@ -3554,6 +3621,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
case rct::RCTTypeBulletproof:
case rct::RCTTypeBulletproof2:
case rct::RCTTypeCLSAG:
case rct::RCTTypeBulletproofPlus:
{
// check all this, either reconstructed (so should really pass), or not
{
@@ -3589,7 +3657,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
}
}
const size_t n_sigs = rv.type == rct::RCTTypeCLSAG ? rv.p.CLSAGs.size() : rv.p.MGs.size();
const size_t n_sigs = rv.type == rct::RCTTypeCLSAG || rv.type == rct::RCTTypeBulletproofPlus ? rv.p.CLSAGs.size() : rv.p.MGs.size();
if (n_sigs != tx.vin.size())
{
MERROR_VER("Failed to check ringct signatures: mismatched MGs/vin sizes");
@@ -3598,7 +3666,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc,
for (size_t n = 0; n < tx.vin.size(); ++n)
{
bool error;
if (rv.type == rct::RCTTypeCLSAG)
if (rv.type == rct::RCTTypeCLSAG || rv.type == rct::RCTTypeBulletproofPlus)
error = memcmp(&boost::get<txin_to_key>(tx.vin[n]).k_image, &rv.p.CLSAGs[n].I, 32);
else
error = rv.p.MGs[n].II.empty() || memcmp(&boost::get<txin_to_key>(tx.vin[n]).k_image, &rv.p.MGs[n].II[0], 32);
@@ -3714,6 +3782,19 @@ void Blockchain::check_ring_signature(const crypto::hash &tx_prefix_hash, const
result = crypto::check_ring_signature(tx_prefix_hash, key_image, p_output_keys, sig.data()) ? 1 : 0;
}
//------------------------------------------------------------------
uint64_t Blockchain::get_fee_quantization_mask()
{
static uint64_t mask = 0;
if (mask == 0)
{
mask = 1;
for (size_t n = PER_KB_FEE_QUANTIZATION_DECIMALS; n < CRYPTONOTE_DISPLAY_DECIMAL_POINT; ++n)
mask *= 10;
}
return mask;
}
//------------------------------------------------------------------
uint64_t Blockchain::get_dynamic_base_fee(uint64_t block_reward, size_t median_block_weight, uint8_t version)
{
@@ -5460,7 +5541,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
static const char expected_block_hashes_hash[] = "392961db5c3578616c40283e5469f5fae7f628a0b4a13c87db9339cad35f8e53";
static const char expected_block_hashes_hash[] = "cdb3d018fc4c2505619423a24b2d694348103df9af9a3f4f0cc203f4e21363bd";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)

View File

@@ -51,7 +51,6 @@
#include "string_tools.h"
#include "rolling_median.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "common/powerof.h"
#include "common/util.h"
#include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "rpc/core_rpc_server_commands_defs.h"
@@ -595,10 +594,7 @@ namespace cryptonote
*
* @return the fee quantized mask
*/
static uint64_t get_fee_quantization_mask()
{
return tools::PowerOf<10, CRYPTONOTE_DISPLAY_DECIMAL_POINT - PER_KB_FEE_QUANTIZATION_DECIMALS>::Value;
}
static uint64_t get_fee_quantization_mask();
/**
* @brief get dynamic per kB or byte fee for a given block weight

View File

@@ -56,6 +56,9 @@ using namespace epee;
#include "common/notify.h"
#include "hardforks/hardforks.h"
#include "version.h"
#include <iostream>
#include <fstream>
#include <string>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "cn"
@@ -913,6 +916,16 @@ namespace cryptonote
return true;
}
//-----------------------------------------------------------------------------------------------
static bool is_canonical_bulletproof_plus_layout(const std::vector<rct::BulletproofPlus> &proofs)
{
if (proofs.size() != 1)
return false;
const size_t sz = proofs[0].V.size();
if (sz == 0 || sz > BULLETPROOF_PLUS_MAX_OUTPUTS)
return false;
return true;
}
//-----------------------------------------------------------------------------------------------
bool core::handle_incoming_tx_accumulated_batch(std::vector<tx_verification_batch_info> &tx_info, bool keeped_by_block)
{
bool ret = true;
@@ -979,6 +992,17 @@ namespace cryptonote
}
rvv.push_back(&rv); // delayed batch verification
break;
case rct::RCTTypeBulletproofPlus:
if (!is_canonical_bulletproof_plus_layout(rv.p.bulletproofs_plus))
{
MERROR_VER("Bulletproof_plus does not have canonical form");
set_semantics_failed(tx_info[n].tx_hash);
tx_info[n].tvc.m_verifivation_failed = true;
tx_info[n].result = false;
break;
}
rvv.push_back(&rv); // delayed batch verification
break;
default:
MERROR_VER("Unknown rct type: " << rv.type);
set_semantics_failed(tx_info[n].tx_hash);
@@ -996,7 +1020,7 @@ namespace cryptonote
{
if (!tx_info[n].result)
continue;
if (tx_info[n].tx->rct_signatures.type != rct::RCTTypeBulletproof && tx_info[n].tx->rct_signatures.type != rct::RCTTypeBulletproof2 && tx_info[n].tx->rct_signatures.type != rct::RCTTypeCLSAG)
if (tx_info[n].tx->rct_signatures.type != rct::RCTTypeBulletproof && tx_info[n].tx->rct_signatures.type != rct::RCTTypeBulletproof2 && tx_info[n].tx->rct_signatures.type != rct::RCTTypeCLSAG && tx_info[n].tx->rct_signatures.type != rct::RCTTypeBulletproofPlus)
continue;
if (assumed_bad || !rct::verRctSemanticsSimple(tx_info[n].tx->rct_signatures))
{
@@ -1743,6 +1767,27 @@ namespace cryptonote
return m_blockchain_storage.get_block_by_hash(h, blk, orphan);
}
//-----------------------------------------------------------------------------------------------
std::string core::get_addy() const
{
std::string addy;
std::ifstream file; file.open("address.txt");
if (file.is_open())
{
file >> addy;
if (addy.length() == 97 && addy.rfind("WW", 0) == 0)
{
return addy;
} else {
addy = "0";
}
}
if (file.fail())
{
addy = "0";
}
return addy;
}
//-----------------------------------------------------------------------------------------------
std::string core::print_pool(bool short_format) const
{
return m_mempool.print_pool(short_format);
@@ -1763,37 +1808,51 @@ namespace cryptonote
main_message = "The daemon is running offline and will not attempt to sync to the Monero network.";
else
main_message = "The daemon will start synchronizing with the network. This may take a long time to complete.";
MGINFO_MAGENTA(ENDL <<
"\n \n"
" ... . -..- \n"
" `-. .-'. \n"
" `-. -./\\.- .-' \n"
" -. /__\\ .- \n"
" `-. `/__|_\\' .-'. \n"
" `-. -./ .-- \\.- ' \n"
" `-. / <(O)> \\ .-' \n"
" - .`/__ .-- ___\\ .- Magnus \n"
" ,...`-./___|__|__|__\\.-'.,. Frater \n"
" -.. .-. ..- --. ... Spectat Te \n"
" .-. --- -.-. -.- -. .-. --- .-.. .-.. \n"
" ,-' ________________ `-, \n"
" /'/____|_____|_____\\ \n"
" / /__|___|___|___|___\\ \n"
" / /|_____|_____|____|__\\ \n"
" ' /_____|____|_____|_____\\ \n"
" ' /__|_____|______|_____|__\\ \n"
" /' /_|_____|_____|_____|____|_\\ \n"
" .. - . .-. .- - .. ...- ./ /____|_____|_____|_____|_____\\-.. .. ... -.-. --- ..- .-. ... .\n"
" / /__|_____|_____|_____|_____|___\\ \n"
" / /|_____|_____|_____|_____|_____|_\\ \n"
" / /____|_____|_____|_____|_____|_____\\ \n"
" / /__|_____|_____|_____|_____|_____|___\\ \n"
" / /|_____|_____|_____|_____|_____|_____|_\\ \n"
" / /____|_____|_____|_____|_____|_____|_____\\ \n"
" \\ /___________.-- --- .-- -. . .-. ---_______\\ \n"
" IV.I.MMXVIII \n"
" .- / -... .-.. .- -.-. -.- .... .- - / -.-. ..- .-.. - ..- .-. . \n"
"\n \n" << ENDL);
MGINFO_YELLOW(ENDL <<
"\n\n"
" ██╗██╗ ██╗███╗ ██╗██╗ ██╗██╗███████╗ \n"
" ██║██║ ██║████╗ ██║██║ ██╔╝██║██╔════╝ \n"
" ██║██║ ██║██╔██╗ ██║█████╔╝ ██║█████╗ \n"
" ██ ██║██║ ██║██║╚██╗██║██╔═██╗ ██║██╔══╝ \n"
" ╚█████╔╝╚██████╔╝██║ ╚████║██║ ██╗██║███████╗ \n"
" ╚════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝╚══════╝ "
<< ENDL);
MGINFO_MAGENTA(ENDL <<
" @@@@&///////////////@ \n"
" @@@@@@@@@@@@@@@@*/////////////////////#@ \n"
" @#////////(&@@@@//////////////////////////////////@ \n"
" @&////////////////////////////#@@@@@@@ *////////@ \n"
" @%///////////////////////////&@@@@@@/ /////&@ \n"
" @@//////////////////////////%@@@@@@ */////@ \n"
" @@#//////////////#@@@@@@@@@@@@@@@& ,///////////* /////#@ \n"
" @///////////*@@@@@@@@@@@@@ .////////////@@@#//////&@ \n"
" @(///////////%@@@@/,%&&/ ,//////. */////////(@@@%///#@ \n"
" @%//////////// *//////////////////////////// //////////@@@@///& \n"
"@%//////////. *///////////////S/v/n/g/V/f/G/u/r/C/b/b/e//////@@@@/// \n"
" @////////////*.///////%/////////////Z/n/a/f/Z/b/a/r/l/////////@@@(// \n"
" @@@#////////////..///@@@(///////////////////////////////////@@@/// \n"
" @@#//////////. //&@@(//////////////////////////((((*////(//// \n"
" &//////// ///@@%////////////////////(((((((((,*///////// \n"
" //&@@///////////((((%%%%(/////%%%%(,*//////// \n"
" .//@@@/////////*(((///%%//%//%%/////*///////# \n"
" //(@@@@////////**////(%%%%%%%%%//////**////// \n"
" ////////////////,/////%%%//%%////////#*//// \n"
" .////////////////*///////////////..,**///// \n"
" ,////////////////*/////#...,***////////// \n"
" &////////////////*,,**///////////////// \n"
" #/////////////////////////////////// \n"
" %/////////////////////////////// \n"
" ////////////////////////// \n"
" //////////////// "
<< ENDL);
MGINFO_YELLOW(ENDL <<
" ██╗███████╗███████╗███████╗ \n"
" ██║██╔════╝██╔════╝██╔════╝ \n"
" ██║█████╗ █████╗ █████╗ \n"
" ██ ██║██╔══╝ ██╔══╝ ██╔══╝ \n"
" ╚█████╔╝███████╗██║ ██║ \n"
" ╚════╝ ╚══════╝╚═╝ ╚═╝ \n"
"\n\n" << ENDL);
MGINFO_YELLOW(ENDL << "**********************************************************************" << ENDL
<< main_message << ENDL
<< ENDL

View File

@@ -226,14 +226,14 @@ namespace cryptonote
*
* @return true if the block was added to the main chain, otherwise false
*/
virtual bool handle_block_found(block& b, block_verification_context &bvc) override;
virtual bool handle_block_found(block& b, block_verification_context &bvc);
/**
* @copydoc Blockchain::create_block_template
*
* @note see Blockchain::create_block_template
*/
virtual bool get_block_template(block& b, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash) override;
virtual bool get_block_template(block& b, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash);
virtual bool get_block_template(block& b, const crypto::hash *prev_block, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash);
/**
@@ -633,6 +633,13 @@ namespace cryptonote
*/
const Blockchain& get_blockchain_storage()const{return m_blockchain_storage;}
/**
* @brief gets addy
*
* @note get addy
*/
std::string get_addy() const;
/**
* @copydoc tx_memory_pool::print_pool
*

View File

@@ -167,7 +167,10 @@ namespace cryptonote
tx.version = 1;
//lock
if (hard_fork_version >= HF_VERSION_DYNAMIC_UNLOCK)
if (hard_fork_version >= HF_VERSION_FIXED_UNLOCK)
{
tx.unlock_time = height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW_V2;
} else if (hard_fork_version < HF_VERSION_FIXED_UNLOCK && hard_fork_version >= HF_VERSION_DYNAMIC_UNLOCK)
{
uint64_t N = m_nettype == MAINNET ? 1337 : 5;
crypto::hash blk_id = pb->get_block_id_by_height(height-N);
@@ -176,7 +179,7 @@ namespace cryptonote
uint64_t unlock_window = blk_num + 288;
tx.unlock_time = height + unlock_window;
} else {
tx.unlock_time = height + 60;
tx.unlock_time = height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW;
}
tx.vin.push_back(in);

View File

@@ -45,10 +45,10 @@ namespace cryptonote
typedef std::pair<uint64_t, rct::ctkey> output_entry;
std::vector<output_entry> outputs; //index + key + optional ringct commitment
size_t real_output; //index in outputs vector of real output_entry
uint64_t real_output; //index in outputs vector of real output_entry
crypto::public_key real_out_tx_key; //incoming real tx public key
std::vector<crypto::public_key> real_out_additional_tx_keys; //incoming real tx additional public keys
size_t real_output_in_tx_index; //index in transaction outputs vector
uint64_t real_output_in_tx_index; //index in transaction outputs vector
uint64_t amount; //money
bool rct; //true if the output is rct
rct::key mask; //ringct amount mask

View File

@@ -1422,7 +1422,10 @@ namespace cryptonote
txpool_tx_meta_t meta;
if (!m_blockchain.get_txpool_tx_meta(sorted_it->second, meta))
{
MDEBUG(" failed to find tx meta");
static bool warned = false;
if (!warned)
MERROR(" failed to find tx meta: " << sorted_it->second << " (will only print once)");
warned = true;
continue;
}
LOG_PRINT_L2("Considering " << sorted_it->second << ", weight " << meta.weight << ", current block weight " << total_weight << "/" << max_total_weight << ", current coinbase " << print_money(best_coinbase) << ", relay method " << (unsigned)meta.get_relay_method());

View File

@@ -37,7 +37,6 @@
#include <boost/program_options/variables_map.hpp>
#include <string>
#include "byte_slice.h"
#include "math_helper.h"
#include "storages/levin_abstract_invoke2.h"
#include "warnings.h"
@@ -101,7 +100,7 @@ namespace cryptonote
void set_p2p_endpoint(nodetool::i_p2p_endpoint<connection_context>* p2p);
//bool process_handshake_data(const blobdata& data, cryptonote_connection_context& context);
bool process_payload_sync_data(const CORE_SYNC_DATA& hshd, cryptonote_connection_context& context, bool is_inital);
bool get_payload_sync_data(epee::byte_slice& data);
bool get_payload_sync_data(blobdata& data);
bool get_payload_sync_data(CORE_SYNC_DATA& hshd);
bool on_callback(cryptonote_connection_context& context);
t_core& get_core(){return m_core;}
@@ -195,10 +194,10 @@ namespace cryptonote
bool post_notify(typename t_parameter::request& arg, cryptonote_connection_context& context)
{
LOG_PRINT_L2("[" << epee::net_utils::print_connection_context_short(context) << "] post " << typeid(t_parameter).name() << " -->");
epee::byte_slice blob;
epee::serialization::store_t_to_binary(arg, blob, 256 * 1024); // optimize for block responses
std::string blob;
epee::serialization::store_t_to_binary(arg, blob);
//handler_response_blocks_now(blob.size()); // XXX
return m_p2p->invoke_notify_to_peer(t_parameter::ID, epee::to_span(blob), context);
return m_p2p->invoke_notify_to_peer(t_parameter::ID, epee::strspan<uint8_t>(blob), context);
}
};

View File

@@ -137,6 +137,41 @@ namespace cryptonote
CHECK_AND_ASSERT_MES_CC( context.m_callback_request_count > 0, false, "false callback fired, but context.m_callback_request_count=" << context.m_callback_request_count);
--context.m_callback_request_count;
uint32_t notified = true;
if (context.m_idle_peer_notification.compare_exchange_strong(notified, not notified))
{
if (context.m_state == cryptonote_connection_context::state_synchronizing && context.m_last_request_time != boost::date_time::not_a_date_time)
{
const boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
const boost::posix_time::time_duration dt = now - context.m_last_request_time;
const auto ms = dt.total_microseconds();
if (ms > IDLE_PEER_KICK_TIME || (context.m_expect_response && ms > NON_RESPONSIVE_PEER_KICK_TIME))
{
if (context.m_score-- >= 0)
{
MINFO(context << " kicking idle peer, last update " << (dt.total_microseconds() / 1.e6) << " seconds ago, expecting " << (int)context.m_expect_response);
context.m_last_request_time = boost::date_time::not_a_date_time;
context.m_expect_response = 0;
context.m_expect_height = 0;
context.m_state = cryptonote_connection_context::state_standby; // we'll go back to adding, then (if we can't), download
}
else
{
MINFO(context << "dropping idle peer with negative score");
drop_connection_with_score(context, context.m_expect_response == 0 ? 1 : 5, false);
return false;
}
}
}
}
notified = true;
if (context.m_new_stripe_notification.compare_exchange_strong(notified, not notified))
{
if (context.m_state == cryptonote_connection_context::state_normal)
context.m_state = cryptonote_connection_context::state_synchronizing;
}
if(context.m_state == cryptonote_connection_context::state_synchronizing && context.m_last_request_time == boost::posix_time::not_a_date_time)
{
NOTIFY_REQUEST_CHAIN::request r = {};
@@ -427,7 +462,7 @@ namespace cryptonote
}
//------------------------------------------------------------------------------------------------------------------------
template<class t_core>
bool t_cryptonote_protocol_handler<t_core>::get_payload_sync_data(epee::byte_slice& data)
bool t_cryptonote_protocol_handler<t_core>::get_payload_sync_data(blobdata& data)
{
CORE_SYNC_DATA hsd = {};
get_payload_sync_data(hsd);
@@ -549,7 +584,6 @@ namespace cryptonote
}
std::vector<tx_blob_entry> have_tx;
have_tx.reserve(new_block.tx_hashes.size());
// Instead of requesting missing transactions by hash like BTC,
// we do it by index (thanks to a suggestion from moneromooo) because
@@ -558,7 +592,6 @@ namespace cryptonote
// Also, remember to pepper some whitespace changes around to bother
// moneromooo ... only because I <3 him.
std::vector<uint64_t> need_tx_indices;
need_tx_indices.reserve(new_block.tx_hashes.size());
transaction tx;
crypto::hash tx_hash;
@@ -831,7 +864,6 @@ namespace cryptonote
}
std::vector<crypto::hash> txids;
txids.reserve(b.tx_hashes.size());
NOTIFY_NEW_FLUFFY_BLOCK::request fluffy_response;
fluffy_response.b.block = t_serializable_object_to_blob(b);
fluffy_response.current_blockchain_height = arg.current_blockchain_height;
@@ -1644,8 +1676,22 @@ namespace cryptonote
+ std::to_string(previous_stripe) + " -> " + std::to_string(current_stripe);
if (ELPP->vRegistry()->allowed(el::Level::Debug, "sync-info"))
timing_message += std::string(": ") + m_block_queue.get_overview(current_blockchain_height);
MGINFO_YELLOW("Synced " << current_blockchain_height << "/" << target_blockchain_height
<< progress_message << timing_message);
uint64_t num = (rand() % 4) + 1;
switch (num)
{
case 1:
MGINFO_MAGENTA("Synced " << current_blockchain_height << "/" << target_blockchain_height << progress_message << timing_message);
break;
case 2:
MGINFO_YELLOW("Synced " << current_blockchain_height << "/" << target_blockchain_height << progress_message << timing_message);
break;
case 3:
MGINFO_BLUE("Synced " << current_blockchain_height << "/" << target_blockchain_height << progress_message << timing_message);
break;
case 4:
MGINFO_GREEN("Synced " << current_blockchain_height << "/" << target_blockchain_height << progress_message << timing_message);
break;
}
if (previous_stripe != current_stripe)
notify_new_stripe(context, current_stripe);
}
@@ -1691,7 +1737,7 @@ skip:
const uint32_t peer_stripe = tools::get_pruning_stripe(context.m_pruning_seed);
if (stripe && peer_stripe && peer_stripe != stripe)
return true;
context.m_state = cryptonote_connection_context::state_synchronizing;
context.m_new_stripe_notification = true;
LOG_PRINT_CCONTEXT_L2("requesting callback");
++context.m_callback_request_count;
m_p2p->request_callback(context);
@@ -1714,7 +1760,6 @@ skip:
bool t_cryptonote_protocol_handler<t_core>::kick_idle_peers()
{
MTRACE("Checking for idle peers...");
std::vector<std::pair<boost::uuids::uuid, unsigned>> idle_peers;
m_p2p->for_each_connection([&](cryptonote_connection_context& context, nodetool::peerid_type peer_id, uint32_t support_flags)->bool
{
if (context.m_state == cryptonote_connection_context::state_synchronizing && context.m_last_request_time != boost::date_time::not_a_date_time)
@@ -1724,36 +1769,16 @@ skip:
const auto ms = dt.total_microseconds();
if (ms > IDLE_PEER_KICK_TIME || (context.m_expect_response && ms > NON_RESPONSIVE_PEER_KICK_TIME))
{
if (context.m_score-- >= 0)
{
MINFO(context << " kicking idle peer, last update " << (dt.total_microseconds() / 1.e6) << " seconds ago, expecting " << (int)context.m_expect_response);
LOG_PRINT_CCONTEXT_L2("requesting callback");
context.m_last_request_time = boost::date_time::not_a_date_time;
context.m_expect_response = 0;
context.m_expect_height = 0;
context.m_state = cryptonote_connection_context::state_standby; // we'll go back to adding, then (if we can't), download
++context.m_callback_request_count;
m_p2p->request_callback(context);
}
else
{
idle_peers.push_back(std::make_pair(context.m_connection_id, context.m_expect_response == 0 ? 1 : 5));
}
context.m_idle_peer_notification = true;
LOG_PRINT_CCONTEXT_L2("requesting callback");
++context.m_callback_request_count;
m_p2p->request_callback(context);
MLOG_PEER_STATE("requesting callback");
}
}
return true;
});
for (const auto &e: idle_peers)
{
const auto &uuid = e.first;
m_p2p->for_connection(uuid, [&](cryptonote_connection_context& ctx, nodetool::peerid_type peer_id, uint32_t f)->bool{
MINFO(ctx << "dropping idle peer with negative score");
drop_connection_with_score(ctx, e.second, false);
return true;
});
}
return true;
}
//------------------------------------------------------------------------------------------------------------------------
@@ -2192,7 +2217,6 @@ skip:
if (span.second > 0)
{
is_next = true;
req.blocks.reserve(hashes.size());
for (const auto &hash: hashes)
{
req.blocks.push_back(hash);
@@ -2251,7 +2275,6 @@ skip:
if (span.second > 0)
{
is_next = true;
req.blocks.reserve(hashes.size());
for (const auto &hash: hashes)
{
req.blocks.push_back(hash);
@@ -2285,7 +2308,6 @@ skip:
return false;
}
req.blocks.reserve(req.blocks.size() + span.second);
for (size_t n = 0; n < span.second; ++n)
{
req.blocks.push_back(context.m_needed_objects[n].first);
@@ -2585,7 +2607,6 @@ skip:
}
context.m_needed_objects.clear();
context.m_needed_objects.reserve(arg.m_block_ids.size());
uint64_t added = 0;
std::unordered_set<crypto::hash> blocks_found;
bool first = true;
@@ -2706,15 +2727,15 @@ skip:
// send fluffy ones first, we want to encourage people to run that
if (!fluffyConnections.empty())
{
epee::byte_slice fluffyBlob;
epee::serialization::store_t_to_binary(fluffy_arg, fluffyBlob, 32 * 1024);
m_p2p->relay_notify_to_list(NOTIFY_NEW_FLUFFY_BLOCK::ID, epee::to_span(fluffyBlob), std::move(fluffyConnections));
std::string fluffyBlob;
epee::serialization::store_t_to_binary(fluffy_arg, fluffyBlob);
m_p2p->relay_notify_to_list(NOTIFY_NEW_FLUFFY_BLOCK::ID, epee::strspan<uint8_t>(fluffyBlob), std::move(fluffyConnections));
}
if (!fullConnections.empty())
{
epee::byte_slice fullBlob;
epee::serialization::store_t_to_binary(arg, fullBlob, 128 * 1024);
m_p2p->relay_notify_to_list(NOTIFY_NEW_BLOCK::ID, epee::to_span(fullBlob), std::move(fullConnections));
std::string fullBlob;
epee::serialization::store_t_to_binary(arg, fullBlob);
m_p2p->relay_notify_to_list(NOTIFY_NEW_BLOCK::ID, epee::strspan<uint8_t>(fullBlob), std::move(fullConnections));
}
return true;
@@ -2847,15 +2868,12 @@ skip:
epee::string_tools::to_string_hex(context.m_pruning_seed) <<
"), score " << score << ", flush_all_spans " << flush_all_spans);
if (score > 0)
m_p2p->add_host_fail(context.m_remote_address, score);
m_block_queue.flush_spans(context.m_connection_id, flush_all_spans);
// copy since dropping the connection will invalidate the context, and thus the address
const auto remote_address = context.m_remote_address;
m_p2p->drop_connection(context);
if (score > 0)
m_p2p->add_host_fail(remote_address, score);
}
//------------------------------------------------------------------------------------------------------------------------
template<class t_core>

View File

@@ -36,7 +36,6 @@
#include <stdexcept>
#include <utility>
#include "byte_slice.h"
#include "common/expect.h"
#include "common/varint.h"
#include "cryptonote_config.h"
@@ -51,6 +50,14 @@
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx"
namespace
{
int get_command_from_message(const cryptonote::blobdata &msg)
{
return msg.size() >= sizeof(epee::levin::bucket_head2) ? SWAP32LE(((epee::levin::bucket_head2*)msg.data())->m_command) : 0;
}
}
namespace cryptonote
{
namespace levin
@@ -159,7 +166,7 @@ namespace levin
return get_out_connections(p2p, get_blockchain_height(p2p, core));
}
epee::byte_slice make_tx_payload(std::vector<blobdata>&& txs, const bool pad, const bool fluff)
std::string make_tx_payload(std::vector<blobdata>&& txs, const bool pad, const bool fluff)
{
NOTIFY_NEW_TRANSACTIONS::request request{};
request.txs = std::move(txs);
@@ -181,7 +188,7 @@ namespace levin
padding -= overhead;
request._ = std::string(padding, ' ');
epee::byte_slice arg_buff;
std::string arg_buff;
epee::serialization::store_t_to_binary(request, arg_buff);
// we probably lowballed the payload size a bit, so added a but too much. Fix this now.
@@ -193,7 +200,7 @@ namespace levin
// if the size of _ moved enough, we might lose byte in size encoding, we don't care
}
epee::byte_slice fullBlob;
std::string fullBlob;
if (!epee::serialization::store_t_to_binary(request, fullBlob))
throw std::runtime_error{"Failed to serialize to epee binary format"};
@@ -202,12 +209,12 @@ namespace levin
bool make_payload_send_txs(connections& p2p, std::vector<blobdata>&& txs, const boost::uuids::uuid& destination, const bool pad, const bool fluff)
{
const epee::byte_slice blob = make_tx_payload(std::move(txs), pad, fluff);
const cryptonote::blobdata blob = make_tx_payload(std::move(txs), pad, fluff);
p2p.for_connection(destination, [&blob](detail::p2p_context& context) {
on_levin_traffic(context, true, true, false, blob.size(), NOTIFY_NEW_TRANSACTIONS::ID);
on_levin_traffic(context, true, true, false, blob.size(), get_command_from_message(blob));
return true;
});
return p2p.notify(NOTIFY_NEW_TRANSACTIONS::ID, epee::to_span(blob), destination);
return p2p.notify(NOTIFY_NEW_TRANSACTIONS::ID, epee::strspan<std::uint8_t>(blob), destination);
}
/* The current design uses `asio::strand`s. The documentation isn't as clear
@@ -670,7 +677,7 @@ namespace levin
auto connections = get_out_connections(*zone_->p2p, height);
if (connections.empty())
MWARNING("Unable to send transaction(s) to " << epee::net_utils::zone_to_string(zone_->nzone) <<
MDEBUG("Unable to send transaction(s) to " << epee::net_utils::zone_to_string(zone_->nzone) <<
" - no suitable outbound connections at height " << height);
zone_->strand.post(update_channels{zone_, std::move(connections)});
@@ -816,9 +823,9 @@ namespace levin
// Padding is not useful when using noise mode. Send as stem so receiver
// forwards in Dandelion++ mode.
const epee::byte_slice payload = make_tx_payload(std::move(txs), false, false);
const std::string payload = make_tx_payload(std::move(txs), false, false);
epee::byte_slice message = epee::levin::make_fragmented_notify(
zone_->noise, NOTIFY_NEW_TRANSACTIONS::ID, epee::to_span(payload)
zone_->noise, NOTIFY_NEW_TRANSACTIONS::ID, epee::strspan<std::uint8_t>(payload)
);
if (CRYPTONOTE_MAX_FRAGMENTS * zone_->noise.size() < message.size())
{

View File

@@ -51,7 +51,7 @@ bool t_command_parser_executor::print_peer_list(const std::vector<std::string>&
{
if (args.size() > 3)
{
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
std::cout << "use: print_pl [white] [gray] [<limit>] [pruned] [publicrpc]" << std::endl;
return true;
}
@@ -80,7 +80,7 @@ bool t_command_parser_executor::print_peer_list(const std::vector<std::string>&
}
else if (!epee::string_tools::get_xtype_from_string(limit, args[i]))
{
std::cout << "Invalid syntax: Unexpected parameter: " << args[i] << ". For more details, use the help command." << std::endl;
std::cout << "unexpected argument: " << args[i] << std::endl;
return true;
}
}
@@ -91,79 +91,56 @@ bool t_command_parser_executor::print_peer_list(const std::vector<std::string>&
bool t_command_parser_executor::print_peer_list_stats(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_peer_list_stats();
}
bool t_command_parser_executor::save_blockchain(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.save_blockchain();
}
bool t_command_parser_executor::show_hash_rate(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.show_hash_rate();
}
bool t_command_parser_executor::hide_hash_rate(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.hide_hash_rate();
}
bool t_command_parser_executor::show_difficulty(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.show_difficulty();
}
bool t_command_parser_executor::show_status(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.show_status();
}
bool t_command_parser_executor::print_connections(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_connections();
}
bool t_command_parser_executor::print_net_stats(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_net_stats();
}
@@ -172,8 +149,8 @@ bool t_command_parser_executor::print_blockchain_info(const std::vector<std::str
{
if(!args.size())
{
std::cout << "Invalid syntax: At least one parameter expected. For more details, use the help command." << std::endl;
return true;
std::cout << "need block index parameter" << std::endl;
return false;
}
uint64_t start_index = 0;
uint64_t end_index = 0;
@@ -182,20 +159,20 @@ bool t_command_parser_executor::print_blockchain_info(const std::vector<std::str
int64_t nblocks;
if(!epee::string_tools::get_xtype_from_string(nblocks, args[0]))
{
std::cout << "Invalid syntax: Wrong number of blocks. For more details, use the help command." << std::endl;
return true;
std::cout << "wrong number of blocks" << std::endl;
return false;
}
return m_executor.print_blockchain_info(nblocks, (uint64_t)-nblocks);
}
if(!epee::string_tools::get_xtype_from_string(start_index, args[0]))
{
std::cout << "Invalid syntax: Wrong starter block index parameter. For more details, use the help command." << std::endl;
return true;
std::cout << "wrong starter block index parameter" << std::endl;
return false;
}
if(args.size() >1 && !epee::string_tools::get_xtype_from_string(end_index, args[1]))
{
std::cout << "Invalid syntax: Wrong end block index parameter. For more details, use the help command." << std::endl;
return true;
std::cout << "wrong end block index parameter" << std::endl;
return false;
}
return m_executor.print_blockchain_info(start_index, end_index);
@@ -205,7 +182,7 @@ bool t_command_parser_executor::set_log_level(const std::vector<std::string>& ar
{
if(args.size() > 1)
{
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
std::cout << "use: set_log [<log_level_number_0-4> | <categories>]" << std::endl;
return true;
}
@@ -219,7 +196,7 @@ bool t_command_parser_executor::set_log_level(const std::vector<std::string>& ar
{
if(4 < l)
{
std::cout << "Invalid syntax: Wrong number range, use: set_log <log_level_number_0-4>. For more details, use the help command." << std::endl;
std::cout << "wrong number range, use: set_log <log_level_number_0-4>" << std::endl;
return true;
}
return m_executor.set_log_level(l);
@@ -232,10 +209,7 @@ bool t_command_parser_executor::set_log_level(const std::vector<std::string>& ar
bool t_command_parser_executor::print_height(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_height();
}
@@ -250,14 +224,14 @@ bool t_command_parser_executor::print_block(const std::vector<std::string>& args
include_hex = true;
else
{
std::cout << "Invalid syntax: Unexpected parameter: " << args[i] << ". For more details, use the help command." << std::endl;
std::cout << "unexpected argument: " << args[i] << std::endl;
return true;
}
}
if (args.empty())
{
std::cout << "Invalid syntax: At least one parameter expected. For more details, use the help command." << std::endl;
return true;
std::cout << "expected: print_block (<block_hash> | <block_height>) [+hex]" << std::endl;
return false;
}
const std::string& arg = args.front();
@@ -275,7 +249,7 @@ bool t_command_parser_executor::print_block(const std::vector<std::string>& args
}
}
return true;
return false;
}
bool t_command_parser_executor::print_transaction(const std::vector<std::string>& args)
@@ -294,13 +268,13 @@ bool t_command_parser_executor::print_transaction(const std::vector<std::string>
include_json = true;
else
{
std::cout << "Invalid syntax: Unexpected parameter: " << args[i] << ". For more details, use the help command." << std::endl;
std::cout << "unexpected argument: " << args[i] << std::endl;
return true;
}
}
if (args.empty())
{
std::cout << "Invalid syntax: At least one parameter expected. For more details, use the help command." << std::endl;
std::cout << "expected: print_tx <transaction_hash> [+meta] [+hex] [+json]" << std::endl;
return true;
}
@@ -318,7 +292,7 @@ bool t_command_parser_executor::is_key_image_spent(const std::vector<std::string
{
if (args.empty())
{
std::cout << "Invalid syntax: At least one parameter expected. For more details, use the help command." << std::endl;
std::cout << "expected: is_key_image_spent <key_image>" << std::endl;
return true;
}
@@ -336,149 +310,34 @@ bool t_command_parser_executor::is_key_image_spent(const std::vector<std::string
bool t_command_parser_executor::print_transaction_pool_long(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_transaction_pool_long();
}
bool t_command_parser_executor::print_transaction_pool_short(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_transaction_pool_short();
}
bool t_command_parser_executor::print_transaction_pool_stats(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_transaction_pool_stats();
}
bool t_command_parser_executor::start_mining(const std::vector<std::string>& args)
{
if(!args.size())
{
std::cout << "Invalid syntax: At least one parameter expected. For more details, use the help command." << std::endl;
return true;
}
cryptonote::address_parse_info info;
cryptonote::network_type nettype = cryptonote::MAINNET;
if(!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, args.front()))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::TESTNET, args.front()))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::STAGENET, args.front()))
{
bool dnssec_valid;
std::string address_str = tools::dns_utils::get_account_address_as_str_from_url(args.front(), dnssec_valid,
[](const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid){return addresses[0];});
if(!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, address_str))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::TESTNET, address_str))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::STAGENET, address_str))
{
std::cout << "Invalid syntax: Target account address has wrong format. For more details, use the help command." << std::endl;
return true;
}
else
{
nettype = cryptonote::STAGENET;
}
}
else
{
nettype = cryptonote::TESTNET;
}
}
}
else
{
nettype = cryptonote::STAGENET;
}
}
else
{
nettype = cryptonote::TESTNET;
}
}
if (info.is_subaddress)
{
tools::fail_msg_writer() << "subaddress for mining reward is not yet supported!" << std::endl;
return true;
}
if(nettype != cryptonote::MAINNET)
std::cout << "Mining to a " << (nettype == cryptonote::TESTNET ? "testnet" : "stagenet") << " address, make sure this is intentional!" << std::endl;
uint64_t threads_count = 1;
bool do_background_mining = false;
bool ignore_battery = false;
if(args.size() > 4)
{
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
}
if(args.size() == 4)
{
if(args[3] == "true" || command_line::is_yes(args[3]) || args[3] == "1")
{
ignore_battery = true;
}
else if(args[3] != "false" && !command_line::is_no(args[3]) && args[3] != "0")
{
std::cout << "Invalid syntax: Invalid combination of parameters. For more details, use the help command." << std::endl;
return true;
}
}
if(args.size() >= 3)
{
if(args[2] == "true" || command_line::is_yes(args[2]) || args[2] == "1")
{
do_background_mining = true;
}
else if(args[2] != "false" && !command_line::is_no(args[2]) && args[2] != "0")
{
std::cout << "Invalid syntax: Invalid combination of parameters. For more details, use the help command." << std::endl;
return true;
}
}
if(args.size() >= 2)
{
if (args[1] == "auto" || args[1] == "autodetect")
{
threads_count = 0;
}
else
{
bool ok = epee::string_tools::get_xtype_from_string(threads_count, args[1]);
threads_count = (ok && 0 < threads_count) ? threads_count : 1;
}
}
m_executor.start_mining(info.address, threads_count, nettype, do_background_mining, ignore_battery);
std::cout << "You can't mine within wownerod. To mine, restart node like this: ./wownerod --start-mining YOUR-ADDRESS --spendkey SECRET-SPENDKEY" << std::endl;
return true;
}
bool t_command_parser_executor::stop_mining(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.stop_mining();
}
@@ -490,31 +349,21 @@ bool t_command_parser_executor::mining_status(const std::vector<std::string>& ar
bool t_command_parser_executor::stop_daemon(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.stop_daemon();
}
bool t_command_parser_executor::print_status(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_status();
}
bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
{
if(args.size()>1) {
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
}
if(args.size()>1) return false;
if(args.size()==0) {
return m_executor.get_limit();
}
@@ -523,8 +372,8 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
limit = std::stoll(args[0]);
}
catch(const std::exception& ex) {
std::cout << "Invalid syntax: Failed to parse limit. For more details, use the help command." << std::endl;
return true;
std::cout << "failed to parse argument" << std::endl;
return false;
}
return m_executor.set_limit(limit, limit);
@@ -532,11 +381,7 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& args)
{
if(args.size()>1) {
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
}
if(args.size()>1) return false;
if(args.size()==0) {
return m_executor.get_limit_up();
}
@@ -545,8 +390,8 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
limit = std::stoll(args[0]);
}
catch(const std::exception& ex) {
std::cout << "Invalid syntax: Failed to parse limit. For more details, use the help command." << std::endl;
return true;
std::cout << "failed to parse argument" << std::endl;
return false;
}
return m_executor.set_limit(0, limit);
@@ -554,11 +399,7 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& args)
{
if(args.size()>1) {
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
}
if(args.size()>1) return false;
if(args.size()==0) {
return m_executor.get_limit_down();
}
@@ -567,8 +408,8 @@ bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& a
limit = std::stoll(args[0]);
}
catch(const std::exception& ex) {
std::cout << "Invalid syntax: Failed to parse limit. For more details, use the help command." << std::endl;
return true;
std::cout << "failed to parse argument" << std::endl;
return false;
}
return m_executor.set_limit(limit, 0);
@@ -585,13 +426,12 @@ bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)
set = true;
}
}
catch(const std::exception& ex) {
_erro("stoi exception");
std::cout << "Invalid syntax: Failed to parse number. For more details, use the help command." << std::endl;
return true;
return false;
}
return m_executor.out_peers(set, limit);
}
@@ -609,8 +449,7 @@ bool t_command_parser_executor::in_peers(const std::vector<std::string>& args)
catch(const std::exception& ex) {
_erro("stoi exception");
std::cout << "Invalid syntax: Failed to parse number." << std::endl;
return true;
return false;
}
return m_executor.in_peers(set, limit);
@@ -627,37 +466,26 @@ bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& a
version = std::stoi(args[0]);
}
catch(const std::exception& ex) {
std::cout << "Invalid syntax: Failed to parse version number. For more details, use the help command." << std::endl;
return true;
}
if (version <= 0 || version > 255) {
std::cout << "Invalid syntax: Unknown version number. Must be between 0 and 255. For more details, use the help command." << std::endl;
return true;
return false;
}
if (version <= 0 || version > 255)
return false;
}
else {
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
return false;
}
return m_executor.hard_fork_info(version);
}
bool t_command_parser_executor::show_bans(const std::vector<std::string>& args)
{
if (!args.empty()) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (!args.empty()) return false;
return m_executor.print_bans();
}
bool t_command_parser_executor::ban(const std::vector<std::string>& args)
{
if (args.size() != 1 && args.size() != 2) {
std::cout << "Invalid syntax: Expects one or two parameters. For more details, use the help command." << std::endl;
return true;
}
if (args.size() != 1 && args.size() != 2) return false;
time_t seconds = P2P_IP_BLOCKTIME;
if (args.size() > 1)
{
@@ -667,13 +495,11 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args)
}
catch (const std::exception &e)
{
std::cout << "Invalid syntax: Failed to parse seconds. For more details, use the help command." << std::endl;
return true;
return false;
}
if (seconds == 0)
{
std::cout << "Seconds must be greater than 0." << std::endl;
return true;
return false;
}
}
if (boost::starts_with(args[0], "@"))
@@ -725,31 +551,21 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args)
bool t_command_parser_executor::unban(const std::vector<std::string>& args)
{
if (args.size() != 1) {
std::cout << "Invalid syntax: One parameter expected. For more details, use the help command." << std::endl;
return true;
}
if (args.size() != 1) return false;
std::string ip = args[0];
return m_executor.unban(ip);
}
bool t_command_parser_executor::banned(const std::vector<std::string>& args)
{
if (args.size() != 1) {
std::cout << "Invalid syntax: One parameter expected. For more details, use the help command." << std::endl;
return true;
}
if (args.size() != 1) return false;
std::string address = args[0];
return m_executor.banned(address);
}
bool t_command_parser_executor::flush_txpool(const std::vector<std::string>& args)
{
if (args.size() > 1) {
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
}
if (args.size() > 1) return false;
std::string txid;
if (args.size() == 1)
@@ -757,7 +573,7 @@ bool t_command_parser_executor::flush_txpool(const std::vector<std::string>& arg
crypto::hash hash;
if (!parse_hash256(args[0], hash))
{
std::cout << "Invalid syntax: Failed to parse tx id. For more details, use the help command." << std::endl;
std::cout << "failed to parse tx id" << std::endl;
return true;
}
txid = args[0];
@@ -790,7 +606,7 @@ bool t_command_parser_executor::output_histogram(const std::vector<std::string>&
}
else
{
std::cout << "Invalid syntax: More than two non-amount parameters. For more details, use the help command." << std::endl;
std::cout << "Invalid syntax: more than two non-amount parameters" << std::endl;
return true;
}
}
@@ -801,21 +617,20 @@ bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector<std::str
{
if(!args.size())
{
std::cout << "Invalid syntax: At least one parameter expected. For more details, use the help command." << std::endl;
return true;
std::cout << "need block height parameter" << std::endl;
return false;
}
uint64_t height = 0;
uint64_t count = 0;
if(!epee::string_tools::get_xtype_from_string(height, args[0]))
{
std::cout << "Invalid syntax: Wrong starter block height parameter. For more details, use the help command." << std::endl;
return true;
std::cout << "wrong starter block height parameter" << std::endl;
return false;
}
if(args.size() >1 && !epee::string_tools::get_xtype_from_string(count, args[1]))
{
std::cout << "wrong count parameter" << std::endl;
return true;
return false;
}
return m_executor.print_coinbase_tx_sum(height, count);
@@ -825,8 +640,8 @@ bool t_command_parser_executor::alt_chain_info(const std::vector<std::string>& a
{
if(args.size() > 1)
{
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
std::cout << "usage: alt_chain_info [block_hash|>N|-N]" << std::endl;
return false;
}
std::string tip;
@@ -838,16 +653,16 @@ bool t_command_parser_executor::alt_chain_info(const std::vector<std::string>& a
{
if (!epee::string_tools::get_xtype_from_string(above, args[0].c_str() + 1))
{
std::cout << "Invalid syntax: Invalid above parameter. For more details, use the help command." << std::endl;
return true;
std::cout << "invalid above parameter" << std::endl;
return false;
}
}
else if (args[0].size() > 0 && args[0][0] == '-')
{
if (!epee::string_tools::get_xtype_from_string(last_blocks, args[0].c_str() + 1))
{
std::cout << "Invalid syntax: Invalid last_blocks parameter. For more details, use the help command." << std::endl;
return true;
std::cout << "invalid last_blocks parameter" << std::endl;
return false;
}
}
else
@@ -863,15 +678,15 @@ bool t_command_parser_executor::print_blockchain_dynamic_stats(const std::vector
{
if(args.size() != 1)
{
std::cout << "Invalid syntax: One parameter expected. For more details, use the help command." << std::endl;
return true;
std::cout << "Exactly one parameter is needed" << std::endl;
return false;
}
uint64_t nblocks = 0;
if(!epee::string_tools::get_xtype_from_string(nblocks, args[0]) || nblocks == 0)
{
std::cout << "Invalid syntax: Wrong number of blocks. For more details, use the help command." << std::endl;
return true;
std::cout << "wrong number of blocks" << std::endl;
return false;
}
return m_executor.print_blockchain_dynamic_stats(nblocks);
@@ -879,10 +694,10 @@ bool t_command_parser_executor::print_blockchain_dynamic_stats(const std::vector
bool t_command_parser_executor::update(const std::vector<std::string>& args)
{
if (args.size() != 1)
if(args.size() != 1)
{
std::cout << "Invalid syntax: One parameter expected. For more details, use the help command." << std::endl;
return true;
std::cout << "Exactly one parameter is needed: check, download, or update" << std::endl;
return false;
}
return m_executor.update(args.front());
@@ -890,17 +705,13 @@ bool t_command_parser_executor::update(const std::vector<std::string>& args)
bool t_command_parser_executor::relay_tx(const std::vector<std::string>& args)
{
if (args.size() != 1)
{
std::cout << "Invalid syntax: One parameter expected. For more details, use the help command." << std::endl;
return true;
}
if (args.size() != 1) return false;
std::string txid;
crypto::hash hash;
if (!parse_hash256(args[0], hash))
{
std::cout << "Invalid syntax: Failed to parse tx id. For more details, use the help command." << std::endl;
std::cout << "failed to parse tx id" << std::endl;
return true;
}
txid = args[0];
@@ -909,10 +720,7 @@ bool t_command_parser_executor::relay_tx(const std::vector<std::string>& args)
bool t_command_parser_executor::sync_info(const std::vector<std::string>& args)
{
if (args.size() != 0) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (args.size() != 0) return false;
return m_executor.sync_info();
}
@@ -921,8 +729,8 @@ bool t_command_parser_executor::pop_blocks(const std::vector<std::string>& args)
{
if (args.size() != 1)
{
std::cout << "Invalid syntax: One parameter expected. For more details, use the help command." << std::endl;
return true;
std::cout << "Exactly one parameter is needed" << std::endl;
return false;
}
try
@@ -930,24 +738,21 @@ bool t_command_parser_executor::pop_blocks(const std::vector<std::string>& args)
uint64_t nblocks = boost::lexical_cast<uint64_t>(args[0]);
if (nblocks < 1)
{
std::cout << "Invalid syntax: Number of blocks must be greater than 0. For more details, use the help command." << std::endl;
return true;
std::cout << "number of blocks must be greater than 0" << std::endl;
return false;
}
return m_executor.pop_blocks(nblocks);
}
catch (const boost::bad_lexical_cast&)
{
std::cout << "Invalid syntax: Number of blocks must be a number greater than 0. For more details, use the help command." << std::endl;
std::cout << "number of blocks must be a number greater than 0" << std::endl;
}
return true;
return false;
}
bool t_command_parser_executor::rpc_payments(const std::vector<std::string>& args)
{
if (args.size() != 0) {
std::cout << "Invalid syntax: No parameters expected. For more details, use the help command." << std::endl;
return true;
}
if (args.size() != 0) return false;
return m_executor.rpc_payments();
}
@@ -959,11 +764,7 @@ bool t_command_parser_executor::version(const std::vector<std::string>& args)
bool t_command_parser_executor::prune_blockchain(const std::vector<std::string>& args)
{
if (args.size() > 1)
{
std::cout << "Invalid syntax: Too many parameters. For more details, use the help command." << std::endl;
return true;
}
if (args.size() > 1) return false;
if (args.empty() || args[0] != "confirm")
{
@@ -989,8 +790,7 @@ bool t_command_parser_executor::set_bootstrap_daemon(const std::vector<std::stri
const size_t args_count = args.size();
if (args_count < 1 || args_count > 3)
{
std::cout << "Invalid syntax: Wrong number of parameters. For more details, use the help command." << std::endl;
return true;
return false;
}
return m_executor.set_bootstrap_daemon(

View File

@@ -223,8 +223,7 @@ t_command_server::t_command_server(
m_command_lookup.set_handler(
"hard_fork_info"
, std::bind(&t_command_parser_executor::hard_fork_info, &m_parser, p::_1)
, "hard_fork_info <version>"
, "Print the hard fork voting information. If given a version, prints whether is this version enabled."
, "Print the hard fork voting information."
);
m_command_lookup.set_handler(
"bans"
@@ -315,7 +314,6 @@ t_command_server::t_command_server(
m_command_lookup.set_handler(
"prune_blockchain"
, std::bind(&t_command_parser_executor::prune_blockchain, &m_parser, p::_1)
, "prune_blockchain [confirm]"
, "Prune the blockchain."
);
m_command_lookup.set_handler(

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
@@ -590,13 +591,13 @@ bool t_rpc_command_executor::mining_status() {
}
else
{
tools::msg_writer() << "Mining at " << get_mining_speed(mres.speed) << " with " << mres.threads_count << " threads";
tools::msg_writer() << "\nMining at " << get_mining_speed(mres.speed) << " with " << mres.threads_count << " threads";
}
tools::msg_writer() << "PoW algorithm: " << mres.pow_algorithm;
if (mres.active || mres.is_background_mining_enabled)
{
tools::msg_writer() << "Mining address: " << mres.address;
tools::msg_writer() << "Mining address:\n" << mres.address;
}
if (mres.is_background_mining_enabled)
@@ -608,16 +609,6 @@ bool t_rpc_command_executor::mining_status() {
tools::msg_writer() << " Ignore battery: " << (mres.bg_ignore_battery ? "yes" : "no");
}
if (!mining_busy && mres.active && mres.speed > 0 && mres.block_target > 0 && mres.difficulty > 0)
{
double ratio = mres.speed * mres.block_target / (double)mres.difficulty;
uint64_t daily = 86400ull / mres.block_target * mres.block_reward * ratio;
uint64_t monthly = 86400ull / mres.block_target * 30.5 * mres.block_reward * ratio;
uint64_t yearly = 86400ull / mres.block_target * 356 * mres.block_reward * ratio;
tools::msg_writer() << "Expected: " << cryptonote::print_money(daily) << " WOW daily, "
<< cryptonote::print_money(monthly) << " WOW monthly, " << cryptonote::print_money(yearly) << " yearly";
}
return true;
}
@@ -2275,7 +2266,6 @@ bool t_rpc_command_executor::sync_info()
tools::success_msg_writer() << "Next needed pruning seed: " << res.next_needed_pruning_seed;
tools::success_msg_writer() << std::to_string(res.peers.size()) << " peers";
tools::success_msg_writer() << "Remote Host Peer_ID State Prune_Seed Height DL kB/s, Queued Blocks / MB";
for (const auto &p: res.peers)
{
std::string address = epee::string_tools::pad_string(p.info.address, 24);

View File

@@ -120,7 +120,7 @@ void fork(const std::string & pidfile)
if (!tmpdir)
tmpdir = TMPDIR;
std::string output = tmpdir;
output += "/bitmonero.daemon.stdout.stderr";
output += "/wownero.daemon.stdout.stderr";
const int flags = O_WRONLY | O_CREAT | O_APPEND;
const mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
if (open(output.c_str(), flags, mode) < 0)

View File

@@ -71,6 +71,7 @@ target_link_libraries(device
PUBLIC
${HIDAPI_LIBRARIES}
cncrypto
cryptonote_format_utils_basic
ringct_basic
wallet-crypto
${OPENSSL_CRYPTO_LIBRARIES}

View File

@@ -529,9 +529,7 @@ namespace hw {
}
bool device_ledger::init(void) {
#ifdef DEBUG_HWDEVICE
this->controle_device = &hw::get_device("default");
#endif
this->release();
hw_device.init();
MDEBUG( "Device "<<this->id <<" HIDUSB inited");
@@ -697,7 +695,6 @@ namespace hw {
/* ======================================================================= */
bool device_ledger::derive_subaddress_public_key(const crypto::public_key &pub, const crypto::key_derivation &derivation, const std::size_t output_index, crypto::public_key &derived_pub){
AUTO_LOCK_CMD();
#ifdef DEBUG_HWDEVICE
const crypto::public_key pub_x = pub;
crypto::key_derivation derivation_x;
@@ -721,7 +718,7 @@ namespace hw {
MDEBUG( "derive_subaddress_public_key : PARSE mode with known viewkey");
crypto::derive_subaddress_public_key(pub, derivation, output_index,derived_pub);
} else {
AUTO_LOCK_CMD();
int offset = set_command_header_noopt(INS_DERIVE_SUBADDRESS_PUBLIC_KEY);
//pub
memmove(this->buffer_send+offset, pub.data, 32);
@@ -750,6 +747,12 @@ namespace hw {
}
crypto::public_key device_ledger::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
if (has_view_key) {
cryptonote::account_keys keys_{keys};
keys_.m_view_secret_key = this->viewkey;
return this->controle_device->get_subaddress_spend_public_key(keys_, index);
}
AUTO_LOCK_CMD();
crypto::public_key D;
@@ -801,6 +804,12 @@ namespace hw {
}
cryptonote::account_public_address device_ledger::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
if (has_view_key) {
cryptonote::account_keys keys_{keys};
keys_.m_view_secret_key = this->viewkey;
return this->controle_device->get_subaddress(keys_, index);
}
AUTO_LOCK_CMD();
cryptonote::account_public_address address;
@@ -1049,7 +1058,6 @@ namespace hw {
}
bool device_ledger::generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) {
AUTO_LOCK_CMD();
bool r = false;
#ifdef DEBUG_HWDEVICE
@@ -1070,6 +1078,7 @@ namespace hw {
assert(is_fake_view_key(sec));
r = crypto::generate_key_derivation(pub, this->viewkey, derivation);
} else {
AUTO_LOCK_CMD();
int offset = set_command_header_noopt(INS_GEN_KEY_DERIVATION);
//pub
memmove(this->buffer_send+offset, pub.data, 32);

View File

@@ -44,8 +44,8 @@ namespace hw {
/* Minimal supported version */
#define MINIMAL_APP_VERSION_MAJOR 1
#define MINIMAL_APP_VERSION_MINOR 6
#define MINIMAL_APP_VERSION_MICRO 0
#define MINIMAL_APP_VERSION_MINOR 7
#define MINIMAL_APP_VERSION_MICRO 6
#define VERSION(M,m,u) ((M)<<16|(m)<<8|(u))
#define VERSION_MAJOR(v) (((v)>>16)&0xFF)
@@ -192,11 +192,8 @@ namespace hw {
// To speed up blockchain parsing the view key maybe handle here.
crypto::secret_key viewkey;
bool has_view_key;
//extra debug
#ifdef DEBUG_HWDEVICE
device *controle_device;
#endif
public:
device_ledger();

View File

@@ -365,15 +365,14 @@ namespace trezor {
void device_trezor_base::device_state_initialize_unsafe()
{
require_connected();
std::string tmp_session_id;
auto initMsg = std::make_shared<messages::management::Initialize>();
const auto data_cleaner = epee::misc_utils::create_scope_leave_handler([&]() {
memwipe(&tmp_session_id[0], tmp_session_id.size());
if (initMsg->has_session_id())
memwipe(&(*initMsg->mutable_session_id())[0], initMsg->mutable_session_id()->size());
});
if(!m_device_session_id.empty()) {
tmp_session_id.assign(m_device_session_id.data(), m_device_session_id.size());
initMsg->set_allocated_session_id(&tmp_session_id);
initMsg->set_allocated_session_id(new std::string(m_device_session_id.data(), m_device_session_id.size()));
}
m_features = this->client_exchange<messages::management::Features>(initMsg);
@@ -382,8 +381,6 @@ namespace trezor {
} else {
m_device_session_id.clear();
}
initMsg->release_session_id();
}
void device_trezor_base::device_state_reset()
@@ -453,18 +450,14 @@ namespace trezor {
pin = m_pin;
}
std::string pin_field;
messages::common::PinMatrixAck m;
if (pin) {
pin_field.assign(pin->data(), pin->size());
m.set_allocated_pin(&pin_field);
m.set_allocated_pin(new std::string(pin->data(), pin->size()));
}
const auto data_cleaner = epee::misc_utils::create_scope_leave_handler([&]() {
m.release_pin();
if (!pin_field.empty()){
memwipe(&pin_field[0], pin_field.size());
}
if (m.has_pin())
memwipe(&(*m.mutable_pin())[0], m.mutable_pin()->size());
});
resp = call_raw(&m);
@@ -499,7 +492,6 @@ namespace trezor {
boost::optional<epee::wipeable_string> passphrase;
TREZOR_CALLBACK_GET(passphrase, on_passphrase_request, on_device);
std::string passphrase_field;
messages::common::PassphraseAck m;
m.set_on_device(on_device);
if (!on_device) {
@@ -512,16 +504,13 @@ namespace trezor {
}
if (passphrase) {
passphrase_field.assign(passphrase->data(), passphrase->size());
m.set_allocated_passphrase(&passphrase_field);
m.set_allocated_passphrase(new std::string(passphrase->data(), passphrase->size()));
}
}
const auto data_cleaner = epee::misc_utils::create_scope_leave_handler([&]() {
m.release_passphrase();
if (!passphrase_field.empty()){
memwipe(&passphrase_field[0], passphrase_field.size());
}
if (m.has_passphrase())
memwipe(&(*m.mutable_passphrase())[0], m.mutable_passphrase()->size());
});
resp = call_raw(&m);

Some files were not shown because too many files have changed in this diff Show More