forked from such-gitea/wownero
Compare commits
443 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab42be18f2 | ||
|
|
44c482913f | ||
|
|
07864cc53f | ||
|
|
2d8b094e09 | ||
|
|
cc0889aa59 | ||
|
|
23d1a8d68e | ||
|
|
35c9cf9c88 | ||
|
|
833ac01ed9 | ||
|
|
dc3981618d | ||
|
|
2eeb3fc1bf | ||
|
|
940811465f | ||
|
|
4a60dfbb3e | ||
|
|
7cdb8244ee | ||
|
|
0f8a3eded6 | ||
|
|
0c3ffa66ce | ||
|
|
01903438a0 | ||
|
|
3692b631b3 | ||
|
|
39379d7022 | ||
|
|
ac12e02fcb | ||
|
|
e85ee60d35 | ||
|
|
6a561e5d83 | ||
|
|
9efbb8896c | ||
|
|
7412b75d42 | ||
|
|
ee0c3ed694 | ||
|
|
053c7bccb5 | ||
|
|
4fdf8c01cb | ||
|
|
51e7a4178e | ||
|
|
f3a45f26c4 | ||
|
|
7944b65d7d | ||
|
|
90e321abd0 | ||
|
|
a053814e71 | ||
|
|
a7c7711b47 | ||
|
|
8ab87421d9 | ||
|
|
83b06a7ef8 | ||
|
|
c8b4665370 | ||
|
|
26b8602a03 | ||
|
|
31ec95aade | ||
|
|
29613140f2 | ||
|
|
ae0ea220d5 | ||
|
|
25e497db3f | ||
|
|
4edba5301a | ||
|
|
3ea6587022 | ||
|
|
1840e844db | ||
|
|
9da60611db | ||
|
|
2baefe5e7e | ||
|
|
859e43810b | ||
|
|
a400e47582 | ||
|
|
234674922c | ||
|
|
882e13f15f | ||
|
|
947c154cd1 | ||
|
|
e586e39936 | ||
|
|
3a5502297e | ||
|
|
7c24988ec0 | ||
|
|
4be1068f8a | ||
|
|
805bdf15f2 | ||
|
|
7e44298459 | ||
|
|
933e5df1cf | ||
|
|
e1b385332b | ||
|
|
2b814d3ca2 | ||
|
|
15495e8c28 | ||
|
|
92a382dc13 | ||
|
|
8e42421e15 | ||
|
|
07e4356090 | ||
|
|
b5ad030b5b | ||
|
|
337d131b82 | ||
|
|
3083209a0c | ||
|
|
f380155a97 | ||
|
|
ff6883710b | ||
|
|
93b6af8a66 | ||
|
|
307f553ee7 | ||
|
|
34884a4b00 | ||
|
|
e44b32c30c | ||
|
|
9176075ab9 | ||
|
|
ce6db7db63 | ||
|
|
54559e256b | ||
|
|
619bbbb99f | ||
|
|
0bdbd108d8 | ||
|
|
d2fcec5413 | ||
|
|
cf618fad1e | ||
|
|
6ca198c5e3 | ||
|
|
9093976dba | ||
|
|
d5f8b181df | ||
|
|
8180febd4a | ||
|
|
30a41c2ab1 | ||
|
|
118cbd043a | ||
|
|
40e30964c4 | ||
|
|
d47655f1f2 | ||
|
|
87a375b3ff | ||
|
|
c49a72f1ce | ||
|
|
7f7d697f43 | ||
|
|
3898c1c4d9 | ||
|
|
f6e95d080d | ||
|
|
b21562924e | ||
|
|
b78b83d79c | ||
|
|
a74d59a7c2 | ||
|
|
25e3365afb | ||
|
|
c2f2be5084 | ||
|
|
aad83a7965 | ||
|
|
85840ebae7 | ||
|
|
85197effd5 | ||
|
|
71fc01aaf2 | ||
|
|
e1ff02c1c5 | ||
|
|
952b0492d9 | ||
|
|
2222bea92f | ||
|
|
f12e75b5e4 | ||
|
|
0ae1cd2413 | ||
|
|
317eceb725 | ||
|
|
d98787eb1b | ||
|
|
ca1b1b7332 | ||
|
|
27c5013acd | ||
|
|
c0ce4d5089 | ||
|
|
3c15eb8e81 | ||
|
|
c61c09a567 | ||
|
|
b864817629 | ||
|
|
a520234c51 | ||
|
|
715ebcb744 | ||
|
|
4073599aaf | ||
|
|
2285c66ef1 | ||
|
|
99bee1ccf0 | ||
|
|
e48fae3177 | ||
|
|
be6c61e2ee | ||
|
|
1e037d372a | ||
|
|
6ec9fd6c08 | ||
|
|
ccfed6008a | ||
|
|
f0fa959383 | ||
|
|
8dbe2e57ac | ||
|
|
64c320130f | ||
|
|
8f95eaa0b0 | ||
|
|
9f93fe1539 | ||
|
|
db6688f584 | ||
|
|
f00db20a5f | ||
|
|
adcf440dcd | ||
|
|
925c6b60e3 | ||
|
|
94bad34c26 | ||
|
|
3c23aca26b | ||
|
|
49beb8da17 | ||
|
|
d188b5f51f | ||
|
|
8eb2b79bad | ||
|
|
3eb8f1458b | ||
|
|
a395f363e7 | ||
|
|
0fecd7eb86 | ||
|
|
76824bf827 | ||
|
|
67ba733de1 | ||
|
|
402ba046e0 | ||
|
|
1565bcb1fb | ||
|
|
2e9af2a1c8 | ||
|
|
db564efe0b | ||
|
|
85079173db | ||
|
|
8716d2ad9d | ||
|
|
5a34eae063 | ||
|
|
1510b1e550 | ||
|
|
7128f73ec2 | ||
|
|
8b63bb3c75 | ||
|
|
56ce7fca6f | ||
|
|
bc252794f0 | ||
|
|
07d82af979 | ||
|
|
9b840439b9 | ||
|
|
7e3f211791 | ||
|
|
2161bd0f3a | ||
|
|
ec6ff0d002 | ||
|
|
ceb8e7c508 | ||
|
|
72af8a5fce | ||
|
|
4f7c38a444 | ||
|
|
7d2e717ee8 | ||
|
|
83e378740a | ||
|
|
c28d2f7c11 | ||
|
|
a2d8f876ca | ||
|
|
3701257d61 | ||
|
|
90703ba8bd | ||
|
|
a080c0be9c | ||
|
|
de7565069e | ||
|
|
1d6f2114b8 | ||
|
|
cb9a2e4471 | ||
|
|
70c5c81670 | ||
|
|
d59cd3d222 | ||
|
|
dedcd6304c | ||
|
|
6e22710f0e | ||
|
|
02e9a41cbe | ||
|
|
def58196da | ||
|
|
73959c623c | ||
|
|
712f362150 | ||
|
|
153d08d026 | ||
|
|
2abd7b174b | ||
|
|
9a50bef3cd | ||
|
|
22bb6a654d | ||
|
|
38958f722b | ||
|
|
36a68b0cba | ||
|
|
6305b90596 | ||
|
|
9fc9c7d695 | ||
|
|
df032882a8 | ||
|
|
f6e63ef260 | ||
|
|
298208d92b | ||
|
|
d7b74a4fb0 | ||
|
|
f719b74cd1 | ||
|
|
1d597ad910 | ||
|
|
4f6eea9021 | ||
|
|
076254d113 | ||
|
|
daa1376370 | ||
|
|
eed63cef36 | ||
|
|
dcdbf7ebcf | ||
|
|
c18cdd3623 | ||
|
|
13978a9887 | ||
|
|
fd869a7b64 | ||
|
|
c8c7c40ac8 | ||
|
|
21ab1de89f | ||
|
|
699e82c282 | ||
|
|
9ec4ce36c7 | ||
|
|
9ca9f1214a | ||
|
|
d5b78c08b6 | ||
|
|
f59b1d5fb5 | ||
|
|
4a9ae3eb8b | ||
|
|
837c9aec22 | ||
|
|
af46a291ad | ||
|
|
25588de40c | ||
|
|
7fd140e4f7 | ||
|
|
c1776be54f | ||
|
|
30bc575505 | ||
|
|
aa408d1c72 | ||
|
|
c8895ccbb7 | ||
|
|
975d390d00 | ||
|
|
332b9734ff | ||
|
|
b5667c9f6c | ||
|
|
d8137dc523 | ||
|
|
c6e1d7bcdf | ||
|
|
6d5e2106b3 | ||
|
|
afec439953 | ||
|
|
25670398b1 | ||
|
|
fe6dda9453 | ||
|
|
8fef32e45c | ||
|
|
7f1a83b852 | ||
|
|
89fe0e1c81 | ||
|
|
b06ccc0416 | ||
|
|
83fa752a84 | ||
|
|
7ecdc53e11 | ||
|
|
32ab89aa86 | ||
|
|
5d2dd7a328 | ||
|
|
f3de67bc21 | ||
|
|
51057105b9 | ||
|
|
54cf799f0f | ||
|
|
3c7eec152c | ||
|
|
1128146c49 | ||
|
|
c2295f55b8 | ||
|
|
31b2572ec7 | ||
|
|
0add7ec1cd | ||
|
|
2107337999 | ||
|
|
f4e34d50cf | ||
|
|
a4ffad75ac | ||
|
|
024783f73a | ||
|
|
db686707cb | ||
|
|
5767e6db90 | ||
|
|
cb296b39bd | ||
|
|
57f7c2e53f | ||
|
|
531069859f | ||
|
|
00b3502749 | ||
|
|
e685f52e25 | ||
|
|
00253b717c | ||
|
|
7d67a2dde0 | ||
|
|
36dfd41e01 | ||
|
|
bcd7f63a54 | ||
|
|
3a477a54a2 | ||
|
|
218a109677 | ||
|
|
b8bc4d77b7 | ||
|
|
b39ee13d70 | ||
|
|
a99d6e56b6 | ||
|
|
5804add75b | ||
|
|
75e9e7b39a | ||
|
|
a87eca5e7d | ||
|
|
8c8f3d73b5 | ||
|
|
0fc927dfba | ||
|
|
d3e582e517 | ||
|
|
e42bb297b8 | ||
|
|
0443cccb5d | ||
|
|
b42d08995e | ||
|
|
138092ddc9 | ||
|
|
4ddde36c50 | ||
|
|
0873f3193a | ||
|
|
cbeaeb904b | ||
|
|
355be543c7 | ||
|
|
6cea8ca895 | ||
|
|
e08d37fc7b | ||
|
|
1c14b7b3b2 | ||
|
|
31ae533d6d | ||
|
|
d5be31ee21 | ||
|
|
adcbcd8f8b | ||
|
|
ba3c627c57 | ||
|
|
07b50c42dd | ||
|
|
ba60541f3e | ||
|
|
5c3e84b6ae | ||
|
|
e35bbb1e88 | ||
|
|
fb9ef24267 | ||
|
|
ee8d740cba | ||
|
|
e0e2eb2bf5 | ||
|
|
ecedaf2975 | ||
|
|
94897cf8f7 | ||
|
|
e38f3dbfb2 | ||
|
|
a4cdcd9bd0 | ||
|
|
42ee309292 | ||
|
|
f0b867b13d | ||
|
|
a436c36256 | ||
|
|
cf4461f40b | ||
|
|
905cc07c8b | ||
|
|
3bb748ad94 | ||
|
|
a569483c19 | ||
|
|
55e4007c48 | ||
|
|
54a4071473 | ||
|
|
4f70af3af1 | ||
|
|
31390dce4d | ||
|
|
c1d654708f | ||
|
|
b6b2c9b8e8 | ||
|
|
d6069f7ded | ||
|
|
7a9ba3f154 | ||
|
|
575f6b5f13 | ||
|
|
d6b2c676a9 | ||
|
|
5d39df5d92 | ||
|
|
91f941120d | ||
|
|
f9eee6f193 | ||
|
|
37800ceb5b | ||
|
|
b311043ec6 | ||
|
|
3a3370096e | ||
|
|
105afa5557 | ||
|
|
d729730d38 | ||
|
|
f570ce1349 | ||
|
|
ef1524ecca | ||
|
|
45d9a282d1 | ||
|
|
a700e6103b | ||
|
|
f47f1a0691 | ||
|
|
e83a220603 | ||
|
|
b4b3cd3ad3 | ||
|
|
f7aa91f70d | ||
|
|
f9a70e4260 | ||
|
|
f105a0ef38 | ||
|
|
1cb3ea0447 | ||
|
|
43788ffd2a | ||
|
|
6d35b667cf | ||
|
|
ce26c5b2dd | ||
|
|
21b3ff2c90 | ||
|
|
446b3c865b | ||
|
|
9427b5a6d5 | ||
|
|
fa79148e0c | ||
|
|
1382b17aa1 | ||
|
|
7982ef5a73 | ||
|
|
b34d50fa76 | ||
|
|
0833680c74 | ||
|
|
93135907dd | ||
|
|
065bb292df | ||
|
|
3942a1cd04 | ||
|
|
e4c0cb0ff3 | ||
|
|
9d7f473af0 | ||
|
|
41652c9aa1 | ||
|
|
0a0ceb62f0 | ||
|
|
8e7b762092 | ||
|
|
551e6c9168 | ||
|
|
c09d142972 | ||
|
|
efca5b8af9 | ||
|
|
251c64f195 | ||
|
|
5bb83ab042 | ||
|
|
af4fb4729e | ||
|
|
8e829e034f | ||
|
|
398e64ccbe | ||
|
|
a8cd073fcc | ||
|
|
f690e4984d | ||
|
|
ebc9197326 | ||
|
|
81f9fa947b | ||
|
|
752837b2c8 | ||
|
|
981e0b5cc3 | ||
|
|
6f48a146f8 | ||
|
|
1a3bef15b9 | ||
|
|
44c93bb47a | ||
|
|
c3fc96f0cf | ||
|
|
07f6ecd227 | ||
|
|
4985afddb3 | ||
|
|
4191dc8981 | ||
|
|
32581fb223 | ||
|
|
f3dd25c0e0 | ||
|
|
33dc825d6f | ||
|
|
91f1be9ea2 | ||
|
|
35186b1b84 | ||
|
|
bddd5653e1 | ||
|
|
b36c4f354b | ||
|
|
1ba4c8dbc2 | ||
|
|
92d19c48da | ||
|
|
01606ee52e | ||
|
|
81d2389c24 | ||
|
|
ef64c4e22f | ||
|
|
7fa01f342c | ||
|
|
4603ec9765 | ||
|
|
0be71bcea9 | ||
|
|
1a627e1f89 | ||
|
|
c1229a4432 | ||
|
|
9f68111b69 | ||
|
|
d1e79f2086 | ||
|
|
8965489acb | ||
|
|
d6953406c9 | ||
|
|
5090cdc9f5 | ||
|
|
df1061c87d | ||
|
|
f55f3fe81c | ||
|
|
9b7ed2fd8b | ||
|
|
e8468c5dcf | ||
|
|
76cc82c292 | ||
|
|
81a23c73d2 | ||
|
|
4b86583492 | ||
|
|
30918a27ab | ||
|
|
940b042e28 | ||
|
|
c028f4c4d8 | ||
|
|
f9a9d2ee28 | ||
|
|
81aaa4ec7b | ||
|
|
6e594e53bb | ||
|
|
e88b9170db | ||
|
|
39e30d5481 | ||
|
|
1120df3c53 | ||
|
|
42403c7acc | ||
|
|
fa63d4b3f0 | ||
|
|
4d855fcca7 | ||
|
|
8ae0110d54 | ||
|
|
a9178e3584 | ||
|
|
bbe6ee39e5 | ||
|
|
94a86cf855 | ||
|
|
745d90c4a4 | ||
|
|
e60be2289e | ||
|
|
5ef94b29c3 | ||
|
|
33281c1e2e | ||
|
|
518a2cdab4 | ||
|
|
8235854e8a | ||
|
|
4cf3545a31 | ||
|
|
a2e37eb3d8 | ||
|
|
6352090e6d | ||
|
|
c407b92e80 | ||
|
|
250c48a289 | ||
|
|
e49ad98a9b | ||
|
|
37bb59485f | ||
|
|
263579b217 | ||
|
|
4665906ddd | ||
|
|
826a84478d | ||
|
|
b4c775663a | ||
|
|
58cde83fb0 | ||
|
|
1a9a984d26 | ||
|
|
05405024c0 | ||
|
|
d65f9a3064 | ||
|
|
d39f8237e0 | ||
|
|
0473abf51d | ||
|
|
c02d24f838 | ||
|
|
9e6187a736 | ||
|
|
4846743fdc |
10
.drone.yml
10
.drone.yml
@@ -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
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
||||
custom: https://dev-funding.webui.wowkira.com
|
||||
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -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
3
.gitignore
vendored
@@ -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
16
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
122
CMakeLists.txt
122
CMakeLists.txt
@@ -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")
|
||||
|
||||
336
Dockerfile
336
Dockerfile
@@ -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"]
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014-2021, The Monero Project
|
||||
Copyright (c) 2014-2020, The Monero Project
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
64
PKGBUILD
64
PKGBUILD
@@ -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
118
README.md
@@ -1,11 +1,11 @@
|
||||
[](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.1 | 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
|
||||
```
|
||||
@@ -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"
|
||||
|
||||
@@ -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}")
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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_; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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"); \
|
||||
|
||||
@@ -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){};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}")
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: "wownero-android-0.9"
|
||||
name: "wownero-android-0.10"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "bionic"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: "wownero-freebsd-0.9"
|
||||
name: "wownero-freebsd-0.10"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "bionic"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: "wownero-linux-0.9"
|
||||
name: "wownero-linux-0.10"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "bionic"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: "wownero-osx-0.9"
|
||||
name: "wownero-osx-0.10"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "bionic"
|
||||
|
||||
@@ -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 |
@@ -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
|
||||
@@ -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" "$@"
|
||||
@@ -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
101
contrib/tor/wownero-over-tor.sh
Executable 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"
|
||||
2
external/RandomWOW
vendored
2
external/RandomWOW
vendored
Submodule external/RandomWOW updated: 89b7c02bba...62c6ea1176
10
external/db_drivers/liblmdb/mdb.c
vendored
10
external/db_drivers/liblmdb/mdb.c
vendored
@@ -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);
|
||||
|
||||
2
external/rapidjson
vendored
2
external/rapidjson
vendored
Submodule external/rapidjson updated: 3729501db9...129d19ba7f
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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.
@@ -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)
|
||||
@@ -200,7 +189,7 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
// make RPC call to daemon
|
||||
// curl http://127.0.0.1:34568/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":282700}}' -H 'Content-Type: application/json'
|
||||
// curl http://127.0.0.1:34568/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":307880}}' -H 'Content-Type: application/json'
|
||||
// "wide_cumulative_difficulty": "0x14eb4d0131fe8",
|
||||
ADD_CHECKPOINT2(1, "97f4ce4d7879b3bea54dcec738cd2ebb7952b4e9bb9743262310cd5fec749340", "0x2");
|
||||
ADD_CHECKPOINT2(6969, "aa7b66e8c461065139b55c29538a39c33ceda93e587f84d490ed573d80511c87", "0x118eef693fd"); //Hard fork to v8
|
||||
@@ -217,8 +206,25 @@ namespace cryptonote
|
||||
ADD_CHECKPOINT2(271600, "9597cdbdc52ca57d7dbd8f9c0a23a73194ef2ebbcfdc75c21992672706108d43", "0x1e2d2d6a2a9e8");
|
||||
ADD_CHECKPOINT2(278300, "b10dcdf7a51651f60fbcc0447409773eef1458d2c706d9a61daf467571ac19c9", "0x20a83a16d3968");
|
||||
ADD_CHECKPOINT2(282700, "79c06cafd7cb5f76bcebbf8f1ae16203bb41fd75b284bcd0eb0b457991ab7d4a", "0x22e3baf142de8");
|
||||
ADD_CHECKPOINT2(307692, "d822cd72037f62824ec87c9dc11768b45dc2632f697fa372e1885789c90f37fc", "0x305e124633878"); // low has block (Difficulty: 1890000), reason why careful people have audits
|
||||
ADD_CHECKPOINT2(307686, "dfd056b2739c132a07629409a59a028cb7414fac23e3419e79d2f49d66fc3af5", "0x305ba542e3ea8"); // "difficulty": 25800000
|
||||
ADD_CHECKPOINT2(307692, "d822cd72037f62824ec87c9dc11768b45dc2632f697fa372e1885789c90f37fc", "0x305e124633878"); // "difficulty": 1890000
|
||||
ADD_CHECKPOINT2(307735, "60970378aecdc0a78ccf5154edcc56f23aad8554b49e4716f820461a7588bfdc", "0x3070771b9ba58"); // "difficulty": 17900000
|
||||
ADD_CHECKPOINT2(307742, "0ed835bc9fcd949b5a184cf607dcc62ac4268c9e4cf220f8b09bcce58f10916b", "0x30732f1248978"); // "difficulty": 21300000
|
||||
ADD_CHECKPOINT2(307750, "7bcafbc757237125b70f569b181eb1b66c530b10d817d7b940f7a73dc827211c", "0x30766666b3d98"); // "difficulty": 10900000
|
||||
ADD_CHECKPOINT2(307766, "02fd6c7d6bae710cfa3efb08f50e4bc9a590f6ab61eabd87e5e951338c0c36f6", "0x307d2d47a7918"); // "difficulty": 2960000
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {};
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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
@@ -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,
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
};
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,10 +399,13 @@ 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 > uint64_t(-1)/(N*(N+1)*T*99)) {
|
||||
if (avg_D > 2000000*N*N*T && HEIGHT < 307800) {
|
||||
next_D = (avg_D/(200*L))*(N*(N+1)*T*99);
|
||||
}
|
||||
else if (avg_D > uint64_t(-1)/(N*(N+1)*T*99) && HEIGHT > 307800) {
|
||||
next_D = (avg_D/(200*L))*(N*(N+1)*T*99);
|
||||
}
|
||||
else { next_D = (avg_D*N*(N+1)*T*99)/(200*L); }
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -71,6 +71,7 @@ target_link_libraries(device
|
||||
PUBLIC
|
||||
${HIDAPI_LIBRARIES}
|
||||
cncrypto
|
||||
cryptonote_format_utils_basic
|
||||
ringct_basic
|
||||
wallet-crypto
|
||||
${OPENSSL_CRYPTO_LIBRARIES}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user