Compare commits

...

2974 Commits

Author SHA1 Message Date
Riccardo Spagni
a486cae407 Merge pull request #4120
1772c859 add .load() to make Boost 1.67 happy with its new is_integral check (Teutone)
2018-07-10 09:33:13 +02:00
Teutone
1772c8593a add .load() to make Boost 1.67 happy with its new is_integral check 2018-07-09 17:56:30 +01:00
Riccardo Spagni
9a4f1f0134 Merge pull request #4118
58f28cad wallet2: ensure outputs are processed only once (moneromooo-monero)
2018-07-09 17:52:01 +02:00
moneromooo-monero
58f28cadf8 wallet2: ensure outputs are processed only once
This should be proof against any way one might get to multiple
processing, such as generating the same derivation from the
same pubkey, etc
2018-07-08 12:05:04 +01:00
Riccardo Spagni
40530b294e Merge pull request #4102
424bfdc8 bump version to 12.3 (Riccardo Spagni)
2018-07-06 12:04:49 +02:00
Riccardo Spagni
424bfdc8d7 bump version to 12.3 2018-07-06 07:58:07 +02:00
Riccardo Spagni
1ce04b7574 Merge pull request #4092
3a1ad042 docker: update to new versions of dependencies (HomDx)
fc8726f1 fix sha256sum check, which requires two spaces. added set -ex to catch this, and other, errors in the future. (cornfeedhobo)
8c331a6d wallet2: fix double counting outs if the tx pubkey is duplicated (moneromooo-monero)
2daf54de abstract_tcp_server2: fix use after free (moneromooo-monero)
41662ebc device_ledger: fix buffer underflow on bad data from device (moneromooo-monero)
e389101c device: misc cleanup (moneromooo-monero)
076b7e10 device_ledger: fix potential buffer overflow from bad size calc (moneromooo-monero)
0429cabe simplewallet: init trusted daemon flag to false when autodetecting (moneromooo-monero)
b323d90f wallet2: fix read buffer overflow in import_key_images (moneromooo-monero)
47b42f8b wallet-rpc.getaddress: throw if index is out of bound (stoffu)
223429f0 zmq_server: fix bind call when address and/or port are empty (moneromooo-monero)
280e1a64 Fix RPC crashes that didn't check for an open wallet (Howard Chu)
43a12497 wallet2: fix out of sync account tag cache (moneromooo-monero)
e5ac16b0 abstract_tcp_server2: restart async accept on error (moneromooo-monero)
bea06d1a epee.string_tools: add conversion between UTF-8 and UTF-16 (stoffu)
e93058b4 wallet_api: fixups to build on the branch (moneromooo-monero)
8fb50b73 Wallet API: add support for wallet creation from hardware device (stoffu)
9e9cd108 Move parse_subaddress_lookahead() from simplewallet.cpp to util.cpp (stoffu)
fbdc3096 wallet2: lower default for subaddress lookahead when restoring with hardware (stoffu)
ed366efb add disclaimer about 3rd party packages (Jethro Grassie)
afa66965 wallet: allow unspendable unmixable outputs to be discarded (stoffu)
e70d80e8 wallet2: use decoded amount when reporting repeated output key (stoffu)
5e180c73 wallet2: use correct fee for split txes (stoffu)
d099dba9 epee: adaptive connection timeout system (moneromooo-monero)
04abe99f simplewallet: don't confirm missing payment ID when sending to only subaddresses (stoffu)
9c2f09df epee: fallback to a counter if gmtime fails when rotating logs (moneromooo-monero)
505fde2e Update readme to include pcslite dependency (Gingeropolous)
009feaca wallet2: fix get_approximate_blockchain_height for stagenet (stoffu)
7ce841cc wallet: do not log by default if we're not asked to log to console (moneromooo-monero)
4e2b279a tx_pool: initialize bitflags padding since it gets written to storage (moneromooo-monero)
b85169a5 README: mention --untrusted-daemon (moneromooo-monero)
082e0a1b util: consider Tor/I2P addresses to be non local (moneromooo-monero)
85d2ae4a simplewallet: add optional trusted/untrusted argument to set_daemon (moneromooo-monero)
233a1ead blockchain: pop forked blocks only when DB is not read-only (stoffu)
1380b70e Fixes #3645: error on freebsd lambda return values forced to std::string (rockhouse@users.noreply.github.com)
8e64b616 blockchain: return error when requesting non existent output (moneromooo-monero)
1d3874da epee: fix detection of 172.16.0.0/172.31.255.255 local IP range (moneromooo-monero)
74008527 daemon: fix readline interfering with std::cerr usage (moneromooo-monero)
81e39263 disable file size sanity check when loading the wallet cache (moneromooo-monero)
e04ae088 fix build with GCC 8.1.0 (moneromooo-monero)
f6896d99 core: lock incoming tx lock when checking the txpool and chain (moneromooo-monero)
f6dbb967 simplewallet: add --untrusted-daemon option (moneromooo-monero)
2018-07-05 21:05:44 +02:00
HomDx
3a1ad04234 docker: update to new versions of dependencies 2018-07-04 14:42:46 +01:00
cornfeedhobo
fc8726f1c3 fix sha256sum check, which requires two spaces. added set -ex to catch this, and other, errors in the future. 2018-07-04 14:42:45 +01:00
moneromooo-monero
8c331a6d26 wallet2: fix double counting outs if the tx pubkey is duplicated 2018-07-04 10:40:56 +01:00
moneromooo-monero
2daf54deeb abstract_tcp_server2: fix use after free 2018-07-04 10:40:53 +01:00
moneromooo-monero
41662ebcc7 device_ledger: fix buffer underflow on bad data from device 2018-07-04 10:40:50 +01:00
moneromooo-monero
e389101cb2 device: misc cleanup
use snprintf "just in case" where appropriate
consistently use unsigned for temp values
pass std::string by const ref rather than by value
add length check (which can't happen in practice) for memcpy
2018-07-04 10:40:46 +01:00
moneromooo-monero
076b7e1076 device_ledger: fix potential buffer overflow from bad size calc 2018-07-04 10:40:42 +01:00
moneromooo-monero
0429cabefd simplewallet: init trusted daemon flag to false when autodetecting 2018-07-04 10:40:39 +01:00
moneromooo-monero
b323d90f67 wallet2: fix read buffer overflow in import_key_images 2018-07-04 10:40:35 +01:00
stoffu
47b42f8b01 wallet-rpc.getaddress: throw if index is out of bound 2018-07-04 10:40:32 +01:00
moneromooo-monero
223429f0fd zmq_server: fix bind call when address and/or port are empty 2018-07-04 10:40:29 +01:00
Howard Chu
280e1a64bd Fix RPC crashes that didn't check for an open wallet 2018-07-04 10:40:26 +01:00
moneromooo-monero
43a124979a wallet2: fix out of sync account tag cache
This would cause crashes when trying to tag an account that was
just created
2018-07-04 10:40:23 +01:00
moneromooo-monero
e5ac16b077 abstract_tcp_server2: restart async accept on error 2018-07-04 10:40:19 +01:00
stoffu
bea06d1a32 epee.string_tools: add conversion between UTF-8 and UTF-16 2018-07-04 10:40:16 +01:00
moneromooo-monero
e93058b41c wallet_api: fixups to build on the branch 2018-07-04 10:40:13 +01:00
stoffu
8fb50b738f Wallet API: add support for wallet creation from hardware device 2018-07-04 10:40:09 +01:00
stoffu
9e9cd108a3 Move parse_subaddress_lookahead() from simplewallet.cpp to util.cpp 2018-07-04 10:40:06 +01:00
stoffu
fbdc30966b wallet2: lower default for subaddress lookahead when restoring with hardware 2018-07-03 11:19:53 +01:00
Jethro Grassie
ed366efb8c add disclaimer about 3rd party packages
Demoted the 3rd party maintained package installs to after compiling
from repository source and removed the broken Homebrew package
instructions.
2018-07-03 11:19:49 +01:00
stoffu
afa669656b wallet: allow unspendable unmixable outputs to be discarded 2018-07-03 11:19:45 +01:00
stoffu
e70d80e820 wallet2: use decoded amount when reporting repeated output key 2018-07-03 11:19:40 +01:00
stoffu
5e180c73f8 wallet2: use correct fee for split txes 2018-07-03 11:19:36 +01:00
moneromooo-monero
d099dba9e1 epee: adaptive connection timeout system
a connection's timeout is halved for every extra connection
from the same host.

Also keep track of when we don't need to use a connection
anymore, so we can close it and free the resource for another
connection.

Also use the longer timeout for non routable local addresses.
2018-07-03 11:19:32 +01:00
stoffu
04abe99f81 simplewallet: don't confirm missing payment ID when sending to only subaddresses 2018-07-03 11:19:28 +01:00
moneromooo-monero
9c2f09df51 epee: fallback to a counter if gmtime fails when rotating logs 2018-07-03 11:19:25 +01:00
Gingeropolous
505fde2e09 Update readme to include pcslite dependency
Update readme to include pcslite dependency
2018-07-03 11:19:21 +01:00
stoffu
009feaca79 wallet2: fix get_approximate_blockchain_height for stagenet 2018-07-03 11:17:56 +01:00
moneromooo-monero
7ce841cc2f wallet: do not log by default if we're not asked to log to console
This means monero-wallet-rpc still does, but the user level program
does not.
2018-07-03 11:17:52 +01:00
moneromooo-monero
4e2b279a94 tx_pool: initialize bitflags padding since it gets written to storage
Avoids valgrind reporting uninitialized data usage
2018-07-03 11:17:48 +01:00
moneromooo-monero
b85169a5b6 README: mention --untrusted-daemon
when connecting the wallet to a daemon on a tor hidden service
2018-07-03 11:17:44 +01:00
moneromooo-monero
082e0a1bef util: consider Tor/I2P addresses to be non local 2018-07-03 11:17:40 +01:00
moneromooo-monero
85d2ae4ad7 simplewallet: add optional trusted/untrusted argument to set_daemon
Otherwise the previous daemon's trustedness would carry over.
If not specified, the local address check is performed again.
2018-07-03 11:17:36 +01:00
stoffu
233a1ead22 blockchain: pop forked blocks only when DB is not read-only 2018-07-03 11:17:32 +01:00
rockhouse@users.noreply.github.com
1380b70e74 Fixes #3645: error on freebsd lambda return values forced to std::string 2018-07-03 11:17:28 +01:00
moneromooo-monero
8e64b61663 blockchain: return error when requesting non existent output
avoids RPC thread dying, causing the wallet to timeout
2018-07-03 11:17:24 +01:00
moneromooo-monero
1d3874dabf epee: fix detection of 172.16.0.0/172.31.255.255 local IP range 2018-07-03 11:17:19 +01:00
moneromooo-monero
740085271b daemon: fix readline interfering with std::cerr usage
Once readline is initialized, std::cerr's operator<< will
output a 0xff byte for unknown reasons.
2018-07-03 11:17:15 +01:00
moneromooo-monero
81e3926304 disable file size sanity check when loading the wallet cache 2018-07-03 11:17:11 +01:00
moneromooo-monero
e04ae088e8 fix build with GCC 8.1.0 2018-07-03 11:17:07 +01:00
moneromooo-monero
f6896d9974 core: lock incoming tx lock when checking the txpool and chain
This gets rid of an innocuous race trying to add the same tx
twice to the txpool
2018-07-03 11:17:03 +01:00
moneromooo-monero
f6dbb967f8 simplewallet: add --untrusted-daemon option 2018-07-03 11:17:00 +01:00
luigi1111
06b0f9e870 Merge pull request #3976
f40cf1a device_ledger: fix bad memory access on connect error (moneromooo-monero)
2018-06-27 15:35:13 -05:00
luigi1111
0a7efa45f7 Merge pull request #3928
b1538bf Update readme to indicate recommended version (Gingeropolous)
2018-06-25 14:51:45 -05:00
luigi1111
db26776a35 Merge pull request #3526
66100f2 malloc scratchpad for all supported android archs (m2049r)
2018-06-12 12:10:00 -05:00
moneromooo-monero
f40cf1a859 device_ledger: fix bad memory access on connect error 2018-06-09 20:49:05 +01:00
Gingeropolous
b1538bff31 Update readme to indicate recommended version
... is 0.12.2.0
2018-06-04 22:34:35 -04:00
Riccardo Spagni
e2c39f6b59 Merge pull request #3914
107eec4d protocol: drop (and increase fails) if most blocks hashes are invalid (moneromooo-monero)
2018-06-03 18:41:36 +02:00
Riccardo Spagni
f12b277d20 Merge pull request #3912
de742b5c blockchain: demote a hash-of-hashes validation warning to debug (moneromooo-monero)
2018-06-03 18:38:30 +02:00
moneromooo-monero
107eec4dca protocol: drop (and increase fails) if most blocks hashes are invalid 2018-06-03 17:37:06 +01:00
moneromooo-monero
de742b5c82 blockchain: demote a hash-of-hashes validation warning to debug
This data comes from untrusted peers, and validation failures
are therefore normal.
2018-06-02 23:52:50 +01:00
Riccardo Spagni
0d219ccdcd Merge pull request #3906
2cab7ec9 remove -master from version string (Riccardo Spagni)
e0cf1eca update checkpoints.dat for point release (Riccardo Spagni)
bfecf19c bump version for 0.12.2 point release (Riccardo Spagni)
2018-06-02 14:54:06 +02:00
Riccardo Spagni
2cab7ec917 remove -master from version string 2018-06-02 14:51:24 +02:00
Riccardo Spagni
e0cf1ecadd update checkpoints.dat for point release 2018-06-02 14:31:05 +02:00
Riccardo Spagni
bfecf19ce9 bump version for 0.12.2 point release 2018-06-02 14:27:48 +02:00
Riccardo Spagni
95568639e0 Merge pull request #3900
bcddce70 rpc: the cache is still for non cumulative on that branch (moneromooo-monero)
2018-06-01 13:24:27 +02:00
moneromooo-monero
bcddce70e6 rpc: the cache is still for non cumulative on that branch 2018-06-01 09:03:31 +01:00
Riccardo Spagni
bd56771996 Merge pull request #3858
f6687c3e rapidjson: remove outdated in-tree, use submodule (anonimal)
2018-05-31 21:26:31 +02:00
Riccardo Spagni
a87a19c570 Merge pull request #3893
410c6e5b rpc: convert distribution to cumulative after caching (moneromooo-monero)
2018-05-31 21:25:58 +02:00
Riccardo Spagni
3380458d2e Merge pull request #3891
9e96873f wallet2: don't ask for pruned txes yet, we still parse the entire tx (moneromooo-monero)
2018-05-31 21:25:43 +02:00
Riccardo Spagni
0dac3afc22 Merge pull request #3883
15e029ac rpc: fix get_output_distribution cache for the cumulative case (moneromooo-monero)
2018-05-31 21:24:52 +02:00
Riccardo Spagni
dca353c574 Merge pull request #3886
4602c267 Fix CMAKE config for PCSC in order to avoid msys DLL dependencies (cslashm)
2018-05-31 21:24:17 +02:00
Riccardo Spagni
8195a444ee Merge pull request #3889
5e2e003c http_protocol_handler: limit the number of starting newlines (moneromooo-monero)
fd9019b3 abstract_tcp_server2: timeout on RPC connections (moneromooo-monero)
ccaa666c http_protocol_handler: speedup newline discarding (moneromooo-monero)
ca7f0249 console_handler: fix start_default_console use of prompt parameter (moneromooo-monero)
2018-05-31 21:23:52 +02:00
Riccardo Spagni
b2dd94bcc0 Merge pull request #3802
a66f152f Use median timestamp if current time renders a block invalid. (Thaer Khawaja)
2018-05-31 21:22:58 +02:00
Riccardo Spagni
65c69fb67e Merge pull request #3884
49cf41a6 protocol: do not switch to unsafe sync mode for just a few blocks (moneromooo-monero)
22a4cb06 core: fix automatic safe db sync mode switching (moneromooo-monero)
2018-05-31 21:22:32 +02:00
moneromooo-monero
410c6e5b48 rpc: convert distribution to cumulative after caching
This avoids double conversion on a later cache hit
2018-05-31 16:55:24 +01:00
moneromooo-monero
9e96873f87 wallet2: don't ask for pruned txes yet, we still parse the entire tx 2018-05-31 16:45:43 +01:00
moneromooo-monero
5e2e003cfb http_protocol_handler: limit the number of starting newlines 2018-05-31 12:17:54 +01:00
moneromooo-monero
fd9019b37d abstract_tcp_server2: timeout on RPC connections 2018-05-31 12:17:52 +01:00
moneromooo-monero
ccaa666cf9 http_protocol_handler: speedup newline discarding 2018-05-31 12:17:50 +01:00
moneromooo-monero
ca7f0249eb console_handler: fix start_default_console use of prompt parameter
It had not been updated to the function type change
2018-05-31 12:17:48 +01:00
cslashm
4602c2674f Fix CMAKE config for PCSC in order to avoid msys DLL dependencies 2018-05-31 12:19:44 +02:00
moneromooo-monero
49cf41a61d protocol: do not switch to unsafe sync mode for just a few blocks 2018-05-30 18:28:55 +01:00
moneromooo-monero
22a4cb0609 core: fix automatic safe db sync mode switching 2018-05-30 18:28:53 +01:00
moneromooo-monero
15e029ac6d rpc: fix get_output_distribution cache for the cumulative case
The distribution was not converted to cumulative after a cache hit
2018-05-30 16:10:53 +01:00
anonimal
f6687c3ed8 rapidjson: remove outdated in-tree, use submodule
Includes ~2 years worth of fixes including security and build.

Note: this pulls directly from master, not a release branch/tag. See
https://github.com/Tencent/rapidjson/issues/1265

(cherry picked from commit 8a6c081df7)
2018-05-25 05:33:23 +00:00
Riccardo Spagni
aa6850c71d Merge pull request #3846
e18cb33e update checkpoints (Riccardo Spagni)
f1cdcba9 update checkpoints for point release (Riccardo Spagni)
ed273a88 bump version for point release (Riccardo Spagni)
2018-05-23 21:21:59 +02:00
Riccardo Spagni
e18cb33e08 update checkpoints 2018-05-23 21:16:57 +02:00
Riccardo Spagni
f1cdcba95e update checkpoints for point release 2018-05-23 21:13:54 +02:00
Riccardo Spagni
ed273a88d2 bump version for point release 2018-05-23 21:10:06 +02:00
Riccardo Spagni
c79fe98b71 Merge pull request #3843
e05a17f1 Fix PCSC discovery under Windows/MSYS Fix PCSC compilation under windows (cslashm)
2018-05-23 20:42:57 +02:00
cslashm
e05a17f1ea Fix PCSC discovery under Windows/MSYS
Fix PCSC compilation under windows
2018-05-22 19:43:49 +02:00
Riccardo Spagni
9205bba38a Merge pull request #3801
96405bca crypto: more places needing fixing for GCC 8.1 (moneroexamples)
86c63b8e chacha: fix build with GCC 8.1 (moneromooo-monero)
2018-05-21 21:59:27 +02:00
Riccardo Spagni
9bde29cb23 Merge pull request #3833
aabe3eed Fix output shuffling for multisig (stoffu)
2018-05-21 20:38:58 +02:00
Riccardo Spagni
b25c9ee183 Merge pull request #3838
38ef5f8b simplewallet: use correct unit for fee command (stoffu)
2018-05-21 20:38:31 +02:00
Riccardo Spagni
252e834800 Merge pull request #3796
fac173d8 Wallet API: allow log path to be non-default & console output to be configurable (stoffu)
2018-05-21 20:37:58 +02:00
Riccardo Spagni
ace614612b Merge pull request #3815
ffe9d882 speed up get_output_distribution (and precalc common case) (moneromooo-monero)
2018-05-21 20:37:19 +02:00
Riccardo Spagni
23edf8901f Merge pull request #3831
7f33e07d daemon: request unpruned transactions for print_tx (moneromooo-monero)
2018-05-21 20:36:47 +02:00
Riccardo Spagni
91de2f812f Merge pull request #3811
13184bc4 [RELEASE] Update readme to include link to announcement list (Gingeropolous)
2018-05-21 20:36:21 +02:00
Riccardo Spagni
2a1a208b2b Merge pull request #3753
4980d3c0 blockchain: pop top if block version disagrees with the ideal fork version (stoffu)
2018-05-21 20:35:15 +02:00
Riccardo Spagni
df688e0ec5 Merge pull request #3810
d6074be5 unit_tests: set default data dir to the source tree at build time (moneromooo-monero)
2018-05-21 20:34:32 +02:00
Riccardo Spagni
770c0189d0 Merge pull request #3808
41cb11b2 version.cmake: fix configuring version.cpp without git (moneromooo-monero)
2018-05-21 20:34:10 +02:00
stoffu
38ef5f8b51 simplewallet: use correct unit for fee command 2018-05-20 23:17:07 +09:00
stoffu
aabe3eedb8 Fix output shuffling for multisig 2018-05-20 09:40:32 +09:00
moneromooo-monero
ffe9d8821a speed up get_output_distribution (and precalc common case) 2018-05-19 13:28:02 +01:00
moneromooo-monero
7f33e07da3 daemon: request unpruned transactions for print_tx
instead of uninitialized
2018-05-19 00:05:37 +01:00
Gingeropolous
13184bc41e [RELEASE] Update readme to include link to announcement list
same as 3765 on master
2018-05-15 22:07:01 -04:00
moneromooo-monero
d6074be56b unit_tests: set default data dir to the source tree at build time 2018-05-15 21:45:51 +01:00
moneromooo-monero
41cb11b211 version.cmake: fix configuring version.cpp without git 2018-05-15 18:41:09 +01:00
Thaer Khawaja
a66f152f75 Use median timestamp if current time renders a block invalid. 2018-05-13 11:58:05 -07:00
moneroexamples
96405bcaa0 crypto: more places needing fixing for GCC 8.1 2018-05-13 18:17:36 +01:00
moneromooo-monero
86c63b8e15 chacha: fix build with GCC 8.1 2018-05-13 18:17:34 +01:00
stoffu
fac173d831 Wallet API: allow log path to be non-default & console output to be configurable 2018-05-12 08:57:29 +09:00
Riccardo Spagni
9ccd84b271 Merge pull request #3793
cc9dd7a6 wallet2: consider 6 outputs or less to be unmixable from v7 (moneromooo-monero)
2018-05-10 17:23:27 -07:00
moneromooo-monero
cc9dd7a64a wallet2: consider 6 outputs or less to be unmixable from v7 2018-05-10 21:19:54 +01:00
Riccardo Spagni
80b673dcad Merge pull request #3788
f24c970f blockchain: invalidate misc caches when popping blocks (moneromooo-monero)
2018-05-09 18:27:10 +02:00
Riccardo Spagni
e452e57a39 Merge pull request #3783
00dd9397 Fix mdb_load append option (hyc)
fa958d4b ITS#8831 move flag init into readhdr (hyc)
2018-05-09 18:23:26 +02:00
moneromooo-monero
f24c970f96 blockchain: invalidate misc caches when popping blocks
Might be a bit heavy handed, but conservative.
2018-05-09 09:11:35 +01:00
Riccardo Spagni
bab5bbfc19 Merge pull request #3741
2e336347 unit_tests: fix build after get_output_distribution signature change (moneromooo-monero)
2018-05-08 10:03:34 +02:00
Riccardo Spagni
20ef37bbca Merge pull request #3775
6f859e43 cryptonote: make sure outPk setup always happens (moneromooo-monero)
3880bf39 cryptonote_protocol_handler.inl: remove span read just now that failed to pass some basic tests (stoffu)
da249fd5 cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool) (stoffu)
e3c68b90 README.md: mention building deps with -fPIC for static builds (moneromooo-monero)
c1886155 unit_tests: fix build after get_output_didstribution signature change (moneromooo-monero)
82b05d50 Adding required library (dependency of boost::this_thread::sleep_for) (Gene Peters)
f9d0827b Fix broken interactive daemon 'limit' commands plus RPC calls (rbrunner7)
53a1962d epee: Drop deprecated Boost.Thread header (Jan Beich)
18c2f6e2 mlog: fix setting no logs (moneromooo-monero)
7346a59c Build: update miniupnp submodule (anonimal)
dad10775 Only log an error if fork version is higher AND is not known. (Thaer Khawaja)
ffeeefde speedup get_output_histogram for all amounts when min_count > 0 (moneromooo-monero)
2dae0f20 wallet2: add missing parameters to get_output_histogram (moneromooo-monero)
5bd7f760 import_multisig_info: fix sanity check crash in detach_blockchain (Mikhail Mitkevichl)
19e01378 Build: remove UPnP definition from snap (anonimal)
6b853980 Build: update CMake and p2p for in-tree miniupnp (anonimal)
859db52f CMake: update new location of in-tree miniupnpc (anonimal)
f21df05c Build: add miniupnp submodule (anonimal)
10685648 Build: remove in-tree miniupnpc (anonimal)
0b88fff3 simplewallet: fix help message of sign_transfer (stoffu)
f82c10dc WalletManagerImpl: reuse existing connection to daemon instead of reconnectivng every time (stoffu)
998c1461 daemon: read config file before reading any other args (stoffu)
f914df84 device: add a one off override keyword where appropriate (moneromooo-monero)
51b511be simplewallet: add version command (moneromooo-monero)
35d1269f daemon: add a version command (moneromooo-monero)
d8584fc8 util: log stack trace on crash (moneromooo-monero)
875c1cab wallet2: increase rpc timeout for get_output_distribution (moneromooo-monero)
70f23217 add top height to get_output_distribution, and cache it for rct (moneromooo-monero)
8c7363fb rpc: add missing perf timer for get_output_distribution (moneromooo-monero)
b5d6c723 wallet2: store subaddress lookahead settings (stoffu)
3367ed86 blockchain_blackball: fix build with CLANG 5 (moneromooo-monero)
94b899db Use 'boost' mutex instead of 'std' mutex (cslashm)
2c274e05 Fix sub-address tx scan. (cslashm)
73951cbd wallet2: request transactions in slices when scanning for known rings (moneromooo-monero)
25fe67e4 rpc: allow getting pruned blocks from gettransactions (moneromooo-monero)
08343aba tx_pool: fix loading with colliding key images (moneromooo-monero)
a9cc88ee common: make this build with unbound 1.4.20 (moneromooo-monero)
24acb66e wallet2: fix misc issues when the ringdb can't be initialized (moneromooo-monero)
0b26c4d5 wallet2: move segregation height to v7 (moneromooo-monero)
eecfb57d wallet: warn if not using the default ring size (moneromooo-monero)
aa5c2e01 simplewallet: warn about key reuse on startup (moneromooo-monero)
1e0958c0 wallet: fix default mixin (4 -> 6) (sneurlax)
0beb94f3 device: fix endianess dependence on subaddress secret key generation (moneromooo-monero)
11c933e1 fix lambda compile error on openbsd (moneromooo-monero)
c77d2bfa Add the possibility to export private view key for fast scan. (cslashm)
100b7bc1 Change mutex lock model to avoid dead lock and ensure locks are always released. (cslashm)
641dfc99 Automatic height setup when creating/restoring hw device. (cslashm)
dac3895a update block hashes for checkpoints.dat (Riccardo Spagni)
b1398fff core: fix use of uninitialised data (moneromooo-monero)
2018-05-08 09:58:04 +02:00
Riccardo Spagni
40070a661f Merge pull request #3776
ede213f6 cryptonote: make sure outPk setup always happens (moneromooo-monero)
2018-05-08 09:57:35 +02:00
hyc
00dd93971a Fix mdb_load append option
Use MDB_CURRENT to avoid seeking to new key when appending DUPs.
Reinit cursor on new batch, if appending DUPs.
2018-05-08 06:34:56 +01:00
hyc
fa958d4b4b ITS#8831 move flag init into readhdr
Avoid stomping on flags from 1st readhdr invocation
2018-05-08 06:34:50 +01:00
moneromooo-monero
ede213f65c cryptonote: make sure outPk setup always happens 2018-05-07 19:22:18 +01:00
moneromooo-monero
6f859e4328 cryptonote: make sure outPk setup always happens 2018-05-07 19:21:52 +01:00
stoffu
4980d3c0c9 blockchain: pop top if block version disagrees with the ideal fork version 2018-05-06 20:51:28 +09:00
Riccardo Spagni
e8e2bd5212 Merge pull request #3751
2ade8dfb ringct: do not show verification errors with default settings (moneromooo-monero)
2018-05-05 09:09:54 +02:00
moneromooo-monero
2ade8dfb02 ringct: do not show verification errors with default settings 2018-05-04 08:27:41 +01:00
moneromooo-monero
2e336347ec unit_tests: fix build after get_output_distribution signature change 2018-05-01 15:01:15 +01:00
Riccardo Spagni
6b9d9f56a1 Merge pull request #3719
3880bf39 cryptonote_protocol_handler.inl: remove span read just now that failed to pass some basic tests (stoffu)
da249fd5 cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool) (stoffu)
2018-04-29 21:38:22 +02:00
Riccardo Spagni
88c78d1683 Merge pull request #3729
e3c68b90 README.md: mention building deps with -fPIC for static builds (moneromooo-monero)
2018-04-29 21:38:12 +02:00
Riccardo Spagni
af6febaa83 Merge pull request #3730
bb8c0f62 README.md: mention building deps with -fPIC for static builds (moneromooo-monero)
2018-04-29 21:37:18 +02:00
Riccardo Spagni
715754d7fd Merge pull request #3723
16b20229 cryptonote_protocol_handler.inl: remove span read just now that failed to pass some basic tests (stoffu)
409bf2d6 cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool) (stoffu)
2018-04-29 21:35:49 +02:00
moneromooo-monero
bb8c0f62be README.md: mention building deps with -fPIC for static builds 2018-04-29 20:09:15 +01:00
moneromooo-monero
e3c68b9018 README.md: mention building deps with -fPIC for static builds 2018-04-29 20:06:19 +01:00
stoffu
16b2022991 cryptonote_protocol_handler.inl: remove span read just now that failed to pass some basic tests 2018-04-29 08:00:41 +09:00
stoffu
409bf2d642 cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool) 2018-04-29 08:00:17 +09:00
Riccardo Spagni
333c7edeb9 Merge pull request #3711
c0e22ebc [RELEASE] Fix broken interactive daemon 'limit' commands plus RPC calls (rbrunner7)
2018-04-28 22:42:09 +02:00
Riccardo Spagni
78011db913 Merge pull request #3712
4b89d877 Adding required library (dependency of boost::this_thread::sleep_for) (Gene Peters)
2018-04-28 22:41:35 +02:00
Riccardo Spagni
ec439a9376 Merge pull request #3707
76817605 epee: Drop deprecated Boost.Thread header (Jan Beich)
2018-04-28 22:40:59 +02:00
Riccardo Spagni
6d8498be1f Merge pull request #3704
e2b72da4 mlog: fix setting no logs (moneromooo-monero)
2018-04-28 22:40:28 +02:00
Riccardo Spagni
b085e11b52 Merge pull request #3696
b1a9e97b slow-hash: fix memory leak for Windows /karbowanec#41 (aivve)
2018-04-28 22:39:37 +02:00
Riccardo Spagni
123c0d7d4c Merge pull request #3690
80dc5d21 Only log an error if fork version is higher AND is not known. (Thaer Khawaja)
2018-04-28 22:39:09 +02:00
Riccardo Spagni
a48658017b Merge pull request #3686
d003f07c speedup get_output_histogram for all amounts when min_count > 0 (moneromooo-monero)
df9d59ca wallet2: add missing parameters to get_output_histogram (moneromooo-monero)
2018-04-28 22:38:43 +02:00
Riccardo Spagni
8636599654 Merge pull request #3684
9670c917 import_multisig_info: fix sanity check crash in detach_blockchain (Mikhail Mitkevichl)
2018-04-28 22:38:15 +02:00
Riccardo Spagni
31b31effc2 Merge pull request #3668
c6774215 Build: remove UPnP definition from snap (anonimal)
1e20d705 Build: update CMake and p2p for in-tree miniupnp (anonimal)
9e1f8bfa CMake: update new location of in-tree miniupnpc (anonimal)
c7b66d3d Build: add miniupnp submodule (anonimal)
e9622166 Build: remove in-tree miniupnpc (anonimal)
2018-04-28 22:27:24 +02:00
Riccardo Spagni
57a1bcb6b9 Merge pull request #3666
5ef4bf05 simplewallet: fix help message of sign_transfer (stoffu)
2018-04-28 22:26:26 +02:00
Riccardo Spagni
fde2a31964 Merge pull request #3665
e561a0c3 WalletManagerImpl: reuse existing connection to daemon instead of reconnectivng every time (stoffu)
2018-04-28 22:26:02 +02:00
Riccardo Spagni
2b16afedf9 Merge pull request #3664
0299d36e daemon: read config file before reading any other args (stoffu)
2018-04-28 22:25:35 +02:00
Riccardo Spagni
3384b0f0f4 Merge pull request #3634
26dc764a device: add a one off override keyword where appropriate (moneromooo-monero)
2018-04-28 22:25:10 +02:00
Riccardo Spagni
44b3c9bd55 Merge pull request #3631
fe427170 simplewallet: add version command (moneromooo-monero)
41b95ad4 daemon: add a version command (moneromooo-monero)
2018-04-28 22:24:28 +02:00
Riccardo Spagni
f09edc9fad Merge pull request #3625
9dc67af1 util: log stack trace on crash (moneromooo-monero)
2018-04-28 22:24:12 +02:00
Riccardo Spagni
6fec5f9fdc Merge pull request #3584
7d0505c8 wallet2: increase rpc timeout for get_output_distribution (moneromooo-monero)
96370488 add top height to get_output_distribution, and cache it for rct (moneromooo-monero)
bc4d53be rpc: add missing perf timer for get_output_distribution (moneromooo-monero)
2018-04-28 22:23:42 +02:00
Riccardo Spagni
07e55b0496 Merge pull request #3720
c1886155 unit_tests: fix build after get_output_didstribution signature change (moneromooo-monero)
2018-04-28 22:20:46 +02:00
moneromooo-monero
c1886155ed unit_tests: fix build after get_output_didstribution signature change 2018-04-28 18:02:58 +01:00
Riccardo Spagni
cd22cb807a Merge pull request #3709
82b05d50 Adding required library (dependency of boost::this_thread::sleep_for) (Gene Peters)
2018-04-28 17:02:22 +02:00
Riccardo Spagni
69b6f5b6a6 Merge pull request #3705
f9d0827b Fix broken interactive daemon 'limit' commands plus RPC calls (rbrunner7)
2018-04-28 17:02:08 +02:00
Riccardo Spagni
5bca8c6998 Merge pull request #3667
53a1962d epee: Drop deprecated Boost.Thread header (Jan Beich)
2018-04-28 17:01:32 +02:00
Riccardo Spagni
66e18cc92f Merge pull request #3703
18c2f6e2 mlog: fix setting no logs (moneromooo-monero)
2018-04-28 16:59:29 +02:00
Riccardo Spagni
26cae8f4f1 Merge pull request #3695
b1a9e97b slow-hash: fix memory leak for Windows /karbowanec#41 (aivve)
2018-04-28 16:59:02 +02:00
Riccardo Spagni
8c27f127ec Merge pull request #3692
7346a59c Build: update miniupnp submodule (anonimal)
2018-04-28 16:58:04 +02:00
Riccardo Spagni
2ab5b1a21f Merge pull request #3683
dad10775 Only log an error if fork version is higher AND is not known. (Thaer Khawaja)
2018-04-28 16:57:36 +02:00
Riccardo Spagni
93e76e14a2 Merge pull request #3685
ffeeefde speedup get_output_histogram for all amounts when min_count > 0 (moneromooo-monero)
2dae0f20 wallet2: add missing parameters to get_output_histogram (moneromooo-monero)
2018-04-28 16:56:22 +02:00
Riccardo Spagni
35299644b2 Merge pull request #3650
5bd7f760 import_multisig_info: fix sanity check crash in detach_blockchain (Mikhail Mitkevichl)
2018-04-28 16:54:37 +02:00
stoffu
3880bf396a cryptonote_protocol_handler.inl: remove span read just now that failed to pass some basic tests 2018-04-28 11:10:59 +09:00
stoffu
da249fd5ba cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool) 2018-04-28 11:07:51 +09:00
Gene Peters
4b89d877d7 Adding required library (dependency of boost::this_thread::sleep_for) 2018-04-26 11:34:59 -07:00
rbrunner7
c0e22ebcca [RELEASE] Fix broken interactive daemon 'limit' commands plus RPC calls 2018-04-26 20:08:17 +02:00
Gene Peters
82b05d5054 Adding required library (dependency of boost::this_thread::sleep_for) 2018-04-25 21:02:54 -07:00
Jan Beich
76817605bd epee: Drop deprecated Boost.Thread header
In file included from src/cryptonote_basic/hardfork.cpp:33:
In file included from src/blockchain_db/blockchain_db.h:42:
In file included from src/cryptonote_basic/hardfork.h:31:
contrib/epee/include/syncobj.h:37:10: fatal error: 'boost/thread/v2/thread.hpp' file not found
#include <boost/thread/v2/thread.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/rpc/daemon_handler.cpp:29:
In file included from src/rpc/daemon_handler.h:36:
In file included from src/p2p/net_node.h:41:
In file included from contrib/epee/include/net/levin_server_cp2.h:32:
In file included from contrib/epee/include/net/abstract_tcp_server2.h:324:
contrib/epee/include/net/abstract_tcp_server2.inl:44:10: fatal error: 'boost/thread/v2/thread.hpp' file not found
#include <boost/thread/v2/thread.hpp> // TODO
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

contrib/epee/include/math_helper.h: In member function 'bool epee::math_helper::average<val, default_base>::set_base()':
contrib/epee/include/syncobj.h:227:56: error: 'sleep_for' is not a member of 'boost::this_thread'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^
contrib/epee/include/syncobj.h:227:56: note: in definition of macro 'CRITICAL_REGION_LOCAL'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^~~~~~~~~
contrib/epee/include/syncobj.h:227:56: note: suggested alternative: 'sleep'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^
contrib/epee/include/syncobj.h:227:56: note: in definition of macro 'CRITICAL_REGION_LOCAL'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^~~~~~~~~
2018-04-25 22:23:42 +01:00
moneromooo-monero
e2b72da4ed mlog: fix setting no logs 2018-04-25 20:42:31 +01:00
moneromooo-monero
18c2f6e21d mlog: fix setting no logs 2018-04-25 20:42:11 +01:00
rbrunner7
f9d0827bba Fix broken interactive daemon 'limit' commands plus RPC calls 2018-04-25 21:37:10 +02:00
aivve
b1a9e97b2d slow-hash: fix memory leak for Windows /karbowanec#41 2018-04-24 20:47:29 +09:00
anonimal
7346a59c75 Build: update miniupnp submodule
f21df05 was never supposed to be merged into the master branch.
fluffypony merged #3670 before #3668 was rebased and resolved.

Note: the cherry-picked commit hashes are now invalid because #3670
was merged before #3668 was rebased with the updated repo location.
2018-04-23 22:27:54 +00:00
anonimal
c677421594 Build: remove UPnP definition from snap 2018-04-23 22:12:08 +00:00
anonimal
1e20d705e7 Build: update CMake and p2p for in-tree miniupnp 2018-04-23 22:12:08 +00:00
anonimal
9e1f8bfaa3 CMake: update new location of in-tree miniupnpc 2018-04-23 22:12:08 +00:00
anonimal
c7b66d3d8c Build: add miniupnp submodule
Though we only need miniupnpc, rebasing and maintaining a miniupnpc-only
repo is unrealistic.
2018-04-23 22:12:08 +00:00
Thaer Khawaja
80dc5d2110 Only log an error if fork version is higher AND is not known. 2018-04-23 07:53:46 -07:00
moneromooo-monero
ffeeefde60 speedup get_output_histogram for all amounts when min_count > 0
This skips the vast majority of "dust" output amounts with just
one instance on the chain. Clocks in at 0.15% of the original
time on testnet.
2018-04-23 10:54:28 +01:00
moneromooo-monero
2dae0f203a wallet2: add missing parameters to get_output_histogram 2018-04-23 10:54:25 +01:00
Mikhail Mitkevichl
9670c917d1 import_multisig_info: fix sanity check crash in detach_blockchain 2018-04-23 09:20:49 +03:00
Thaer Khawaja
dad1077577 Only log an error if fork version is higher AND is not known. 2018-04-22 17:26:44 -07:00
moneromooo-monero
d003f07c59 speedup get_output_histogram for all amounts when min_count > 0
This skips the vast majority of "dust" output amounts with just
one instance on the chain. Clocks in at 0.15% of the original
time on testnet.
2018-04-22 22:36:01 +01:00
moneromooo-monero
df9d59caff wallet2: add missing parameters to get_output_histogram 2018-04-22 22:35:58 +01:00
Mikhail Mitkevichl
5bd7f760e9 import_multisig_info: fix sanity check crash in detach_blockchain 2018-04-21 23:25:01 +03:00
Riccardo Spagni
8fdf645397 Merge pull request #3670
19e01378 Build: remove UPnP definition from snap (anonimal)
6b853980 Build: update CMake and p2p for in-tree miniupnp (anonimal)
859db52f CMake: update new location of in-tree miniupnpc (anonimal)
f21df05c Build: add miniupnp submodule (anonimal)
10685648 Build: remove in-tree miniupnpc (anonimal)
2018-04-21 22:01:54 +02:00
Riccardo Spagni
a429f06b18 Merge pull request #3579
0b88fff3 simplewallet: fix help message of sign_transfer (stoffu)
2018-04-21 21:58:52 +02:00
Riccardo Spagni
a3a617f35f Merge pull request #3576
f82c10dc WalletManagerImpl: reuse existing connection to daemon instead of reconnectivng every time (stoffu)
2018-04-21 21:58:10 +02:00
Riccardo Spagni
6189a775b0 Merge pull request #3636
998c1461 daemon: read config file before reading any other args (stoffu)
2018-04-21 21:57:31 +02:00
Riccardo Spagni
bcb71797c8 Merge pull request #3633
f914df84 device: add a one off override keyword where appropriate (moneromooo-monero)
2018-04-21 21:55:44 +02:00
Riccardo Spagni
7e98e9d7ce Merge pull request #3630
51b511be simplewallet: add version command (moneromooo-monero)
35d1269f daemon: add a version command (moneromooo-monero)
2018-04-21 21:55:28 +02:00
Riccardo Spagni
e6cf9c06fc Merge pull request #3624
d8584fc8 util: log stack trace on crash (moneromooo-monero)
2018-04-21 21:55:02 +02:00
Riccardo Spagni
03ff3be10e Merge pull request #3672
875c1cab wallet2: increase rpc timeout for get_output_distribution (moneromooo-monero)
70f23217 add top height to get_output_distribution, and cache it for rct (moneromooo-monero)
8c7363fb rpc: add missing perf timer for get_output_distribution (moneromooo-monero)
2018-04-21 21:54:08 +02:00
anonimal
19e0137805 Build: remove UPnP definition from snap
(cherry picked from commit 5ef6dcb1c4b08497533a20d0addcf1b09db51166)
2018-04-21 09:43:23 +00:00
anonimal
6b85398031 Build: update CMake and p2p for in-tree miniupnp
(cherry picked from commit a7366b5feeffaeb65b217b2d6f138e0ab1c90192)
2018-04-21 09:43:23 +00:00
moneromooo-monero
875c1cabb9 wallet2: increase rpc timeout for get_output_distribution 2018-04-19 16:06:26 +01:00
moneromooo-monero
70f2321763 add top height to get_output_distribution, and cache it for rct
This should cache the vast majority of calls for long running wallets
2018-04-19 16:06:22 +01:00
moneromooo-monero
8c7363fbef rpc: add missing perf timer for get_output_distribution 2018-04-19 16:06:20 +01:00
anonimal
859db52fda CMake: update new location of in-tree miniupnpc
(cherry picked from commit b16a282f97d8f6c967e8a0b1ecfd75110f095182)
2018-04-19 10:56:09 +00:00
anonimal
f21df05c77 Build: add miniupnp submodule
Though we only need miniupnpc, rebasing and maintaining a miniupnpc-only
repo is unrealistic.

(cherry picked from commit 3c40eb768c292a4dec79d7dffd6685fd37940a2a)
2018-04-19 10:55:56 +00:00
anonimal
1068564867 Build: remove in-tree miniupnpc
Will be replaced by a submodule.

(cherry picked from commit e962216678)
2018-04-19 10:55:29 +00:00
Jan Beich
53a1962da1 epee: Drop deprecated Boost.Thread header
In file included from src/cryptonote_basic/hardfork.cpp:33:
In file included from src/blockchain_db/blockchain_db.h:42:
In file included from src/cryptonote_basic/hardfork.h:31:
contrib/epee/include/syncobj.h:37:10: fatal error: 'boost/thread/v2/thread.hpp' file not found
#include <boost/thread/v2/thread.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/rpc/daemon_handler.cpp:29:
In file included from src/rpc/daemon_handler.h:36:
In file included from src/p2p/net_node.h:41:
In file included from contrib/epee/include/net/levin_server_cp2.h:32:
In file included from contrib/epee/include/net/abstract_tcp_server2.h:324:
contrib/epee/include/net/abstract_tcp_server2.inl:44:10: fatal error: 'boost/thread/v2/thread.hpp' file not found
#include <boost/thread/v2/thread.hpp> // TODO
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

contrib/epee/include/math_helper.h: In member function 'bool epee::math_helper::average<val, default_base>::set_base()':
contrib/epee/include/syncobj.h:227:56: error: 'sleep_for' is not a member of 'boost::this_thread'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^
contrib/epee/include/syncobj.h:227:56: note: in definition of macro 'CRITICAL_REGION_LOCAL'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^~~~~~~~~
contrib/epee/include/syncobj.h:227:56: note: suggested alternative: 'sleep'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^
contrib/epee/include/syncobj.h:227:56: note: in definition of macro 'CRITICAL_REGION_LOCAL'
 #define  CRITICAL_REGION_LOCAL(x) {boost::this_thread::sleep_for(boost::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));}   epee::critical_region_t<decltype(x)>   critical_region_var(x)
                                                        ^~~~~~~~~
2018-04-19 09:15:09 +00:00
anonimal
e962216678 Build: remove in-tree miniupnpc
Will be replaced by a submodule.
2018-04-19 06:28:55 +00:00
stoffu
5ef4bf05c5 simplewallet: fix help message of sign_transfer 2018-04-19 09:41:01 +09:00
stoffu
e561a0c329 WalletManagerImpl: reuse existing connection to daemon instead of reconnectivng every time 2018-04-19 09:33:37 +09:00
stoffu
0299d36e76 daemon: read config file before reading any other args 2018-04-19 09:29:57 +09:00
stoffu
998c1461c3 daemon: read config file before reading any other args 2018-04-14 22:05:24 +09:00
moneromooo-monero
26dc764ab0 device: add a one off override keyword where appropriate 2018-04-14 11:00:12 +01:00
moneromooo-monero
f914df8494 device: add a one off override keyword where appropriate 2018-04-14 10:59:38 +01:00
moneromooo-monero
fe427170b9 simplewallet: add version command 2018-04-13 18:48:06 +01:00
moneromooo-monero
41b95ad40e daemon: add a version command 2018-04-13 18:48:02 +01:00
moneromooo-monero
51b511be4c simplewallet: add version command 2018-04-13 18:47:33 +01:00
moneromooo-monero
35d1269fac daemon: add a version command 2018-04-13 18:47:30 +01:00
moneromooo-monero
7d0505c85d wallet2: increase rpc timeout for get_output_distribution 2018-04-13 10:55:41 +01:00
moneromooo-monero
96370488c0 add top height to get_output_distribution, and cache it for rct
This should cache the vast majority of calls for long running wallets
2018-04-13 10:55:38 +01:00
moneromooo-monero
9dc67af187 util: log stack trace on crash 2018-04-12 20:36:47 +01:00
moneromooo-monero
d8584fc8d7 util: log stack trace on crash 2018-04-12 20:36:16 +01:00
moneromooo-monero
bc4d53bece rpc: add missing perf timer for get_output_distribution 2018-04-12 18:06:22 +01:00
Riccardo Spagni
6f6521ad7a Merge pull request #3606
b5d6c723 wallet2: store subaddress lookahead settings (stoffu)
2018-04-12 15:27:49 +02:00
stoffu
b5d6c723e9 wallet2: store subaddress lookahead settings 2018-04-12 22:23:53 +09:00
Riccardo Spagni
41a66bf05b Merge pull request #3619
3edef51d blockchain_blackball: fix build with CLANG 5 (moneromooo-monero)
2018-04-12 15:11:02 +02:00
Riccardo Spagni
1f96755ddc Merge pull request #3618
3367ed86 blockchain_blackball: fix build with CLANG 5 (moneromooo-monero)
2018-04-12 15:10:21 +02:00
moneromooo-monero
3edef51d70 blockchain_blackball: fix build with CLANG 5
It doesn't like the explicit NULL dereference (which is fine, honest)
2018-04-12 14:04:31 +01:00
moneromooo-monero
3367ed863c blockchain_blackball: fix build with CLANG 5
It doesn't like the explicit NULL dereference (which is fine, honest)
2018-04-12 13:51:26 +01:00
Riccardo Spagni
079dd5dfef Merge pull request #3616
94b899db Use 'boost' mutex instead of 'std' mutex (cslashm)
2c274e05 Fix sub-address tx scan. (cslashm)
2018-04-12 14:41:51 +02:00
cslashm
94b899db26 Use 'boost' mutex instead of 'std' mutex 2018-04-12 13:58:57 +02:00
cslashm
2c274e05fe Fix sub-address tx scan.
When additional keys was needed, the TX scan failed because the
derivation data was always recomputed with the main tx_key and not
the corresponding additional one.

Moreover this patch avoid perf decreasing when not using HW device.
2018-04-12 13:58:57 +02:00
Riccardo Spagni
5e08fd89ea Merge pull request #3549
73951cbd wallet2: request transactions in slices when scanning for known rings (moneromooo-monero)
25fe67e4 rpc: allow getting pruned blocks from gettransactions (moneromooo-monero)
2018-04-12 13:49:33 +02:00
Riccardo Spagni
a95461e76d Merge pull request #3609
08343aba tx_pool: fix loading with colliding key images (moneromooo-monero)
2018-04-12 13:48:44 +02:00
Riccardo Spagni
1e9cc3e43e Merge pull request #3602
a9cc88ee common: make this build with unbound 1.4.20 (moneromooo-monero)
2018-04-12 13:48:12 +02:00
Riccardo Spagni
14c870ee5f Merge pull request #3615
24acb66e wallet2: fix misc issues when the ringdb can't be initialized (moneromooo-monero)
2018-04-12 13:47:54 +02:00
Riccardo Spagni
3b8704b0fa Merge pull request #3555
0b26c4d5 wallet2: move segregation height to v7 (moneromooo-monero)
2018-04-12 13:47:39 +02:00
Riccardo Spagni
5d8439e310 Merge pull request #3534
eecfb57d wallet: warn if not using the default ring size (moneromooo-monero)
2018-04-12 13:47:20 +02:00
Riccardo Spagni
f6094bb225 Merge pull request #3532
aa5c2e01 simplewallet: warn about key reuse on startup (moneromooo-monero)
2018-04-12 13:46:50 +02:00
Riccardo Spagni
226de8e928 Merge pull request #3530
eb59f7c5 cryptonote_tx_util: make destinations properly shuffled (stoffu)
2018-04-12 13:46:34 +02:00
Riccardo Spagni
8703f1d80e Merge pull request #3516
1e0958c0 wallet: fix default mixin (4 -> 6) (sneurlax)
2018-04-12 13:46:18 +02:00
Riccardo Spagni
4a9794e033 Merge pull request #3550
58f66073 wallet2: request transactions in slices when scanning for known rings (moneromooo-monero)
2897c269 rpc: allow getting pruned blocks from gettransactions (moneromooo-monero)
2018-04-12 13:44:55 +02:00
Riccardo Spagni
a9e2993258 Merge pull request #3607
5eeeec39 wallet2: store subaddress lookahead settings (stoffu)
2018-04-12 13:31:51 +02:00
Riccardo Spagni
5b8afd43ac Merge pull request #3610
178c11f4 tx_pool: fix loading with colliding key images (moneromooo-monero)
2018-04-12 13:27:46 +02:00
Riccardo Spagni
9ae9f6ada6 Merge pull request #3601
91a61fea common: make this build with unbound 1.4.20 (moneromooo-monero)
2018-04-12 13:26:48 +02:00
Riccardo Spagni
a4feeb4238 Merge pull request #3574
cdf9ecfd wallet2: fix misc issues when the ringdb can't be initialized (moneromooo-monero)
2018-04-12 13:24:28 +02:00
Riccardo Spagni
e89f33634d Merge pull request #3556
d400b4d3 wallet2: move segregation height to v7 (moneromooo-monero)
2018-04-12 13:24:07 +02:00
Riccardo Spagni
dd527d9369 Merge pull request #3535
4c6ff21c wallet: warn if not using the default ring size (moneromooo-monero)
2018-04-12 13:22:09 +02:00
Riccardo Spagni
1e792c3e26 Merge pull request #3533
2012cbe9 simplewallet: warn about key reuse on startup (moneromooo-monero)
2018-04-12 13:21:51 +02:00
Riccardo Spagni
3c7d7bc324 Merge pull request #3531
eb59f7c5 cryptonote_tx_util: make destinations properly shuffled (stoffu)
2018-04-12 13:21:15 +02:00
Riccardo Spagni
51a4cc0fad Merge pull request #3515
89250054 wallet: fix default mixin (4 -> 6) (sneurlax)
2018-04-12 13:06:56 +02:00
moneromooo-monero
24acb66eac wallet2: fix misc issues when the ringdb can't be initialized 2018-04-12 11:07:07 +01:00
Riccardo Spagni
7bd9b62db6 Merge pull request #3591
8daba22f Use 'boost' mutex instead of 'std' mutex (cslashm)
d481410b Fix sub-address tx scan. (cslashm)
2018-04-12 11:29:56 +02:00
Riccardo Spagni
3a9290ba6f Merge pull request #3511
0beb94f3 device: fix endianess dependence on subaddress secret key generation (moneromooo-monero)
2018-04-12 11:15:27 +02:00
Riccardo Spagni
5053f8f40b Merge pull request #3502
11c933e1 fix lambda compile error on openbsd (moneromooo-monero)
2018-04-12 11:14:43 +02:00
Riccardo Spagni
96b2fee721 Merge pull request #3536
c77d2bfa Add the possibility to export private view key for fast scan. (cslashm)
100b7bc1 Change mutex lock model to avoid dead lock and ensure locks are always released. (cslashm)
641dfc99 Automatic height setup when creating/restoring hw device. (cslashm)
2018-04-12 11:12:33 +02:00
Riccardo Spagni
60b18cdd1f Merge pull request #3492
dac3895a update block hashes for checkpoints.dat (Riccardo Spagni)
2018-04-12 11:07:16 +02:00
Riccardo Spagni
93047ce762 Merge pull request #3485
1834127c rpc: make get_output_distribution a non-restricted RPC (moneromooo-monero)
2018-04-12 11:06:26 +02:00
Riccardo Spagni
1b4dc46129 Merge pull request #3473
eaa8bfe7 wallet2: set from_height of GET_OUTPUT_DISTRIBUTION correctly The previous expression (stoffu)
0a619f78 wallet2: enable the mitigation only after the fork height (stoffu)
2018-04-12 11:05:31 +02:00
Riccardo Spagni
3d6636e79c Merge pull request #3471
5f664793 p2p: correct port number for seed nodes (stoffu)
2018-04-12 11:02:46 +02:00
Riccardo Spagni
ebb55f797b Merge pull request #3468
0098ed33 wallet2: fix for loading settings of key reuse mitigation (stoffu)
2018-04-12 11:00:47 +02:00
Riccardo Spagni
8902ddb91a Merge pull request #3466
1d79c14d Revert bb19386b (Howard Chu)
522be96f Fix generating version.cpp (Howard Chu)
2018-04-12 11:00:14 +02:00
Riccardo Spagni
628946c1f8 Merge pull request #3464
e520cc06 change wording in hard fork description section (Gingeropolous)
2018-04-12 10:59:44 +02:00
Riccardo Spagni
959f6ed9a5 Merge pull request #3461
57300491 wallet: catch exceptions dealing with ringdb and warn (moneromooo-monero)
2018-04-12 10:57:50 +02:00
moneromooo-monero
178c11f4a4 tx_pool: fix loading with colliding key images
A key image may be present more than once if all but one of the
txes spending that key image are coming from blocks. When loading
a txpool from storage, we must load the one that's not from a
block first to avoid rejection
2018-04-11 15:29:35 +01:00
moneromooo-monero
08343abaf4 tx_pool: fix loading with colliding key images
A key image may be present more than once if all but one of the
txes spending that key image are coming from blocks. When loading
a txpool from storage, we must load the one that's not from a
block first to avoid rejection
2018-04-11 15:27:56 +01:00
stoffu
5eeeec39f6 wallet2: store subaddress lookahead settings 2018-04-11 15:38:55 +09:00
moneromooo-monero
a9cc88ee76 common: make this build with unbound 1.4.20
Common on currently used distros
2018-04-10 23:46:18 +01:00
moneromooo-monero
91a61fea55 common: make this build with unbound 1.4.20
Common on currently used distros
2018-04-10 23:43:24 +01:00
cslashm
8daba22f92 Use 'boost' mutex instead of 'std' mutex 2018-04-10 08:43:06 +02:00
cslashm
d481410bff Fix sub-address tx scan.
When additional keys was needed, the TX scan failed because the
derivation data was always recomputed with the main tx_key and not
the corresponding additional one.

Moreover this patch avoid perf decreasing when not using HW device.
2018-04-09 16:53:13 +02:00
stoffu
0b88fff3a5 simplewallet: fix help message of sign_transfer 2018-04-07 22:51:03 +09:00
moneromooo-monero
58f6607382 wallet2: request transactions in slices when scanning for known rings
This avoid massive memory consumption for huge wallets
2018-04-07 08:42:02 +01:00
moneromooo-monero
2897c269de rpc: allow getting pruned blocks from gettransactions
and get them pruned in find_and_save_rings, since it does not need
the pruned data in the first place.

Also set decode_to_json to false where missing, we don't need this
either.
2018-04-07 08:41:59 +01:00
moneromooo-monero
73951cbd39 wallet2: request transactions in slices when scanning for known rings
This avoid massive memory consumption for huge wallets
2018-04-07 08:31:46 +01:00
moneromooo-monero
25fe67e4cf rpc: allow getting pruned blocks from gettransactions
and get them pruned in find_and_save_rings, since it does not need
the pruned data in the first place.

Also set decode_to_json to false where missing, we don't need this
either.
2018-04-07 08:29:11 +01:00
stoffu
f82c10dc96 WalletManagerImpl: reuse existing connection to daemon instead of reconnectivng every time 2018-04-07 14:06:29 +09:00
moneromooo-monero
cdf9ecfd0f wallet2: fix misc issues when the ringdb can't be initialized 2018-04-06 20:34:28 +01:00
m2049r
66100f2fa4 malloc scratchpad for all supported android archs 2018-04-05 21:13:47 +02:00
moneromooo-monero
d400b4d360 wallet2: move segregation height to v7
since people seem to really want to use things the wrong way.
2018-04-05 12:50:48 +01:00
moneromooo-monero
0b26c4d57c wallet2: move segregation height to v7
since people seem to really want to use things the wrong way.
2018-04-05 12:49:38 +01:00
cslashm
c77d2bfaa0 Add the possibility to export private view key for fast scan.
On client startup the device asks for authorization to export the private view key.
If user agree, the client hold the private view key allowing a fast blockchain scan.
If the user does not agree, the blockchain scan is fully done via the device.
2018-03-31 18:00:33 +02:00
cslashm
100b7bc10d Change mutex lock model to avoid dead lock and ensure locks are always released.
Additional cosmetic fixes:
 move 'name' as protected
 remove unnecessary local var
 Fix debug log
2018-03-31 18:00:33 +02:00
cslashm
641dfc991f Automatic height setup when creating/restoring hw device.
When creating/restoring wallet, if --restore-height option is not used the current estimate
height is used for starting the scan. In other words it is assume we are creating a new account.
2018-03-31 18:00:33 +02:00
moneromooo-monero
4c6ff21cc6 wallet: warn if not using the default ring size 2018-03-31 15:47:42 +01:00
moneromooo-monero
eecfb57df9 wallet: warn if not using the default ring size 2018-03-31 15:47:02 +01:00
moneromooo-monero
2012cbe9b5 simplewallet: warn about key reuse on startup 2018-03-31 12:20:52 +01:00
moneromooo-monero
aa5c2e01e7 simplewallet: warn about key reuse on startup 2018-03-31 10:52:10 +01:00
stoffu
eb59f7c563 cryptonote_tx_util: make destinations properly shuffled 2018-03-31 18:37:46 +09:00
Riccardo Spagni
7090121b13 Merge pull request #3512
a71e4dab device: fix endianess dependence on subaddress secret key generation (moneromooo-monero)
2018-03-29 17:04:27 +02:00
Riccardo Spagni
9fce7614c1 Merge pull request #3503
8ff2cc75 fix lambda compile error on openbsd (moneromooo-monero)
2018-03-29 17:04:12 +02:00
Riccardo Spagni
35e205cc13 Merge pull request #3478
0f3ff8ce Add the possibility to export private view key for fast scan. (cslashm)
da5de484 Change mutex lock model to avoid dead lock and ensure locks are always released. (cslashm)
4c0545cc Automatic height setup when creating/restoring hw device. (cslashm)
2018-03-29 17:02:42 +02:00
sneurlax
1e0958c083 wallet: fix default mixin (4 -> 6) 2018-03-28 09:30:11 -07:00
sneurlax
892500549a wallet: fix default mixin (4 -> 6) 2018-03-28 09:24:14 -07:00
cslashm
0f3ff8ce2c Add the possibility to export private view key for fast scan.
On client startup the device asks for authorization to export the private view key.
If user agree, the client hold the private view key allowing a fast blockchain scan.
If the user does not agree, the blockchain scan is fully done via the device.
2018-03-28 14:02:36 +02:00
cslashm
da5de484f2 Change mutex lock model to avoid dead lock and ensure locks are always released.
Additional cosmetic fixes:
 move 'name' as protected
 remove unnecessary local var
 Fix debug log
2018-03-28 14:02:36 +02:00
cslashm
4c0545cc41 Automatic height setup when creating/restoring hw device.
When creating/restoring wallet, if --restore-height option is not used the current estimate
height is used for starting the scan. In other words it is assume we are creating a new account.
2018-03-28 14:02:36 +02:00
moneromooo-monero
a71e4dabe8 device: fix endianess dependence on subaddress secret key generation
We now force little endianness
2018-03-28 11:57:11 +01:00
moneromooo-monero
0beb94f323 device: fix endianess dependence on subaddress secret key generation
We now force little endianness
2018-03-28 11:14:25 +01:00
moneromooo-monero
8ff2cc751d fix lambda compile error on openbsd 2018-03-27 14:49:54 +01:00
moneromooo-monero
11c933e137 fix lambda compile error on openbsd 2018-03-27 14:48:36 +01:00
Riccardo Spagni
c29890c2c0 Merge pull request #3493
32bd639b update block hashes for checkpoints.dat (Riccardo Spagni)
2018-03-24 17:56:14 +02:00
Riccardo Spagni
32bd639b4b update block hashes for checkpoints.dat 2018-03-24 08:48:23 +02:00
Riccardo Spagni
dac3895ac1 update block hashes for checkpoints.dat 2018-03-24 08:36:10 +02:00
Riccardo Spagni
202b6519a3 Merge pull request #3486
1834127c rpc: make get_output_distribution a non-restricted RPC (moneromooo-monero)
2018-03-23 21:15:23 +02:00
moneromooo-monero
1834127c82 rpc: make get_output_distribution a non-restricted RPC
so that those nodes can still be used for sending transactions
2018-03-23 10:56:55 +00:00
Riccardo Spagni
4396ff8501 Merge pull request #3474
eaa8bfe7 wallet2: set from_height of GET_OUTPUT_DISTRIBUTION correctly The previous expression (stoffu)
0a619f78 wallet2: enable the mitigation only after the fork height (stoffu)
2018-03-22 18:24:11 +02:00
Riccardo Spagni
68118645e6 Merge pull request #3472
5f664793 p2p: correct port number for seed nodes (stoffu)
2018-03-22 18:23:41 +02:00
Riccardo Spagni
8ce0cfc73a Merge pull request #3469
0098ed33 wallet2: fix for loading settings of key reuse mitigation (stoffu)
2018-03-22 18:23:13 +02:00
Riccardo Spagni
d27f86041c Merge pull request #3467
1d79c14d Revert bb19386b (Howard Chu)
522be96f Fix generating version.cpp (Howard Chu)
2018-03-22 18:22:56 +02:00
Riccardo Spagni
5e7dbe01b0 Merge pull request #3465
e520cc06 change wording in hard fork description section (Gingeropolous)
2018-03-22 18:22:29 +02:00
Riccardo Spagni
fb21032a7d Merge pull request #3462
57300491 wallet: catch exceptions dealing with ringdb and warn (moneromooo-monero)
2018-03-22 18:22:07 +02:00
stoffu
eaa8bfe7c0 wallet2: set from_height of GET_OUTPUT_DISTRIBUTION correctly
The previous expression

    req_t.from_height = X ? Y >= Z : 0;

forces the parameter to take the value of either 0 or 1.
2018-03-22 20:02:25 +09:00
stoffu
0a619f789b wallet2: enable the mitigation only after the fork height 2018-03-22 20:02:14 +09:00
stoffu
5f6647934b p2p: correct port number for seed nodes 2018-03-22 14:56:35 +09:00
stoffu
0098ed338c wallet2: fix for loading settings of key reuse mitigation 2018-03-22 12:10:46 +09:00
Howard Chu
1d79c14dbb Revert bb19386b
The requirement for CMake 3.2.0 was introduced erroneously
in commit e29282d208 and is no
longer present
2018-03-21 17:16:06 +00:00
Howard Chu
522be96fe4 Fix generating version.cpp
Also removes BYPRODUCT dependency on CMake 3.2
2018-03-21 16:33:52 +00:00
Gingeropolous
e520cc06a9 change wording in hard fork description section
changed wording in hard fork section because reasons. Added prospective slot of next hardfork to communicate that more are coming because it never stops.

its everywhere and all at the same time.
2018-03-21 16:27:21 +00:00
moneromooo-monero
5730049178 wallet: catch exceptions dealing with ringdb and warn 2018-03-21 14:29:49 +00:00
Riccardo Spagni
c31780678e Merge pull request #3441
d4d1afd6 core: fix use of uninitialised data (moneromooo-monero)
2018-03-19 12:51:01 +02:00
Riccardo Spagni
c1e16fdffa Merge pull request #3432
bb07d8d7 README: add instructions for cloning / submodules (anonimal)
2018-03-19 12:49:43 +02:00
Riccardo Spagni
8361d60aef Merge pull request #3434
b1398fff core: fix use of uninitialised data (moneromooo-monero)
2018-03-19 11:39:59 +02:00
Riccardo Spagni
2c145f4a38 Merge pull request #3431
bb07d8d7 README: add instructions for cloning / submodules (anonimal)
2018-03-19 11:39:22 +02:00
moneromooo-monero
d4d1afd688 core: fix use of uninitialised data 2018-03-18 23:39:22 +00:00
moneromooo-monero
b1398fff40 core: fix use of uninitialised data 2018-03-18 23:37:00 +00:00
anonimal
bb07d8d7f7 README: add instructions for cloning / submodules 2018-03-18 17:14:07 +00:00
Riccardo Spagni
5710edf040 Merge pull request #3429
428fb45f update checkpoints (Riccardo Spagni)
3fedd51d update checkpoints.dat to block 1532400 (Riccardo Spagni)
83dbc5be update version to 0.12 Lithium Luna (Riccardo Spagni)
2018-03-18 18:51:11 +02:00
Riccardo Spagni
1f6e6001ed Merge pull request #2133
efe70a15 Unbound: add git submodule for unbound (anonimal)
84c5a9ba Unbound: remove unbound from in-tree source (anonimal)
2018-03-18 18:50:21 +02:00
anonimal
efe70a15f8 Unbound: add git submodule for unbound 2018-03-18 15:52:27 +00:00
anonimal
84c5a9ba48 Unbound: remove unbound from in-tree source
We'll instead use a git submodule to pull from our unbound repo.
2018-03-18 15:52:19 +00:00
Riccardo Spagni
428fb45f68 update checkpoints 2018-03-18 16:44:36 +02:00
Riccardo Spagni
3fedd51d26 update checkpoints.dat to block 1532400 2018-03-18 16:42:20 +02:00
Riccardo Spagni
83dbc5be76 update version to 0.12 Lithium Luna 2018-03-18 16:15:50 +02:00
Riccardo Spagni
df91d7bcbd Merge pull request #3426
8ea3c4d5 simplewallet: new --use-english-language-names flag (moneromooo-monero)
2018-03-18 15:58:12 +02:00
Riccardo Spagni
b8ccd47b9f Merge pull request #3419
1e393f4b wallet: make the segregation height settable (moneromooo-monero)
2018-03-18 15:57:58 +02:00
Riccardo Spagni
ebbd001a89 Merge pull request #3424
bb20f104 Move v7 fork to 1546000 to give more update time (moneromooo-monero)
2018-03-18 15:53:26 +02:00
moneromooo-monero
bb20f104ba Move v7 fork to 1546000 to give more update time 2018-03-18 09:29:31 +00:00
moneromooo-monero
8ea3c4d544 simplewallet: new --use-english-language-names flag
On some Windows systems, displaying language names in their own
languages freezes the display.
2018-03-17 22:46:41 +00:00
moneromooo-monero
1e393f4bb7 wallet: make the segregation height settable
via user setting first, then DNS TXT record, hardcoded fallback
2018-03-17 14:56:31 +00:00
Riccardo Spagni
5cd36e48bf Merge pull request #3421
9732a37e wallet_rpc_server: add sweep_unmixable as alias for sweep_dust (moneromooo-monero)
2018-03-17 16:52:46 +02:00
Riccardo Spagni
83651630bc Merge pull request #3418
20a00266 blockchain: forbid bulletproof types before v8 (moneromooo-monero)
2018-03-17 16:51:47 +02:00
Riccardo Spagni
1e2fd27189 Merge pull request #3412
b86f1e5d Add command line option allowing to restrict the default sub-address lookahead in order to avoid so looooong time of set-up when creating a HW based wallet. (stoffu)
2018-03-17 16:49:34 +02:00
moneromooo-monero
9732a37e9a wallet_rpc_server: add sweep_unmixable as alias for sweep_dust 2018-03-17 11:22:58 +00:00
moneromooo-monero
20a002667c blockchain: forbid bulletproof types before v8
They were already forbidden implicitely, but let's make that
explicit for robustness
2018-03-16 18:18:34 +00:00
stoffu
b86f1e5dad Add command line option allowing to restrict the default sub-address lookahead in order to avoid
so looooong time of set-up when creating a HW based wallet.
2018-03-16 18:00:28 +01:00
Riccardo Spagni
a14eabc043 Merge pull request #3416
6f54c910 simplewallet: fix restore height prompt that got disabled by #3175 (stoffu)
2018-03-16 18:10:20 +02:00
Riccardo Spagni
432480fa42 Merge pull request #3414
524cbdc1 blockchain: fix log message about per-kB fee (stoffu)
2018-03-16 18:09:34 +02:00
Riccardo Spagni
2a9839cc3e Merge pull request #3376
833f9fcf show '<Not set>' for empty wallet description (cryptochangements34)
2018-03-16 18:08:52 +02:00
Riccardo Spagni
0f27fc57ac Merge pull request #3336
57c0b1ed Fix typos in various files (Dimitris Apostolou)
2018-03-16 18:08:07 +02:00
Riccardo Spagni
7d928be240 Merge pull request #3322
eac3a11e wallet: more user friendly print_ring (moneromooo-monero)
79853514 wallet2_api: add key reuse mitigations API (moneromooo-monero)
b057a21d wallet2_api: add ring api (moneromooo-monero)
d32ef7b0 ringdb: factor ring addition code (moneromooo-monero)
a7da8208 wallet2_api: add blackball api (moneromooo-monero)
2ab66ff1 liblmdb: install lmdb library for wallet2_api usage (stoffu)
504428ab ringdb: use the genesis block as a db name (moneromooo-monero)
b09e5181 wallet: add a set_ring command (moneromooo-monero)
0590f62a new blockchain_usage tool, reports on output usage (moneromooo-monero)
db10dd6d wallet: make ringdb an object with database state (moneromooo-monero)
df6fad4c blockchain_utilities: new blockchain_blackball tool (moneromooo-monero)
d29ea045 wallet: add an output blackball list to avoid using those in rings (moneromooo-monero)
18eaf194 wallet: key reuse mitigation options (moneromooo-monero)
5f146873 wallet: add shared ring database (moneromooo-monero)
41f727ce add RPC to get a histogram of outputs of a given amount (moneromooo-monero)
2018-03-16 18:07:33 +02:00
moneromooo-monero
eac3a11ed3 wallet: more user friendly print_ring
It can now take a txid (to display rings for all its inputs),
and will print rings in a format that set_ring understands
2018-03-16 12:07:45 +00:00
moneromooo-monero
798535149d wallet2_api: add key reuse mitigations API 2018-03-16 12:07:42 +00:00
moneromooo-monero
b057a21d56 wallet2_api: add ring api 2018-03-16 10:33:05 +00:00
moneromooo-monero
d32ef7b0f2 ringdb: factor ring addition code 2018-03-16 10:33:02 +00:00
moneromooo-monero
a7da8208f5 wallet2_api: add blackball api 2018-03-16 10:32:59 +00:00
stoffu
2ab66ff1d4 liblmdb: install lmdb library for wallet2_api usage 2018-03-16 10:32:57 +00:00
moneromooo-monero
504428ab4a ringdb: use the genesis block as a db name
This will avoid careless forkers polluting the shared database
even if they make their own chain. They'll then automatically
start using another subdb, and any key-reusing fork of those
forks will reuse their subdbs.
2018-03-16 10:32:54 +00:00
moneromooo-monero
b09e5181cc wallet: add a set_ring command
This is so one can set rings for spent key images in case the
attackers don't merge the ring matching patch set.
2018-03-16 10:32:51 +00:00
moneromooo-monero
0590f62ab6 new blockchain_usage tool, reports on output usage 2018-03-16 10:32:46 +00:00
moneromooo-monero
db10dd6d83 wallet: make ringdb an object with database state 2018-03-16 10:32:42 +00:00
moneromooo-monero
df6fad4c62 blockchain_utilities: new blockchain_blackball tool
It scans for known spent outputs and stores their public keys
in a database which can then be read by the wallet, which can
then avoid using those as fake outs in new transactions.

Usage: monero-blockchain-blackball db1 db2...

This uses the shared database in ~/.shared-ringdb
2018-03-16 10:32:39 +00:00
moneromooo-monero
d29ea0455a wallet: add an output blackball list to avoid using those in rings 2018-03-16 10:32:37 +00:00
moneromooo-monero
18eaf19489 wallet: key reuse mitigation options
If a pre-fork output is spent on both Monero and attack chain,
any post-fork output can be deduced to be a fake output, thereby
decreasing the effective ring size.

The segregate-per-fork-outputs option, on by default, allows
selecting only pre-fork outputs in this case, so that the same
ring can be used when spending it on the other side, which does
not decrease the effective ring size.

This is intended to be SET when intending to spend Monero on the
attack fork, and to be UNSET if not intending to spend Monero
on the attack fork (since it leaks the fact that the output being
spent is pre-fork).

If the user is not certain yet whether they will spend pre-fork
outputs on a key reusing fork, the key-reuse-mitigation2 option
should be SET instead.

If you use this option and intend to spend Monero on both forks,
then spend real Monero first.
2018-03-16 10:32:34 +00:00
moneromooo-monero
5f146873c5 wallet: add shared ring database
This maps key images to rings, so that different forks can reuse
the rings by key image. This avoids revealing the real inputs like
would happen if two forks spent the same outputs with different
rings. This database is meant to be shared with all Monero forks
which don't bother making a new chain, putting users' privacy at
risk in the process. It is placed in a shared data directory by
default ($HOME/.shared-ringdb on UNIX like systems). You may
use --shared-ringdb-dir to override this location, and should
then do so for all Monero forks for them to share the database.
2018-03-16 10:32:29 +00:00
moneromooo-monero
41f727ce42 add RPC to get a histogram of outputs of a given amount 2018-03-16 10:32:26 +00:00
cryptochangements34
833f9fcfe9 show '<Not set>' for empty wallet description 2018-03-15 23:22:45 -04:00
stoffu
6f54c910f7 simplewallet: fix restore height prompt that got disabled by #3175 2018-03-16 11:55:31 +09:00
stoffu
524cbdc1e2 blockchain: fix log message about per-kB fee 2018-03-16 10:43:19 +09:00
Dimitris Apostolou
57c0b1ed9f Fix typos in various files 2018-03-15 18:25:38 +02:00
Riccardo Spagni
51bb7fafac Merge pull request #3410
c5024c5b simplewallet: add a warning when getting a daemon error in transfer (moneromooo-monero)
2018-03-15 17:10:01 +02:00
Riccardo Spagni
60af9d689b Merge pull request #3408
e1b526b3 Remove the `Blockchain::get_all_known_block_ids` function. (Jean Pierre Dudey)
2018-03-15 17:09:13 +02:00
Riccardo Spagni
0683f3190d Merge pull request #3403
843f65cb tests/hash: correctly reference crypto HASH_SIZE for less confusion (AnythingTechPro)
2018-03-15 17:08:51 +02:00
Riccardo Spagni
a3f0292c06 Merge pull request #3271
a7266d6d wallet2+cli+rpc: eliminate redundant m_http_client from cli/rpc and delegate calls to wallet2 (stoffu)
71d18656 replace invoke_http_json("/json_rpc",...) with invoke_http_json_rpc("/json_rpc",methodname,...) to reduce boilerplate (stoffu)
2018-03-15 17:07:03 +02:00
moneromooo-monero
c5024c5b73 simplewallet: add a warning when getting a daemon error in transfer
A malicious daemon (or MITM) could attempt to add spurious errors
so the wallet tries again, sending another set of fake outs.
2018-03-15 13:33:19 +00:00
stoffu
a7266d6d7b wallet2+cli+rpc: eliminate redundant m_http_client from cli/rpc and delegate calls to wallet2 2018-03-15 22:01:51 +09:00
Jean Pierre Dudey
e1b526b371 Remove the Blockchain::get_all_known_block_ids function.
This function isn't used in the codebase.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-03-14 21:56:19 -04:00
AnythingTechPro
843f65cbda tests/hash: correctly reference crypto HASH_SIZE for less confusion 2018-03-14 11:10:54 -04:00
stoffu
71d186566e replace invoke_http_json("/json_rpc",...) with invoke_http_json_rpc("/json_rpc",methodname,...) to reduce boilerplate 2018-03-14 23:23:59 +09:00
Riccardo Spagni
a69c713f8e Merge pull request #3398
c577abab wallet: fix auto low priority so that it takes effect only when saved default is 0 (stoffu)
2018-03-14 16:18:15 +02:00
Riccardo Spagni
2fe1504c03 Merge pull request #3399
1d39b265 wallet2: fix use_fork_rules() when querying version that is defined but not enabled yet (stoffu)
2018-03-14 16:17:59 +02:00
Riccardo Spagni
f9f2d182da Merge pull request #3395
523371c0 p2p: fix network ID being uninitialised when using exclusive peers (moneromooo-monero)
2018-03-14 16:10:42 +02:00
Riccardo Spagni
8b90e3141a Merge pull request #3386
9abeff59 wallet2: handle no blocks returned in refresh to mean no new blocks (moneromooo-monero)
2018-03-14 16:10:00 +02:00
Riccardo Spagni
7a44301675 Merge pull request #3385
ec41006c node_rpc_proxy: fix target height caching (moneromooo-monero)
2018-03-14 16:09:40 +02:00
Riccardo Spagni
534369eece Merge pull request #3384
b63ea060 simplewallet: do not call a RPC when displaying the prompt (moneromooo-monero)
2018-03-14 16:08:14 +02:00
Riccardo Spagni
cb72b85bbf Merge pull request #3372
c3e23b2d ringct: 17% improvement in Borromean signature verification (moneromooo-monero)
2018-03-14 16:06:16 +02:00
Riccardo Spagni
102a51bcd4 Merge pull request #3350
4405e4fc wallet2: check_tx_key() shouldn't require hardware encryption (stoffu)
7dfa5e9e chacha: call prehashed version explicitly as generate_chacha_key_prehashed hash: add prehashed version cn_slow_hash_prehashed slow-hash: let cn_slow_hash take 4th parameter for deciding prehashed or not slow-hash: add support for prehashed version for the other 3 platforms (stoffu)
b2d23b18 crypto: revert odd namespace changes made in #3303 (stoffu)
8705beaf keypair::generate: always require hw::device to avoid possible mistake (stoffu)
27a196b1 device: untangle cyclic depenency (stoffu)
c9b38b47 device: made function prototypes consistent with pre-#3303 codebase (stoffu)
2018-03-14 16:04:10 +02:00
stoffu
4405e4fc73 wallet2: check_tx_key() shouldn't require hardware encryption 2018-03-14 21:00:18 +09:00
stoffu
7dfa5e9e6e chacha: call prehashed version explicitly as generate_chacha_key_prehashed
hash: add prehashed version cn_slow_hash_prehashed
slow-hash: let cn_slow_hash take 4th parameter for deciding prehashed or not
slow-hash: add support for prehashed version for the other 3 platforms
2018-03-14 21:00:17 +09:00
stoffu
b2d23b189e crypto: revert odd namespace changes made in #3303 2018-03-14 21:00:17 +09:00
stoffu
8705beaf51 keypair::generate: always require hw::device to avoid possible mistake 2018-03-14 21:00:16 +09:00
stoffu
27a196b126 device: untangle cyclic depenency
When #3303 was merged, a cyclic dependency chain was generated:

    libdevice <- libcncrypto <- libringct <- libdevice

This was because libdevice needs access to a set of basic crypto operations
implemented in libringct such as scalarmultBase(), while libringct also needs
access to abstracted crypto operations implemented in libdevice such as
ecdhEncode(). To untangle this cyclic dependency chain, this patch splits libringct
into libringct_basic and libringct, where the basic crypto ops previously in
libringct are moved into libringct_basic. The cyclic dependency is now resolved
thanks to this separation:

    libcncrypto <- libringct_basic <- libdevice <- libcryptonote_basic <- libringct

This eliminates the need for crypto_device.cpp and rctOps_device.cpp.

Also, many abstracted interfaces of hw::device such as encrypt_payment_id() and
get_subaddress_secret_key() were previously implemented in libcryptonote_basic
(cryptonote_format_utils.cpp) and were then called from hw::core::device_default,
which is odd because libdevice is supposed to be independent of libcryptonote_basic.
Therefore, those functions were moved to device_default.cpp.
2018-03-14 21:00:15 +09:00
stoffu
c9b38b4765 device: made function prototypes consistent with pre-#3303 codebase 2018-03-14 21:00:06 +09:00
Riccardo Spagni
a03d34f4e1 Merge pull request #3378
0014a7cc README.md: Updated OpenBSD build instructions (ston1th)
2018-03-14 13:39:04 +02:00
Riccardo Spagni
f2e8e8d23c Merge pull request #3377
aa8bef0c fix error message typo in wallet2.cpp (cryptochangements34)
2018-03-14 13:38:50 +02:00
Riccardo Spagni
ba5f143c09 Merge pull request #3381
fcb180f5 systemd,readme: torsocks config for service (redfish)
2018-03-14 13:38:12 +02:00
Riccardo Spagni
376ca73499 Merge pull request #3375
733deab2 Adjust to the MSYS2/MinGW static ICU library file renaming (rbrunner7)
2018-03-14 13:37:51 +02:00
Riccardo Spagni
2a257521e3 Merge pull request #3374
402c7162 Updated Swedish localization (Ordtrogen Översättning)
2018-03-14 13:37:40 +02:00
Riccardo Spagni
9a63fbcf83 Merge pull request #3371
84decbea core: add v7 for 1539500 on mainnet (moneromooo-monero)
2018-03-14 13:37:25 +02:00
Riccardo Spagni
3bc2537f5a Merge pull request #3369
1979d53d wallet: fixes and tweaks to the save_watch_only command (moneromooo-monero)
2018-03-14 13:37:14 +02:00
Riccardo Spagni
0f2d6d40b4 Merge pull request #3360
1ff35fda Wallet API: make nettype non-defaulted to disambiguate from deprecated versions (and make libwallet_api_tests compilable) (stoffu)
2018-03-14 13:37:00 +02:00
Riccardo Spagni
2e074e2ae7 Merge pull request #3358
978663d4 Stagenet: successive forks up to v7 (stoffu)
2018-03-14 13:36:47 +02:00
Riccardo Spagni
117cf12509 Merge pull request #3355
0bbd521f libwallet_merged: added missing libdevice (stoffu)
2018-03-14 13:36:36 +02:00
Riccardo Spagni
33158f089d Merge pull request #3354
ffe70b8f Make mixin optional with default for rpc transfer (cryptochangements34)
2018-03-14 13:36:25 +02:00
Riccardo Spagni
2dfb4f098e Merge pull request #3353
73dd883d Ledger HW Bug fixes (Cédric)
2018-03-14 13:36:14 +02:00
Riccardo Spagni
cfc5a3d4d4 Merge pull request #3345
e0cda74a wallet2_api: add info/error/warning entry points (moneromooo-monero)
2018-03-14 13:35:53 +02:00
Riccardo Spagni
67978b78ce Merge pull request #3337
91d97dd4 fuzz_tests: set small subaddress lookahead for speed (moneromooo-monero)
5f85cc7e wallet2: guard against overflowing of subaddress indices (moneromooo-monero)
2018-03-14 13:35:41 +02:00
Riccardo Spagni
3fed788603 Merge pull request #3315
649a1b7a wallet2 / simplewallet: Must opt-in to create '.address.txt' files for new wallets (Leon Klingele)
2018-03-14 13:35:11 +02:00
moneromooo-monero
91d97dd4ab fuzz_tests: set small subaddress lookahead for speed 2018-03-14 11:34:09 +00:00
moneromooo-monero
5f85cc7e3d wallet2: guard against overflowing of subaddress indices 2018-03-14 11:34:06 +00:00
stoffu
1d39b26556 wallet2: fix use_fork_rules() when querying version that is defined but not enabled yet 2018-03-14 19:02:21 +09:00
stoffu
c577abab61 wallet: fix auto low priority so that it takes effect only when saved default is 0 2018-03-14 18:33:43 +09:00
moneromooo-monero
523371c042 p2p: fix network ID being uninitialised when using exclusive peers 2018-03-13 11:20:49 +00:00
ston1th
0014a7ccb8 README.md: Updated OpenBSD build instructions
* Removed the db package, as it is not required
* Added the libiconv package
* Updated the boost build instructions (added locale)
* Updated cppzmq to version 4.2.3 which does not require the symlink hack anymore

added missing hashes for boost patches
2018-03-12 19:48:55 +01:00
Cédric
73dd883d51 Ledger HW Bug fixes
Fix the way the REAL mode is handle:
  Let create_transactions_2 and create_transactions_from construct the vector of transactions.
  Then iterate on it and resign.
  We just need to add 'outs' list in the TX struct for that.

Fix default secret keys value when DEBUG_HWDEVICE mode is off
  The magic value (00...00 for view key and FF..FF for spend key) was not correctly set
  when DEBUG_HWDEVICE was off. Both was set to 00...00.

Add sub-address info in ABP map in order to correctly display destination sub-address on device

Fix DEBUG_HWDEVICE mode:
   - Fix compilation errors.
   - Fix control device init in ledger device.
   - Add more log.

Fix sub addr control

Fix debug Info
2018-03-12 10:43:06 +01:00
moneromooo-monero
9abeff5911 wallet2: handle no blocks returned in refresh to mean no new blocks
This is not a possible return from the daemon, but I want this in
now so all wallets handle this when the daemon starts doing so.
2018-03-11 21:16:15 +00:00
moneromooo-monero
ec41006cad node_rpc_proxy: fix target height caching 2018-03-11 13:11:49 +00:00
moneromooo-monero
b63ea060de simplewallet: do not call a RPC when displaying the prompt
Speeds up refresh when you have a lot of in/out transactions
2018-03-11 10:23:45 +00:00
redfish
fcb180f590 systemd,readme: torsocks config for service 2018-03-10 12:17:14 -05:00
Leon Klingele
649a1b7ae6 wallet2 / simplewallet: Must opt-in to create '.address.txt' files for new wallets
Previously, a file containing the unencrypted Monero address was
created by default in the wallet's directory. This file might pose
as a privacy risk. The creation of this file is now opt-in and can
be enabled by providing

    --create-address-file
2018-03-10 16:28:23 +01:00
cryptochangements34
aa8bef0cb3 fix error message typo in wallet2.cpp 2018-03-09 17:22:26 -05:00
stoffu
978663d461 Stagenet: successive forks up to v7 2018-03-09 13:59:11 +09:00
rbrunner7
733deab249 Adjust to the MSYS2/MinGW static ICU library file renaming
In package mingw-w64-x86_64-icu, version 58.2-3, the names of static
library files were changed, which leads to changes in CMakeLists.txt as
needed for compiling for Windows.
2018-03-08 19:10:44 +01:00
Riccardo Spagni
e9f41e405f Merge pull request #3368
38657fd0 Bump min ring size from 5 to 7 from v7 (moneromooo-monero)
2018-03-08 18:47:41 +02:00
Riccardo Spagni
546e380cab Merge pull request #3370
04a0cc89 slow-hash: fix uint64 type typo (moneromooo-monero)
2018-03-08 18:44:47 +02:00
Riccardo Spagni
3a12f2588a Merge pull request #3365
55a65f32 Wallet API: corrected testnet/mainnet ordering (stoffu)
2018-03-08 18:44:18 +02:00
Riccardo Spagni
f4cf613e34 Merge pull request #3362
49c70962 device: remove dependency on readline (stoffu)
2018-03-08 18:43:37 +02:00
Riccardo Spagni
220cb62ca4 Merge pull request #3357
557a6fb6 cn_deserialize: link with device and ringct (moneromooo-monero)
2018-03-08 18:43:20 +02:00
Riccardo Spagni
5d80f38e36 Merge pull request #3356
7c81cc49 Dockerfile: add boost locale (MoroccanMalinois)
2018-03-08 18:42:59 +02:00
Riccardo Spagni
60c8544e77 Merge pull request #3347
9a6be3da wallet_manager: fixed typo deviuce/device.hpp (stoffu)
2018-03-08 18:42:24 +02:00
Ordtrogen Översättning
402c716212 Updated Swedish localization 2018-03-08 05:47:32 +01:00
moneromooo-monero
c3e23b2dce ringct: 17% improvement in Borromean signature verification 2018-03-08 00:41:54 +00:00
moneromooo-monero
84decbea48 core: add v7 for 1539500 on mainnet 2018-03-07 17:19:50 +00:00
moneromooo-monero
1979d53d78 wallet: fixes and tweaks to the save_watch_only command
- save the new keys file as FOO-watchonly.keys, not FOO.keys-watchonly
- catch any exception (eg, I/O errors) and error out
- print the new keys filename in simplewallet
2018-03-07 14:24:14 +00:00
moneromooo-monero
38657fd0e9 Bump min ring size from 5 to 7 from v7 2018-03-07 13:19:04 +00:00
moneromooo-monero
04a0cc89cf slow-hash: fix uint64 type typo 2018-03-07 09:48:58 +00:00
stoffu
55a65f3269 Wallet API: corrected testnet/mainnet ordering 2018-03-07 13:56:17 +09:00
stoffu
49c70962ee device: remove dependency on readline 2018-03-07 07:42:28 +09:00
stoffu
1ff35fda7c Wallet API: make nettype non-defaulted to disambiguate from deprecated versions (and make libwallet_api_tests compilable) 2018-03-06 21:14:52 +09:00
Riccardo Spagni
c102c49da5 Merge pull request #3253
e136bc6b tweaks to the monerov1 cryptonight algorithm (Lee Clagett)
d58c9ec9 slow-hash: optimized version (SChernykh)
608fd6f1 Monero Cryptonight variants, and add one for v7 (moneromooo-monero)
2018-03-06 08:41:02 +02:00
moneromooo-monero
557a6fb6ea cn_deserialize: link with device and ringct 2018-03-05 20:52:18 +00:00
MoroccanMalinois
7c81cc495f Dockerfile: add boost locale 2018-03-05 18:28:37 +00:00
Lee Clagett
e136bc6b8a tweaks to the monerov1 cryptonight algorithm 2018-03-05 18:18:45 +00:00
SChernykh
d58c9ec99c slow-hash: optimized version 2018-03-05 18:18:43 +00:00
moneromooo-monero
608fd6f14a Monero Cryptonight variants, and add one for v7
This is the first variant of many, with the intent to improve
Monero's resistance to ASICs and encourage mining decentralization.
2018-03-05 18:18:39 +00:00
stoffu
0bbd521fa2 libwallet_merged: added missing libdevice 2018-03-06 02:36:37 +09:00
cryptochangements34
ffe70b8f61 Make mixin optional with default for rpc transfer 2018-03-05 12:27:22 -05:00
Riccardo Spagni
0d150aca5c Merge pull request #3261
73ca4724 Use `genesis_tx` parameter in `generate_genesis_block`. (Jean Pierre Dudey)
2018-03-05 19:18:07 +02:00
Riccardo Spagni
a21c927d7d Merge pull request #3298
f2bb8085 Fix #3297 use the password_prompter helper (Howard Chu)
2018-03-05 19:17:51 +02:00
Riccardo Spagni
b4223f7ca2 Merge pull request #3304
6d4da1fc Update French translation (Guillaume LE VAILLANT)
2018-03-05 19:17:22 +02:00
Riccardo Spagni
0c2b25204e Merge pull request #3312
399120dd simplewallet: set seed language when restoring from english-old seed (stoffu)
2018-03-05 19:16:52 +02:00
Riccardo Spagni
237f0179b7 Merge pull request #3313
43026822 Wallet2 + CLI wallet: UTF-8 support for filenames and paths under Windows (rbrunner7)
2018-03-05 19:15:54 +02:00
Riccardo Spagni
baf640887d Merge pull request #3343
3d452367 allow using ring size instead of mixin for rpc transfer (cryptochangements34)
2018-03-05 19:14:03 +02:00
Riccardo Spagni
98acbe83fc Merge pull request #3348
c95dddd2 remove unused function keyImageV (h908714124)
2018-03-05 19:13:52 +02:00
Riccardo Spagni
05f0762dc5 Merge pull request #3346
25ea307d Fix invalid device unique_ptr cast (MoroccanMalinois)
2018-03-05 19:13:40 +02:00
Riccardo Spagni
9841a452e5 Merge pull request #3338
51219457 core: fix sending to the source address with a short payment id (moneromooo-monero)
2018-03-05 19:13:28 +02:00
Riccardo Spagni
61ac5b0471 Merge pull request #3332
6b40ea93 simplewallet: fix print_ring_members printing wrong heights (moneromooo-monero)
2018-03-05 19:12:59 +02:00
Riccardo Spagni
204d3f451b Merge pull request #3316
18057b20 Updating Boost download URL. (Tadeas Moravec)
2018-03-05 19:12:42 +02:00
Riccardo Spagni
5b25cbb5a7 Merge pull request #3314
71bff546 wallet api: when restoring from EnglishOld, set language to English (stoffu)
2018-03-05 19:12:24 +02:00
Riccardo Spagni
abcdb7b5c4 Merge pull request #3308
6f8779d2 blockchain: fix random sync failures (moneromooo-monero)
2018-03-05 19:12:05 +02:00
Riccardo Spagni
0e5c006207 Merge pull request #3307
223d7d0c db_lmdb: fix free space reporting (moneromooo-monero)
2018-03-05 19:11:52 +02:00
Riccardo Spagni
5950d356b6 Merge pull request #3301
34a2a085 rctSigs - loop invariant code removed from the loop (Dusan Klinec)
2018-03-05 19:11:35 +02:00
Riccardo Spagni
4f93f74528 Merge pull request #3277
0e7ad2e2 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (stoffu)
af773211 Stagenet (stoffu)
cc9a0bee command_line: allow args to depend on more than one args (stoffu)
55f8d917 command_line::get_arg: remove 'required' for dependent args as they're always optional (stoffu)
450306a0 command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 (stoffu)
9f9e095a Use `genesis_tx` parameter in `generate_genesis_block`. #3261 (Jean Pierre Dudey)
2018-03-05 19:11:20 +02:00
Riccardo Spagni
033ead4bad Merge pull request #3273
f3b74e75 Fix refresh height estimation (Howard Chu)
2018-03-05 19:11:07 +02:00
Riccardo Spagni
b54587d7b3 Merge pull request #3259
6d900a40 removed systemd private tempdir (ston1th)
496055d1 monerod: do not log to tmpdir in daemon mode (ston1th)
2018-03-05 19:10:51 +02:00
Riccardo Spagni
302aedb845 Merge pull request #3156
fbcc91c2 Correct spelling mistakes. (Edward Betts)
2018-03-05 19:10:22 +02:00
Edward Betts
fbcc91c2a4 Correct spelling mistakes. 2018-03-05 17:00:40 +00:00
cryptochangements34
3d452367b0 allow using ring size instead of mixin for rpc transfer 2018-03-05 10:10:35 -05:00
stoffu
0e7ad2e2c9 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' 2018-03-05 23:59:16 +09:00
h908714124
c95dddd2d2 remove unused function keyImageV 2018-03-05 09:21:44 +01:00
stoffu
9a6be3da25 wallet_manager: fixed typo deviuce/device.hpp 2018-03-05 11:57:30 +09:00
stoffu
af773211cb Stagenet 2018-03-05 11:55:05 +09:00
stoffu
cc9a0bee04 command_line: allow args to depend on more than one args 2018-03-05 11:19:08 +09:00
stoffu
55f8d917fd command_line::get_arg: remove 'required' for dependent args as they're always optional 2018-03-05 11:19:06 +09:00
stoffu
450306a01c command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 2018-03-05 11:19:04 +09:00
Jean Pierre Dudey
9f9e095a8c Use genesis_tx parameter in generate_genesis_block. #3261
* src/cryptnote_config.h: The constant `config::testnet::GENESIS_TX` was
changed to be the same as `config::GENESIS_TX` (the mainnet's transaction)
because the mainnet's transaction was being used for both networks.

* src/cryptonote_core/cryptonote_tx_utils.cpp: The `generate_genesis_block` function
was ignoring the  `genesis_tx` parameter, and instead it was using the `config::GENESIS_TX`
constant. That's why the testnet genesis transaction was changed. Also five lines of unused
code were removed.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-03-05 11:19:01 +09:00
MoroccanMalinois
25ea307d67 Fix invalid device unique_ptr cast 2018-03-04 18:56:48 +00:00
moneromooo-monero
e0cda74ace wallet2_api: add info/error/warning entry points 2018-03-04 18:07:30 +00:00
Riccardo Spagni
c7ace5fa3d Merge pull request #3303
e745c1e3 Code modifications to integrate Ledger HW device into monero-wallet-cli. (cslashm)
2018-03-04 19:03:41 +02:00
cslashm
e745c1e38d Code modifications to integrate Ledger HW device into monero-wallet-cli.
The basic approach it to delegate all sensitive data (master key, secret
ephemeral key, key derivation, ....) and related operations to the device.
As device has low memory, it does not keep itself the values
(except for view/spend keys) but once computed there are encrypted (with AES
are equivalent) and return back to monero-wallet-cli. When they need to be
manipulated by the device, they are decrypted on receive.

Moreover, using the client for storing the value in encrypted form limits
the modification in the client code. Those values are transfered from one
C-structure to another one as previously.

The code modification has been done with the wishes to be open to any
other hardware wallet. To achieve that a C++ class hw::Device has been
introduced. Two initial implementations are provided: the "default", which
remaps all calls to initial Monero code, and  the "Ledger", which delegates
all calls to Ledger device.
2018-03-04 12:54:53 +01:00
moneromooo-monero
51219457b1 core: fix sending to the source address with a short payment id
It would fail to send, thinking it needs a destination address,
since the destination matches the change address in this case.
2018-03-02 23:27:57 +00:00
moneromooo-monero
6b40ea937a simplewallet: fix print_ring_members printing wrong heights
And also use uint64_t instead of int for heights where appropriate
2018-03-02 00:25:16 +00:00
Tadeas Moravec
18057b20a3 Updating Boost download URL.
Boost does not use Sourceforge anymore. Instead, their download links
point to dl.bintray.com.

Earlier today Sourceforge was down, and later the Boost downloaded file
checksum did not match, which further reinforces the need to change
the URL.
2018-02-25 19:40:25 +01:00
stoffu
71bff546d3 wallet api: when restoring from EnglishOld, set language to English 2018-02-25 22:04:36 +09:00
rbrunner7
430268224d Wallet2 + CLI wallet: UTF-8 support for filenames and paths under Windows 2018-02-25 12:57:58 +01:00
stoffu
399120ddad simplewallet: set seed language when restoring from english-old seed 2018-02-25 12:44:10 +09:00
ston1th
6d900a40d9 removed systemd private tempdir 2018-02-23 21:28:08 +01:00
ston1th
496055d128 monerod: do not log to tmpdir in daemon mode
The logging to /tmp/bitmonero.daemon.stdout.stderr caused segfaults
if the /tmp mount was full (#2851).
Now the daemon is only logging to /tmp/bitmonero.daemon.stdout.stderr
in the debug builds.
2018-02-23 21:27:14 +01:00
moneromooo-monero
6f8779d282 blockchain: fix random sync failures
When a block is added as part of a chunk (when syncing historical
blocks), a block may end up already in the blockchain if it was
added to the queue before being added to the chain (though it's
not clear how that could happen, but it's an implementation detail)
and thus may not be added to the chain when add_block is called.
This would cause m_blocks_txs_check to not be cleared, causing it
to get out of sync at next call, and thus wrongfully reject the
next block.
2018-02-23 19:47:17 +00:00
moneromooo-monero
223d7d0c7a db_lmdb: fix free space reporting
reported by Brad Richards
2018-02-23 09:06:10 +00:00
Guillaume LE VAILLANT
6d4da1fc90 Update French translation 2018-02-22 14:44:05 +01:00
Dusan Klinec
34a2a08530 rctSigs - loop invariant code removed from the loop 2018-02-21 16:35:06 +01:00
Riccardo Spagni
421ab3119c Merge pull request #3245
54c256bc unit_tests.serialization: refactored with ASSERT_EQ_MAP (stoffu)
e6a60938 unit_tests: added gtest utility ASSERT_EQ_MAP for easily testing key-value map (stoffu)
2018-02-20 17:53:52 +02:00
Riccardo Spagni
2ac3da1251 Merge pull request #3256
df5273de wallet2: fix auto_low_priority field name typo on load (moneromooo-monero)
2018-02-20 17:53:38 +02:00
Riccardo Spagni
0d530bd04e Merge pull request #3295
6514f0ed db_lmdb: fix return code mixup in for_all_* (moneromooo-monero)
2018-02-20 17:49:16 +02:00
Riccardo Spagni
46903ec26a Merge pull request #3294
fd57e13a simplewallet: typo in generate-from-multisig-keys (stoffu)
2018-02-20 17:49:05 +02:00
Riccardo Spagni
21335e5c6b Merge pull request #3293
4a78a99f cryptonote_core: change wording of fork warning message (moneromooo-monero)
2018-02-20 17:48:54 +02:00
Riccardo Spagni
de79aba488 Merge pull request #3292
b372ec43 ITS#8324 More for Win32 NTDLL junk (Howard Chu)
2018-02-20 17:48:42 +02:00
Riccardo Spagni
299af8e43e Merge pull request #3290
1d28c0d8 p2p: restore m_testnet assignment lost during rebase (whythat)
2018-02-20 17:48:29 +02:00
Riccardo Spagni
854a87d633 Merge pull request #3289
4789f859 wipeable_string: don't try to wipe an empty buffer (moneromooo-monero)
2018-02-20 17:48:16 +02:00
Riccardo Spagni
ea9ddcac7f Merge pull request #3288
10f78f63 p2p: need libcryptonote_core due to arg_testnet_on being used (stoffu)
2018-02-20 17:48:05 +02:00
Riccardo Spagni
8e049d669d Merge pull request #3266
bb19386b README.md: bump minimum cmake version to 3.2.0 (iDunk5400)
2018-02-20 17:47:53 +02:00
Riccardo Spagni
fc57e0ef2d Merge pull request #3263
d4e728c9 simplewallet: reword donate command message for clarity (Serhack)
2018-02-20 17:47:42 +02:00
Riccardo Spagni
c9aa9370f9 Merge pull request #3260
b2d4bb9b Remove `voting_version` parameter documentation. (Jean Pierre Dudey)
2018-02-20 17:47:31 +02:00
Riccardo Spagni
4e9de94565 Merge pull request #3257
da25757b simplewallet: do nothing in on_skip_transaction (wallet2 already logs warnings) (stoffu)
2018-02-20 17:47:20 +02:00
Riccardo Spagni
ff36fd93fd Merge pull request #3255
3962bcb2 Closes #2886: really ignore battery checking (Timothy D. Prime)
2018-02-20 17:47:03 +02:00
Riccardo Spagni
f952da17c3 Merge pull request #3254
37ee966c add reference to localization workgroup in README.i18n.md (erciccione)
2018-02-20 17:46:52 +02:00
Riccardo Spagni
cfa3af4078 Merge pull request #3247
89ad162a wallet2: remove unused m_subaddresses_inv (moneromooo-monero)
f2c4c399 wallet2: speed up subaddress generation (by about a third) (moneromooo-monero)
2018-02-20 17:46:40 +02:00
Riccardo Spagni
6920fdaf4f Merge pull request #3246
3c33e131 wallet2: don't store invalid key image when watch-only (stoffu)
0133b348 wallet2: don't throw when spent amount is inconsistent (stoffu)
2018-02-20 17:46:29 +02:00
Riccardo Spagni
e3ad0c9ca6 Merge pull request #3243
2bc8c3db epee get_ns_count: cast to uint64_t before multiplying 10^9 to avoid overflow (stoffu)
2018-02-20 17:46:15 +02:00
Riccardo Spagni
0fc5eec9cd Merge pull request #3235
6866ed46 Add default value to max_height, otherwise it's 0 (Michał Sałaban)
2018-02-20 17:46:00 +02:00
Howard Chu
f2bb8085ec Fix #3297 use the password_prompter helper 2018-02-20 02:25:20 +00:00
moneromooo-monero
6514f0ed7b db_lmdb: fix return code mixup in for_all_* 2018-02-19 14:55:58 +00:00
stoffu
fd57e13a84 simplewallet: typo in generate-from-multisig-keys 2018-02-19 09:51:30 +09:00
moneromooo-monero
4a78a99f96 cryptonote_core: change wording of fork warning message
An udpate may or may not be available now, but should be soon if not.
This will prevent too many people freaking out.
2018-02-18 23:44:59 +00:00
Howard Chu
b372ec4375 ITS#8324 More for Win32 NTDLL junk
Use GetProcAddress at runtime, avoid buildtime NTDLL link issues
2018-02-18 21:56:55 +00:00
whythat
1d28c0d8a9 p2p: restore m_testnet assignment lost during rebase 2018-02-18 17:09:39 +02:00
moneromooo-monero
4789f8598f wipeable_string: don't try to wipe an empty buffer
memset_s doesn't like it
2018-02-18 14:02:36 +00:00
stoffu
10f78f63f1 p2p: need libcryptonote_core due to arg_testnet_on being used 2018-02-18 16:40:43 +09:00
Riccardo Spagni
4f80c50730 Merge pull request #3275
de397e3f refresh language files (erciccione)
264a8756 fix build error removing <> from payment_id (erciccione)
2018-02-17 21:49:26 +01:00
Riccardo Spagni
8154df778a Merge pull request #3276
ed6c68db crypto: add missing include (WIN32) (iDunk5400)
2018-02-17 21:48:59 +01:00
Riccardo Spagni
5a8e7fd0e5 Merge pull request #3249
a4b50a6f handle ^D and ^C while password prompting (Jethro Grassie)
2018-02-17 21:48:30 +01:00
Riccardo Spagni
5aa50a4504 Merge pull request #3274
dfabc005 memwipe: add missing #include <stdio.h> (stoffu)
2018-02-17 11:54:40 +01:00
Riccardo Spagni
6198c816b1 Merge pull request #3170
b3b2d4d2 options: add testnet option dependencies (whythat)
c5f55bb4 common: implement dynamic option dependencies mechanism (whythat)
05a12ccc options: remove testnet-* options (whythat)
c33cb60e common: implement dependent option descriptor (whythat)
2018-02-17 11:51:57 +01:00
Riccardo Spagni
a2cbedd29f Merge pull request #3191
3607d467 core: add --no-fluffy-blocks, and enable fluffy blocks by default (moneromooo-monero)
2018-02-17 11:48:31 +01:00
Riccardo Spagni
bed951323d Merge pull request #3211
7c1a607c txpool: Don't bail out when blob_size == tx_size_limit (Leon Klingele)
2018-02-17 11:47:17 +01:00
whythat
b3b2d4d20c options: add testnet option dependencies 2018-02-16 22:32:01 +02:00
whythat
c5f55bb4c0 common: implement dynamic option dependencies mechanism 2018-02-16 22:32:01 +02:00
whythat
05a12ccc2d options: remove testnet-* options 2018-02-16 22:32:01 +02:00
iDunk5400
ed6c68db1b crypto: add missing include (WIN32) 2018-02-16 19:35:31 +01:00
moneromooo-monero
89ad162a3f wallet2: remove unused m_subaddresses_inv 2018-02-16 17:13:09 +00:00
moneromooo-monero
f2c4c39971 wallet2: speed up subaddress generation (by about a third) 2018-02-16 17:13:06 +00:00
stoffu
dfabc005d1 memwipe: add missing #include <stdio.h> 2018-02-17 01:06:05 +09:00
erciccione
de397e3f55 refresh language files 2018-02-16 17:01:14 +01:00
erciccione
264a875685 fix build error removing <> from payment_id 2018-02-16 16:58:53 +01:00
Leon Klingele
7c1a607c40 txpool: Don't bail out when blob_size == tx_size_limit
Previously, when blob_size == tx_size_limit, the "m_too_big" property was set
and the transaction was rejected. This should not have been the case.
2018-02-16 16:27:08 +01:00
whythat
c33cb60eb6 common: implement dependent option descriptor 2018-02-16 16:44:40 +02:00
Howard Chu
f3b74e75b0 Fix refresh height estimation
Since commit b0426d4c refresh height for a newly created wallet
connected to a sync'd daemon was off by a month. Now we only use
the 1 month safety margin if we're unable to talk to a daemon.
2018-02-16 14:17:36 +00:00
moneromooo-monero
3607d467f3 core: add --no-fluffy-blocks, and enable fluffy blocks by default 2018-02-16 13:46:46 +00:00
Riccardo Spagni
ef91d6e61e Merge pull request #3196
eda9fb5b p2p: fix testnet/mainnet port mixup (moneromooo-monero)
2018-02-16 14:31:16 +01:00
Riccardo Spagni
6b1382b6b6 Merge pull request #3199
30ce8c59 cn_deserialize: check for raw tx_extra (moneromooo-monero)
2018-02-16 14:29:51 +01:00
Riccardo Spagni
f4a6bc79d9 Merge pull request #3226
e4646379 keccak: fix mdlen bounds sanity checking (moneromooo-monero)
2e3e90ac pass large parameters by const ref, not value (moneromooo-monero)
61defd89 blockchain: sanity check number of precomputed hash of hash blocks (moneromooo-monero)
9af6b2d1 ringct: fix infinite loop in unused h2b function (moneromooo-monero)
8cea8d0c simplewallet: double check a new multisig wallet is multisig (moneromooo-monero)
9b98a6ac threadpool: catch exceptions in dtor, to avoid terminate (moneromooo-monero)
24803ed9 blockchain_export: fix buffer overflow in exporter (moneromooo-monero)
f3f7da62 perf_timer: rewrite to make it clear there is no division by zero (moneromooo-monero)
c6ea3df0 performance_tests: remove add_arg call stray extra param (moneromooo-monero)
fa6b4566 fuzz_tests: fix an uninitialized var in setup (moneromooo-monero)
03887f11 keccak: fix sanity check bounds test (moneromooo-monero)
ad11db91 blockchain_db: initialize m_open in base class ctor (moneromooo-monero)
bece67f9 miner: restore std::cout precision after modification (moneromooo-monero)
1aabd14c db_lmdb: check hard fork info drop succeeded (moneromooo-monero)
2018-02-16 14:26:58 +01:00
Riccardo Spagni
64fabf2eb7 Merge pull request #3252
f689a77e Fix #602 Turn on socket keepalive (Howard Chu)
2018-02-16 14:24:30 +01:00
Riccardo Spagni
24d8f9237f Merge pull request #3248
d6a0ae96 blockchain: don't try to use hash check array after it's freed (moneromooo-monero)
2018-02-16 14:24:22 +01:00
Riccardo Spagni
853dd2d4f7 Merge pull request #3232
b81e276c connection_context: initialize m_last_request_time to current time (moneromooo-monero)
2018-02-16 14:24:12 +01:00
Riccardo Spagni
260d666cf4 Merge pull request #3231
84a8b2da Don't create readtxn until after txn_safe gate check (Howard Chu)
2018-02-16 14:24:01 +01:00
Riccardo Spagni
ef47ba95c8 Merge pull request #3229
928c1825 cryptonote_protocol: guard against all threads in standby (moneromooo-monero)
2018-02-16 14:23:53 +01:00
Riccardo Spagni
b5b88c2747 Merge pull request #3225
71806327 dns: change default DNS to a worldwide selection (moneromooo-monero)
2018-02-16 14:23:34 +01:00
Riccardo Spagni
a54247b993 Merge pull request #3221
2e584dcb p2p: do not try to connect to peers in offline mode (moneromooo-monero)
2018-02-16 14:23:22 +01:00
Riccardo Spagni
0c71197892 Merge pull request #3217
fde4489e wipeable_string: call memwipe directly (moneromooo-monero)
2018-02-16 14:23:08 +01:00
Riccardo Spagni
38f61ef8e2 Merge pull request #3216
5c99608d Fix coverity issues in performance_tests/main.cpp (h908714124)
2018-02-16 14:22:53 +01:00
Riccardo Spagni
9c4428e583 Merge pull request #3214
214d251c wallet: suggest the use of sweep_unmixable when not_enough_outs_to_mix is thrown (stoffu)
2018-02-16 14:22:41 +01:00
Riccardo Spagni
bfddb2283b Merge pull request #3210
39992134 txpool: Properly bail out when outputs_amount == inputs_amount (Leon Klingele)
2018-02-16 14:22:10 +01:00
Riccardo Spagni
9681a885d1 Merge pull request #3207
a99ef176 wallet-rpc: take subaddress account as arg for get_transfer_by_txid (stoffu)
77125096 wallet-rpc: rename *_INDEX_OUTOFBOUND into *_INDEX_OUT_OF_BOUNDS (stoffu)
2018-02-16 14:21:59 +01:00
Riccardo Spagni
079eea7b70 Merge pull request #3205
bc61ae69 tx_pool: add a max pool size, settable with --max-txpool-size (moneromooo-monero)
3b4e6b35 txpool: increase unmined tx expiry to three days (moneromooo-monero)
2018-02-16 14:21:50 +01:00
Riccardo Spagni
ac27f35c2a Merge pull request #3200
49c803ad Dockerfile: build dependencies with -fPIC (MoroccanMalinois)
2018-02-16 14:21:35 +01:00
Riccardo Spagni
b23578e473 Merge pull request #3197
f90c76be Return appropriate error code when there's no connection to daemon (Michał Sałaban)
3cb65b3f Return appropriate error code when not enough money for tx (Michał Sałaban)
2018-02-16 14:21:00 +01:00
Riccardo Spagni
172b7824d1 Merge pull request #3195
9017084a cmake: add -DHAVE_ defines to the command line (moneromooo-monero)
2018-02-16 14:20:46 +01:00
Riccardo Spagni
666a76652b Merge pull request #3187
851bd057 call _exit instead of abort in release mode (moneromooo-monero)
2018-02-16 14:20:31 +01:00
Riccardo Spagni
9cfe8876c5 Merge pull request #3184
32d5e731 Update translation source from create to generate (Maxithi)
2018-02-16 14:20:05 +01:00
Riccardo Spagni
bdf0339dda Merge pull request #3181
e3f0980a daemon: don't drop RPC with busy error when running offline (moneromooo-monero)
2018-02-16 14:19:54 +01:00
Riccardo Spagni
ba22928d4b Merge pull request #3180
1dfed567 Fixed #if instead of #ifdef (Matt Little)
7c442453 Support building cncrypto lib with msvc (Matt Little)
2018-02-16 14:19:42 +01:00
Riccardo Spagni
82599ef0e3 Merge pull request #3175
3be98036 wallet-cli: Do not ask for scan_from_height if it explicitly is set to zero. (Maximilian Lupke)
2018-02-16 14:19:24 +01:00
Riccardo Spagni
a43be404c7 Merge pull request #3171
402c9eef cryptonote_tx_utils: fixed logic bug in get_destination_view_key_pub (stoffu)
2018-02-16 14:19:10 +01:00
Riccardo Spagni
04a676397f Merge pull request #3165
7539603f Bootstrap daemon (stoffu)
2018-02-16 14:18:50 +01:00
Riccardo Spagni
381faf06c7 Merge pull request #3163
628b78ae Fix in_peers/out_peers RPC operations (Erik de Castro Lopo)
ece9bcf5 rpc_client: Fix error handling (Erik de Castro Lopo)
8f30350d Fix method name in invoke_http_json_rpc (Erik de Castro Lopo)
32c0f908 Allow the number of incoming connections to be limited (Erik de Castro Lopo)
d609a2c1 Rename delete_connections to delete_out_connections (Erik de Castro Lopo)
b927c0fc Rename connections_count to max_out_connection_count (Erik de Castro Lopo)
2018-02-16 14:18:38 +01:00
Riccardo Spagni
0bffd2ec64 Merge pull request #3161
78a2e15b daemon: exit with 0 when successful (moneromooo-monero)
2018-02-16 14:18:29 +01:00
Riccardo Spagni
1f277f7c1e Merge pull request #3160
a3c5a73c Update readme with correct tag version (Calvin Liang)
2018-02-16 14:18:06 +01:00
Riccardo Spagni
5d36ed6613 Merge pull request #3094
a85dbb3f Fixed typos and wording tweaks (Maxithi)
2018-02-16 14:17:46 +01:00
stoffu
da25757b42 simplewallet: do nothing in on_skip_transaction (wallet2 already logs warnings) 2018-02-15 17:20:39 +09:00
Jean Pierre Dudey
73ca47243f Use genesis_tx parameter in generate_genesis_block.
* src/cryptnote_config.h: The constant `config::testnet::GENESIS_TX` was
changed to be the same as `config::GENESIS_TX` (the mainnet's transaction)
because the mainnet's transaction was being used for both networks.

* src/cryptonote_core/cryptonote_tx_utils.cpp: The `generate_genesis_block` function
was ignoring the  `genesis_tx` parameter, and instead it was using the `config::GENESIS_TX`
constant. That's why the testnet genesis transaction was changed. Also five lines of unused
code were removed.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-02-14 16:31:17 -04:00
iDunk5400
bb19386bbc README.md: bump minimum cmake version to 3.2.0 2018-02-14 21:24:39 +01:00
Serhack
d4e728c995 simplewallet: reword donate command message for clarity 2018-02-14 08:28:22 -05:00
Riccardo Spagni
370b43d12b Merge pull request #3138
19ff243f wallets: reorg 61 more days on testnet (moneromooo-monero)
c70f03ca blockchain: move bulletproofs to v8 (moneromooo-monero)
2018-02-14 12:49:57 +01:00
Riccardo Spagni
589a53f479 Merge pull request #2959
3f1a3fac bulletproofs: more robust challenge computation (moneromooo-monero)
2018-02-14 12:08:52 +01:00
Riccardo Spagni
a9421f7802 Merge pull request #2939
b8090589 ringct: pseudoOuts moved to prunable in the simple bulletproof case (moneromooo-monero)
2018-02-14 12:08:14 +01:00
Jean Pierre Dudey
b2d4bb9b64 Remove voting_version parameter documentation.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-02-13 15:04:12 -04:00
moneromooo-monero
df5273def5 wallet2: fix auto_low_priority field name typo on load 2018-02-13 00:33:55 +00:00
Timothy D. Prime
3962bcb2a2 Closes #2886: really ignore battery checking
Move option test first.
2018-02-12 10:29:22 -08:00
erciccione
37ee966c40 add reference to localization workgroup in README.i18n.md 2018-02-12 17:32:51 +01:00
stoffu
54c256bc26 unit_tests.serialization: refactored with ASSERT_EQ_MAP 2018-02-12 21:56:51 +09:00
stoffu
e6a6093871 unit_tests: added gtest utility ASSERT_EQ_MAP for easily testing key-value map 2018-02-12 21:56:36 +09:00
stoffu
3c33e1317b wallet2: don't store invalid key image when watch-only 2018-02-12 20:36:15 +09:00
Howard Chu
f689a77e56 Fix #602 Turn on socket keepalive 2018-02-11 23:32:37 +00:00
Jethro Grassie
a4b50a6f51 handle ^D and ^C while password prompting 2018-02-10 18:29:49 -05:00
moneromooo-monero
d6a0ae96c6 blockchain: don't try to use hash check array after it's freed
It's freed when we've synced past its end, but we might still
find an old chain somewhere
2018-02-10 11:26:06 +00:00
stoffu
0133b3481a wallet2: don't throw when spent amount is inconsistent 2018-02-10 12:59:25 +09:00
moneromooo-monero
71806327f5 dns: change default DNS to a worldwide selection
DNSSEC aware servers picked from https://wiki.ipfire.org/dns/public-servers
2018-02-08 09:46:16 +00:00
stoffu
2bc8c3db5c epee get_ns_count: cast to uint64_t before multiplying 10^9 to avoid overflow 2018-02-08 16:04:50 +09:00
stoffu
214d251c48 wallet: suggest the use of sweep_unmixable when not_enough_outs_to_mix is thrown 2018-02-08 08:02:12 +09:00
h908714124
5c99608d95 Fix coverity issues in performance_tests/main.cpp 2018-02-07 19:11:29 +01:00
moneromooo-monero
bc61ae69bf tx_pool: add a max pool size, settable with --max-txpool-size 2018-02-07 13:42:12 +00:00
moneromooo-monero
e4646379a6 keccak: fix mdlen bounds sanity checking
found by h908714124
2018-02-07 13:39:32 +00:00
Michał Sałaban
6866ed469a Add default value to max_height, otherwise it's 0 2018-02-05 23:39:37 +01:00
moneromooo-monero
b81e276cab connection_context: initialize m_last_request_time to current time
This prevents spurious early peer drops
2018-02-04 13:13:08 +00:00
moneromooo-monero
928c1825f0 cryptonote_protocol: guard against all threads in standby 2018-02-02 22:33:53 +00:00
moneromooo-monero
2e3e90acbe pass large parameters by const ref, not value
Coverity 136394 136397 136409 136526 136529 136533 175302
2018-02-02 19:36:09 +00:00
moneromooo-monero
61defd89e3 blockchain: sanity check number of precomputed hash of hash blocks
Coverity 142951
2018-02-02 17:10:13 +00:00
moneromooo-monero
9af6b2d1b8 ringct: fix infinite loop in unused h2b function
Coverity 146775
2018-02-02 16:44:28 +00:00
moneromooo-monero
8cea8d0cef simplewallet: double check a new multisig wallet is multisig
Coverity 182493
2018-02-02 16:41:16 +00:00
moneromooo-monero
9b98a6ac8f threadpool: catch exceptions in dtor, to avoid terminate
If an exception is thrown, it is ignored. While this may hide
a bug, this should only be system exceptions in boost, which
is pretty unlikely. Morever, wait should be called manually
before the dtor anyway. Add an error message if the dtor has
to wait in case some such cases creep in so they get fixed.

Coverity 182538
2018-02-02 16:27:39 +00:00
moneromooo-monero
24803ed91f blockchain_export: fix buffer overflow in exporter
Coverity 182550
2018-02-02 16:11:15 +00:00
moneromooo-monero
f3f7da624d perf_timer: rewrite to make it clear there is no division by zero
It could have happened if epee::misc_utils::get_ns_count
is buggy, at a push

Coverity 182561
2018-02-02 16:06:36 +00:00
moneromooo-monero
c6ea3df0ae performance_tests: remove add_arg call stray extra param
Coverity 182572
2018-02-02 15:59:54 +00:00
moneromooo-monero
fa6b45665d fuzz_tests: fix an uninitialized var in setup
and comment it out, it's only used to generate a starting test case

Coverity 182506
2018-02-02 15:56:44 +00:00
moneromooo-monero
03887f1140 keccak: fix sanity check bounds test
Nothing calls this with those inputs
2018-02-02 15:48:06 +00:00
moneromooo-monero
ad11db9144 blockchain_db: initialize m_open in base class ctor
It's cleaner this way, since it's a base class field

Coverity 136568
2018-02-02 15:21:39 +00:00
moneromooo-monero
bece67f9e8 miner: restore std::cout precision after modification
Coverity 136462
2018-02-02 15:15:21 +00:00
moneromooo-monero
1aabd14c21 db_lmdb: check hard fork info drop succeeded
Coverity 136364
2018-02-02 15:08:22 +00:00
MoroccanMalinois
49c803ad7d Dockerfile: build dependencies with -fPIC 2018-02-02 13:45:28 +00:00
moneromooo-monero
3b4e6b35b3 txpool: increase unmined tx expiry to three days 2018-02-01 22:48:52 +00:00
moneromooo-monero
2e584dcb1f p2p: do not try to connect to peers in offline mode 2018-02-01 20:18:30 +00:00
moneromooo-monero
851bd057ec call _exit instead of abort in release mode
Avoids cores being created, as they're nowadays often piped
to some call home system
2018-02-01 13:32:46 +00:00
Leon Klingele
399921347f txpool: Properly bail out when outputs_amount == inputs_amount
Previously, when outputs_amount == inputs_amount, the "m_overspend" property
was set, whereas "m_fee_too_low" would have been the correct property to set.

This is unlikely to ever occur and just something I've noticed while reading
through the code.
2018-02-01 00:48:45 +01:00
Howard Chu
84a8b2da14 Don't create readtxn until after txn_safe gate check 2018-01-31 18:18:01 +00:00
moneromooo-monero
3f1a3fac00 bulletproofs: more robust challenge computation
Changes from sarang, from a recommendation by an anonymous reviewer
2018-01-31 15:57:01 +00:00
moneromooo-monero
b809058993 ringct: pseudoOuts moved to prunable in the simple bulletproof case
Saves 64 bytes non prunable data per typical tx

This breaks v7 consensus, will require a testnet reorg from v6
2018-01-31 15:56:26 +00:00
moneromooo-monero
19ff243f52 wallets: reorg 61 more days on testnet 2018-01-31 15:52:43 +00:00
moneromooo-monero
c70f03cacf blockchain: move bulletproofs to v8
and set v7 height to 1057027 on testnet (one block earlier)
This is to easily dump current nodes since we're going to change
the v7 rules with this.
2018-01-31 15:52:39 +00:00
moneromooo-monero
fde4489e1d wipeable_string: call memwipe directly
since the original reason for the indirect call (that memwipe
was not in contrib) is now gone
2018-01-31 12:25:30 +00:00
stoffu
a99ef17695 wallet-rpc: take subaddress account as arg for get_transfer_by_txid 2018-01-31 17:53:02 +09:00
stoffu
7712509644 wallet-rpc: rename *_INDEX_OUTOFBOUND into *_INDEX_OUT_OF_BOUNDS 2018-01-31 17:52:31 +09:00
stoffu
7539603f94 Bootstrap daemon 2018-01-30 20:15:47 +09:00
Maxithi
a85dbb3f2f Fixed typos and wording tweaks 2018-01-29 12:13:23 +01:00
stoffu
402c9eef0e cryptonote_tx_utils: fixed logic bug in get_destination_view_key_pub 2018-01-29 17:05:07 +09:00
Michał Sałaban
f90c76beb4 Return appropriate error code when there's no connection to daemon 2018-01-29 08:28:25 +01:00
Erik de Castro Lopo
628b78ae8a Fix in_peers/out_peers RPC operations
Original implementations could never have worked.
2018-01-29 11:54:57 +11:00
Erik de Castro Lopo
ece9bcf5c6 rpc_client: Fix error handling
Previous code was unable to distingush between a connection error
and a communication error.
2018-01-29 11:54:57 +11:00
Erik de Castro Lopo
8f30350d03 Fix method name in invoke_http_json_rpc
Previously, the method name was printed as an exmpty string because
the input string had already been moved with `std::move`.
2018-01-29 11:14:02 +11:00
Erik de Castro Lopo
32c0f908cd Allow the number of incoming connections to be limited
It was already possible to limit outgoing connections. One might want
to do this on home network connections with high bandwidth but low
usage caps.
2018-01-29 11:14:02 +11:00
Erik de Castro Lopo
d609a2c164 Rename delete_connections to delete_out_connections
This rename is needed so that delete_in_connections can be added.
2018-01-29 07:06:08 +11:00
Erik de Castro Lopo
b927c0fc7a Rename connections_count to max_out_connection_count
This is needed so that a max_in_connection_count can be added.
2018-01-29 07:06:08 +11:00
Riccardo Spagni
ed67e5c001 Merge pull request #3198
1c99a628 Tests: Fix building of two fuzz tests on Windows (iDunk5400)
2018-01-28 09:59:59 -08:00
Riccardo Spagni
4fcf609942 Merge pull request #3186
7ed62e63 cryptonote_protocol: fix std::move usage on different types (moneromooo-monero)
2018-01-28 09:54:17 -08:00
moneromooo-monero
30ce8c5926 cn_deserialize: check for raw tx_extra 2018-01-28 15:23:05 +00:00
iDunk5400
1c99a628e3 Tests: Fix building of two fuzz tests on Windows 2018-01-28 14:51:02 +01:00
Michał Sałaban
3cb65b3f69 Return appropriate error code when not enough money for tx 2018-01-28 12:52:05 +01:00
moneromooo-monero
eda9fb5b98 p2p: fix testnet/mainnet port mixup 2018-01-28 09:44:04 +00:00
moneromooo-monero
9017084a7b cmake: add -DHAVE_ defines to the command line
since there's no config.h here
2018-01-28 08:57:51 +00:00
Riccardo Spagni
6ed314854c Merge pull request #3188
fbc0a6dd Bugfix : Missing i18n import in simplewallet (Neozaru)
2018-01-27 18:21:55 -08:00
Riccardo Spagni
00a1166c95 Merge pull request #3185
fccd1df1 performance_tests: fix build after merging two conflicting patches (moneromooo-monero)
2018-01-27 18:21:40 -08:00
Riccardo Spagni
29fafa4ca7 Merge pull request #3123
30c44bce wallet: automatically use low priority if safe (no backlog & recent blocks not full) (stoffu)
c903df5e simplewallet: bug fix for backlog estimate (stoffu)
2f5a9b6b wallet2: split estimate_backlog to allow for raw fee levels (moneromooo-monero)
2018-01-27 18:08:56 -08:00
stoffu
30c44bce06 wallet: automatically use low priority if safe (no backlog & recent blocks not full) 2018-01-28 11:04:52 +09:00
stoffu
c903df5ece simplewallet: bug fix for backlog estimate 2018-01-28 10:52:25 +09:00
moneromooo-monero
2f5a9b6bb3 wallet2: split estimate_backlog to allow for raw fee levels 2018-01-28 10:52:16 +09:00
Riccardo Spagni
d061c312fb Merge pull request #3116
269ba252 wallet2::import_blockchain fix import loop (Jaquee)
2018-01-27 17:27:07 -08:00
Riccardo Spagni
76a6a794f9 Merge pull request #2969
95171614 Remove is_pod trait, and replace with is_standard_layout requirement (Lee Clagett)
2018-01-27 17:26:58 -08:00
Riccardo Spagni
86da46e224 Merge pull request #3151
ab2e9953 unit_tests: do not ASSERT_TRUE(decodeRct(...)) (moneromooo-monero)
2018-01-27 17:25:55 -08:00
Riccardo Spagni
a4ae78a335 Merge pull request #3145
fd1dfac5 p2p: don't lookup seed IPs if using an exclusive peer (moneromooo-monero)
b50182ae p2p: don't connect to seeds if using an exclusive peer (moneromooo-monero)
2018-01-27 17:25:47 -08:00
Riccardo Spagni
f7dcb730cb Merge pull request #3144
42f86624 rpc: expose recent median block size in getinfo (moneromooo-monero)
2018-01-27 17:25:40 -08:00
Riccardo Spagni
e93ff8f22d Merge pull request #3143
ba6d2975 cryptonote_core: add --disable-dns-checkpoints flag (moneromooo-monero)
2018-01-27 17:25:33 -08:00
Riccardo Spagni
1506f33075 Merge pull request #3142
a9cae0ab Wallet API: remove unused enum Priority from UnsignedTransaction (stoffu)
2018-01-27 17:25:25 -08:00
Riccardo Spagni
5603d5aaea Merge pull request #3141
3160a930 wallet2: remove {set|get}_default_decimal_point and use the same funcs under cryptonote:: instead (stoffu)
7d1088d3 wallet2: make scan_output const and omit keys arg (stoffu)
bc1ee2c2 wallet2: make member functions const when possible (stoffu)
2018-01-27 17:25:15 -08:00
Riccardo Spagni
6d48bddffd Merge pull request #3136
e0404d35 rpc: default do_not_relay to false in sendrawtransaction (moneromooo-monero)
2018-01-27 17:25:07 -08:00
Riccardo Spagni
d3e1244466 Merge pull request #3121
6fbb0b06 cmake: set API header install path to what Qt wallet expects (redfish)
2018-01-27 17:24:57 -08:00
Riccardo Spagni
4c302c6385 Merge pull request #3120
6cf56682 perf_timer: add faster x86_64 timers, and pause/resume (moneromooo-monero)
411da337 perf_timer: use std::unique_ptr instead of new/delete (moneromooo-monero)
2018-01-27 17:24:49 -08:00
Riccardo Spagni
7de1685bd8 Merge pull request #3119
c4f43779 crypto: add a ge_p3_identity constant (moneromooo-monero)
13b4c90e crypto: add scalar mult functions returning ge_p3 instead of ge_p2 (moneromooo-monero)
2018-01-27 17:24:42 -08:00
Riccardo Spagni
e1ba5b95c1 Merge pull request #3118
ca336c62 simplewallet: check file overwrite when exporting stuff (stoffu)
2018-01-27 17:24:34 -08:00
Riccardo Spagni
92ea8af34d Merge pull request #3114
fb5c971c Allow retrieving spend key via RPC (Michał Sałaban)
2018-01-27 17:24:26 -08:00
Riccardo Spagni
73a19e0b06 Merge pull request #3113
ffc2e570 wallet rpc: show fees when querying incoming transfers (stoffu)
2018-01-27 17:24:15 -08:00
Riccardo Spagni
087a773247 Merge pull request #3104
939629e8 Wallet API: all recover options with password (m2049r)
2018-01-27 17:24:08 -08:00
Riccardo Spagni
0d328cffda Merge pull request #3102
3050a4f0 simplewallet: fix typo get_tx_proof_out to get_tx_proof (stoffu)
2018-01-27 17:24:00 -08:00
Riccardo Spagni
baaeefdecc Merge pull request #3098
935e39c7 levin_protocol_handler_async: erase from back of vector instead of front (stoffu)
2018-01-27 17:23:53 -08:00
Riccardo Spagni
36241552b5 Merge pull request #3075
84a7f6a4 Readd copyright starting date (xmr-eric)
18216f19 Update 2018 copyright (xmr-eric)
2018-01-27 17:23:26 -08:00
Matt Little
1dfed567e2 Fixed #if instead of #ifdef 2018-01-27 13:33:11 -07:00
xmr-eric
84a7f6a482 Readd copyright starting date 2018-01-26 10:03:20 -05:00
xmr-eric
18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
Neozaru
fbc0a6dd23 Bugfix : Missing i18n import in simplewallet 2018-01-26 13:58:49 +01:00
moneromooo-monero
7ed62e63e5 cryptonote_protocol: fix std::move usage on different types 2018-01-26 10:13:06 +00:00
moneromooo-monero
fccd1df125 performance_tests: fix build after merging two conflicting patches 2018-01-26 10:09:59 +00:00
Maxithi
32d5e731d0 Update translation source from create to generate 2018-01-26 09:58:36 +01:00
stoffu
a9cae0abe7 Wallet API: remove unused enum Priority from UnsignedTransaction 2018-01-26 10:59:49 +09:00
stoffu
3160a93027 wallet2: remove {set|get}_default_decimal_point and use the same funcs under cryptonote:: instead 2018-01-26 10:59:32 +09:00
stoffu
7d1088d337 wallet2: make scan_output const and omit keys arg 2018-01-26 10:59:31 +09:00
stoffu
bc1ee2c2ee wallet2: make member functions const when possible 2018-01-26 10:59:30 +09:00
stoffu
3050a4f05b simplewallet: fix typo get_tx_proof_out to get_tx_proof 2018-01-26 10:59:15 +09:00
stoffu
ffc2e5705d wallet rpc: show fees when querying incoming transfers 2018-01-26 10:58:23 +09:00
stoffu
935e39c7f3 levin_protocol_handler_async: erase from back of vector instead of front 2018-01-26 10:58:07 +09:00
stoffu
ca336c62e3 simplewallet: check file overwrite when exporting stuff 2018-01-26 10:57:13 +09:00
Riccardo Spagni
09d19c9139 Merge pull request #3130
5ae617d5 simplewallet: single out 0 amount destinations as dummy ones (moneromooo-monero)
c1d19f3c wallet2: fix sweep_all sending an atomic unit (moneromooo-monero)
2018-01-25 16:57:03 -08:00
Riccardo Spagni
700b3193f8 Merge pull request #3084
5f5a51a6 util: warn if unbound was not built with threads (moneromooo-monero)
2018-01-25 16:56:28 -08:00
Riccardo Spagni
ea75e71dd2 Merge pull request #3052
d507167f Removed unused mac-specific output folder path (Maxithi)
2018-01-25 16:54:45 -08:00
Riccardo Spagni
fdb0a92f1b Merge pull request #3155
21bd2157 remove unnecessary include (Jethro Grassie)
2018-01-25 16:52:12 -08:00
Riccardo Spagni
5a15a8322e Merge pull request #3153
ab58b150 p2p: fix picking peers off an empty gray list (moneromooo-monero)
2018-01-25 16:51:50 -08:00
Riccardo Spagni
ef4b69f8bb Merge pull request #3126
ff5626d7 ringct: handle exceptions verifying bulletproofs in worker threads (moneromooo-monero)
2018-01-25 16:50:47 -08:00
Riccardo Spagni
d25217f058 Merge pull request #3105
b56f4645 cryptonote_protocol: fix size_t used in wire format (moneromooo-monero)
2018-01-25 16:50:18 -08:00
Riccardo Spagni
f31f5c9a3e Merge pull request #3093
d188840c Improved terminology from create to generate (Maxithi)
2018-01-25 16:49:54 -08:00
Riccardo Spagni
0a94399a05 Merge pull request #3082
8b50209c fix for warning (Onur Altun)
2018-01-25 16:49:20 -08:00
Riccardo Spagni
e3d47d40b1 Merge pull request #3078
c6775868 Ignore cmake-build-debug folder (Maxithi)
2018-01-25 16:48:57 -08:00
Riccardo Spagni
39bd6c6815 Merge pull request #3072
0811b924 fix some confirmation dialog, add missing symbols (AJIekceu4)
2018-01-25 16:48:00 -08:00
Riccardo Spagni
c222b6485e Merge pull request #3068
301ec15c Change cryptonote::COMMAND_RPC_SET_LIMIT::response to use int64_t (Nick Johnson)
2018-01-25 16:47:29 -08:00
Riccardo Spagni
66a2751d68 Merge pull request #3065
3e635a3c wallet2: allow failing parse_tx_extra (moneromooo-monero)
2018-01-25 16:47:08 -08:00
Riccardo Spagni
395ab6c430 Merge pull request #3064
62c45c0d performance_tests: add a --filter option to select what to run (moneromooo-monero)
2018-01-25 16:46:41 -08:00
Riccardo Spagni
ede4e1c54c Merge pull request #3057
9ffa97fe Factor the monero donation address (Maxithi)
2018-01-25 16:46:18 -08:00
Riccardo Spagni
008b492963 Merge pull request #3047
fa5c0bab Implement #3045, fixing RPC snakecases (Nick Johnson)
2018-01-25 16:45:45 -08:00
Riccardo Spagni
f5c6f8f22f Merge pull request #3042
ed215d34 performance_tests: add RingCT MLSAG gen/ver tests (moneromooo-monero)
2018-01-25 16:45:16 -08:00
Riccardo Spagni
5a312752af Merge pull request #3040
69f9a075 cryptonote_protocol: fix missing space in version mismatch message (moneromooo-monero)
2018-01-25 16:44:51 -08:00
Riccardo Spagni
153e319cd4 Merge pull request #3038
eb39a3d7 wallet_api: make this optional but not built by default (moneromooo-monero)
2018-01-25 16:44:23 -08:00
Riccardo Spagni
492fcbbcc0 Merge pull request #3036
ab10f4ce added Swedish translation (ordtrogen)
2018-01-25 16:44:01 -08:00
Riccardo Spagni
b2ce5739df Merge pull request #3028
a4b006f9 wallet2 bugfix: initialize subaddress table when generating from keys (stoffu)
2018-01-25 16:42:06 -08:00
Riccardo Spagni
960b32ba70 Merge pull request #3027
6d40a920 Reserve proof (stoffu)
2018-01-25 16:40:59 -08:00
Riccardo Spagni
5e211b4186 Merge pull request #3020
03ac3890 zmq: use older 3-arg version of setsockopt (stoffu)
2018-01-25 16:40:03 -08:00
Riccardo Spagni
75cbb7719e Merge pull request #3015
f06603a4 cryptonote_protocol: update target height when receiving blocks (moneromooo-monero)
2018-01-25 16:39:16 -08:00
Riccardo Spagni
9872620781 Merge pull request #3014
deeffaeb blockchain: remove minor floating point usage (moneromooo-monero)
2018-01-25 16:38:32 -08:00
Riccardo Spagni
c16261c8da Merge pull request #3013
fe436eca apply_permutation.h: add #pragma once (moneromooo-monero)
2018-01-25 16:37:28 -08:00
Riccardo Spagni
9fff66f004 Merge pull request #3012
e4bbeff2 epee: check some error return values (moneromooo-monero)
2018-01-25 16:36:27 -08:00
Riccardo Spagni
92826e3d8b Merge pull request #3011
619bb723 daemon+simplewallet: given an unknown command, show it (stoffu)
2018-01-25 16:34:45 -08:00
Riccardo Spagni
f077bbb4f1 Merge pull request #3010
07da9c80 Resolve addresses in get_transfers (Michał Sałaban)
2018-01-25 16:32:40 -08:00
Riccardo Spagni
d9e3e32838 Merge pull request #3009
78835645 Added Fedora devel dependencies (Jonny Heggheim)
2018-01-25 16:27:47 -08:00
Riccardo Spagni
ca199aa08a Merge pull request #3008
50786ac7 simplewallet: Correct 3 multisig command usage help texts, e.g. for 'export_multisig_info' (rbrunner7)
2018-01-25 16:25:01 -08:00
Matt Little
7c4424531f Support building cncrypto lib with msvc 2018-01-25 13:00:45 -07:00
moneromooo-monero
e3f0980a1d daemon: don't drop RPC with busy error when running offline 2018-01-25 13:35:58 +00:00
Maximilian Lupke
3be98036e7 wallet-cli: Do not ask for scan_from_height if it explicitly is set to zero.
Fixes #3080
2018-01-24 18:01:08 +01:00
moneromooo-monero
78a2e15bea daemon: exit with 0 when successful 2018-01-20 13:34:32 +00:00
Calvin Liang
a3c5a73cd0 Update readme with correct tag version 2018-01-19 19:34:14 -08:00
Jethro Grassie
21bd21576d remove unnecessary include 2018-01-18 19:03:05 -05:00
Riccardo Spagni
5f09d6c833 Merge pull request #3115
e8d773a0 unbound: always build with -fPIC (moneromooo-monero)
2018-01-18 18:14:34 -05:00
Riccardo Spagni
d2ff91cb17 Merge pull request #3107
b7e5a70b epee: detect strptime, use std::get_time as fallback (moneromooo-monero)
2018-01-18 18:14:12 -05:00
Riccardo Spagni
ca5383efa9 Merge pull request #3103
f65711a2 miniupnpc: always build with -fPIC (moneromooo-monero)
2018-01-18 18:14:03 -05:00
Riccardo Spagni
dd4f89cf3c Merge pull request #3099
be1826c0 Keep readline optional (Jethro Grassie)
2018-01-18 18:13:51 -05:00
moneromooo-monero
ab58b150ef p2p: fix picking peers off an empty gray list 2018-01-18 17:11:37 +00:00
moneromooo-monero
ab2e9953b4 unit_tests: do not ASSERT_TRUE(decodeRct(...))
decodeRct returns the amount, which may be zero
2018-01-18 13:55:51 +00:00
Lee Clagett
951716146f Remove is_pod trait, and replace with is_standard_layout requirement 2018-01-18 02:26:19 -05:00
m2049r
939629e837 Wallet API: all recover options with password
also renamed memo => mnemonic in api method parms
2018-01-17 18:46:31 +01:00
moneromooo-monero
fd1dfac5d2 p2p: don't lookup seed IPs if using an exclusive peer 2018-01-17 12:15:12 +00:00
moneromooo-monero
b50182aee7 p2p: don't connect to seeds if using an exclusive peer 2018-01-17 11:17:21 +00:00
moneromooo-monero
42f86624a3 rpc: expose recent median block size in getinfo 2018-01-17 11:12:26 +00:00
moneromooo-monero
ba6d2975bc cryptonote_core: add --disable-dns-checkpoints flag 2018-01-17 10:14:48 +00:00
moneromooo-monero
5ae617d5ae simplewallet: single out 0 amount destinations as dummy ones
Avoids surprising the user with "sending 0 to..."
2018-01-16 15:41:25 +00:00
moneromooo-monero
e0404d35fe rpc: default do_not_relay to false in sendrawtransaction 2018-01-16 11:15:01 +00:00
moneromooo-monero
c1d19f3c84 wallet2: fix sweep_all sending an atomic unit 2018-01-15 15:54:19 +00:00
moneromooo-monero
ff5626d785 ringct: handle exceptions verifying bulletproofs in worker threads 2018-01-15 11:48:23 +00:00
redfish
6fbb0b065d cmake: set API header install path to what Qt wallet expects 2018-01-14 20:14:07 -05:00
moneromooo-monero
6cf56682bc perf_timer: add faster x86_64 timers, and pause/resume 2018-01-15 00:35:55 +00:00
moneromooo-monero
411da337d2 perf_timer: use std::unique_ptr instead of new/delete 2018-01-15 00:35:24 +00:00
moneromooo-monero
c4f437796d crypto: add a ge_p3_identity constant 2018-01-15 00:30:46 +00:00
moneromooo-monero
13b4c90e01 crypto: add scalar mult functions returning ge_p3 instead of ge_p2
ge_scalarmult_p3
ge_double_scalarmult_precomp_vartime2_p3
ge_double_scalarmult_base_vartime_p3

This makes it possible to reuse the result without having to
convert back to unsigned char[32] and back to ge types.
2018-01-15 00:30:26 +00:00
Jaquee
269ba25228 wallet2::import_blockchain fix import loop 2018-01-14 20:30:35 +01:00
moneromooo-monero
e8d773a049 unbound: always build with -fPIC 2018-01-14 18:51:51 +00:00
Michał Sałaban
fb5c971cc6 Allow retrieving spend key via RPC 2018-01-14 06:23:12 +01:00
moneromooo-monero
b7e5a70bb1 epee: detect strptime, use std::get_time as fallback 2018-01-11 21:41:07 +00:00
Jethro Grassie
be1826c0fb Keep readline optional 2018-01-11 13:51:13 -05:00
moneromooo-monero
b56f46457c cryptonote_protocol: fix size_t used in wire format
This is 32 bits on 32 bit platforms, but 64 bits on 64 bit platforms.
2018-01-11 17:31:47 +00:00
moneromooo-monero
f65711a29b miniupnpc: always build with -fPIC
since we now build PIE binaries
2018-01-11 15:51:32 +00:00
stoffu
6d40a92026 Reserve proof 2018-01-10 20:37:18 +09:00
moneromooo-monero
deeffaeb5c blockchain: remove minor floating point usage 2018-01-10 11:05:30 +00:00
Riccardo Spagni
35d5aa36c9 Merge pull request #3091
64f36300 Check if lrelease is working before trying to use it (Guillaume LE VAILLANT)
2018-01-10 11:56:11 +01:00
Riccardo Spagni
bfc0bd82dd Merge pull request #3063
dff97112 easylogging++: do not use crash log code on android, etc (moneromooo-monero)
2018-01-10 11:55:58 +01:00
Riccardo Spagni
d5dad4f0a2 Merge pull request #3062
f035478d Fix translations header generation when cross-compilating (Guillaume LE VAILLANT)
2018-01-10 11:55:46 +01:00
Riccardo Spagni
e61f655440 Merge pull request #3061
fc041b58 common cmake: make sure translation_files.h is generated for i18n.cpp (stoffu)
2018-01-10 11:55:35 +01:00
Riccardo Spagni
00f4ff26c8 Merge pull request #3021
dc6729a6 wallet2: std::unordered_set ctor is sometimes explicit (moneromooo-monero)
2018-01-10 11:55:19 +01:00
Riccardo Spagni
397a9f0656 Merge pull request #3007
0281f634 cmake: fix boost version detection (moneromooo-monero)
2018-01-10 11:55:00 +01:00
Riccardo Spagni
4e3716a2d2 Merge pull request #3005
369884a6 mnemonics: typo fix (4 bytes == 3 words, not 8 bytes) (stoffu)
2018-01-10 11:54:38 +01:00
Riccardo Spagni
0b5994fbec Merge pull request #3004
a2c845c7 cryptonote_protocol: internal error consistency size check (moneromooo-monero)
2018-01-10 11:54:23 +01:00
Riccardo Spagni
990389f09d Merge pull request #3002
9996d5e9 wallet2: guard against the dameon sending blocks before last checkpoint (moneromooo-monero)
eadaa6aa wallet_rpc_server: fix wallet leak on error exit (moneromooo-monero)
2018-01-10 11:54:11 +01:00
Riccardo Spagni
229e1ce7d1 Merge pull request #2997
7c4f01a7 blockchain_import: more informative verification switch (moneromooo-monero)
2018-01-10 11:53:57 +01:00
Riccardo Spagni
1c11ec71b5 Merge pull request #2995
6ccc51f6 wipeable_string: fix buffer overread (moneromooo-monero)
2018-01-10 11:53:42 +01:00
Riccardo Spagni
d08aee7a7e Merge pull request #2993
776b44f1 Add misc hardening flags to the cmake machinery (moneromooo-monero)
2018-01-10 11:53:26 +01:00
Riccardo Spagni
f9c66ba67c Merge pull request #2990
2d17feb0 factor STL container serialization (moneromooo-monero)
2018-01-10 11:53:05 +01:00
Riccardo Spagni
6c7eb5109d Merge pull request #2989
66eeeaa1 wallet2: fix failure to create tx if inputs are not enough for fee (moneromooo-monero)
2018-01-10 11:52:49 +01:00
Riccardo Spagni
529ca39e9d Merge pull request #2988
8a4610c3 blake256: fix wrong hash when computed in parts (moneromooo-monero)
2018-01-10 11:52:32 +01:00
Riccardo Spagni
2d60c9b738 Merge pull request #2986
373d1d50 epee: use strptime instead of std::get_time, for compatibility (moneromooo-monero)
2018-01-10 11:51:20 +01:00
Riccardo Spagni
ab8a32429a Merge pull request #2985
6d8b29ef fix some link errors in debug mode for macos (stoffu)
fdd4c5e5 move memwipe to epee to avoid common<->crypto circular dependencies (moneromooo-monero)
40ab12a7 epee: remove dependency on common (moneromooo-monero)
2018-01-10 11:50:58 +01:00
Riccardo Spagni
3ce7f2bead Merge pull request #2983
6fc4fc85 sweep_below: do not prematurely exclude subaddresses set (stoffu)
2018-01-10 11:50:36 +01:00
Riccardo Spagni
a71db6d239 Merge pull request #2981
b63afbaa simplewallet: detect typo for incoming_transfers options (stoffu)
2018-01-10 11:50:21 +01:00
Riccardo Spagni
9d73cd894c Merge pull request #2978
0e93b098 Add checks for termcap if needed by readline (Jethro Grassie)
2018-01-10 11:50:00 +01:00
Riccardo Spagni
bfe580787d Merge pull request #2976
c765f951 simplewallet: disable donations on testnet (Matt Smith)
2018-01-10 11:49:14 +01:00
Riccardo Spagni
420a803ff8 Merge pull request #2973
277a5aef wallet2: fix m_key_image_{partial,known} in_light_wallet code (moneromooo-monero)
2018-01-10 11:48:42 +01:00
Riccardo Spagni
c951bf1f72 Merge pull request #2972
586ee642 simplewallet: lock idle scope in {im,ex}port_{key_images,outputs} (moneromooo-monero)
2018-01-10 11:48:12 +01:00
Riccardo Spagni
0a110aefbb Merge pull request #2971
ae860230 Fix exceptions not finding txpool txes when relaying (moneromooo-monero)
2018-01-10 11:45:15 +01:00
stoffu
6d8b29ef28 fix some link errors in debug mode for macos 2018-01-10 01:57:56 +00:00
moneromooo-monero
fdd4c5e577 move memwipe to epee to avoid common<->crypto circular dependencies 2018-01-10 01:57:54 +00:00
moneromooo-monero
40ab12a773 epee: remove dependency on common 2018-01-10 01:57:51 +00:00
Maxithi
d188840cc2 Improved terminology from create to generate 2018-01-09 21:46:44 +01:00
Guillaume LE VAILLANT
64f36300fb Check if lrelease is working before trying to use it
On some systems, there is a /usr/bin/lrelease wrapper even if the real
lrelease program is not installed. So let's try to execute lrelease
after it has been found by find_program to see if it is really working.
2018-01-09 10:35:14 +01:00
moneromooo-monero
5f5a51a6c8 util: warn if unbound was not built with threads
This can causes crashes in libunbound
2018-01-08 10:58:50 +00:00
Onur Altun
8b50209ca0 fix for warning
monero/tests/unit_tests/memwipe.cpp:50:8: Warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
     if (wipe) ASSERT_TRUE(memcmp(quux, "bar", 3));
2018-01-08 06:58:48 +03:00
Maxithi
c677586842 Ignore cmake-build-debug folder 2018-01-07 18:05:55 +01:00
Nick Johnson
fa5c0bab44 Implement #3045, fixing RPC snakecases 2018-01-06 15:11:36 -06:00
AJIekceu4
0811b9242b fix some confirmation dialog, add missing symbols
Change some confirmation dialog to look like other ones (add symbol ":" and space)
So, it will look like: (Y/Yes/N/No): y
Now it look: (Y/Yes/N/No)y
2018-01-06 22:04:04 +07:00
Maxithi
9ffa97fe98 Factor the monero donation address
Signed-off-by: Maxithi <34792056+Maxithi@users.noreply.github.com>
2018-01-05 12:58:40 +01:00
Nick Johnson
301ec15c49 Change cryptonote::COMMAND_RPC_SET_LIMIT::response to use int64_t 2018-01-04 21:01:10 -06:00
Maxithi
d507167fa5 Removed unused mac-specific output folder path 2018-01-04 21:16:44 +01:00
moneromooo-monero
3e635a3cef wallet2: allow failing parse_tx_extra
It can fail if it fails to parse extra, while still having filled
the returned data with partial contents
2018-01-04 15:38:49 +00:00
moneromooo-monero
62c45c0df1 performance_tests: add a --filter option to select what to run
Removes a good bit of annoyance running those
2018-01-04 14:46:51 +00:00
moneromooo-monero
dff97112c8 easylogging++: do not use crash log code on android, etc 2018-01-04 12:50:43 +00:00
Guillaume LE VAILLANT
f035478d35 Fix translations header generation when cross-compilating
Define generate_translations_header as an external project to be able
to use the compilation toolchain for the host instead of the toolchain
for the target.
2018-01-04 11:36:29 +01:00
stoffu
fc041b58d6 common cmake: make sure translation_files.h is generated for i18n.cpp 2018-01-04 12:24:06 +09:00
Jethro Grassie
0e93b0986c Add checks for termcap if needed by readline 2018-01-02 13:26:22 -05:00
Riccardo Spagni
a529f0a6c9 Merge pull request #3019
294adc83 Additional fix for core_tests (Howard Chu)
d52b732e Fix stale readcursor flags (Howard Chu)
2018-01-02 00:32:12 +02:00
Riccardo Spagni
aa4195e199 Merge pull request #2977
c70e8daa threadpool: fix deadlock in recursive waiter usage (moneromooo-monero)
2018-01-02 00:31:56 +02:00
Riccardo Spagni
803f54b9fd Merge pull request #2967
55556fab wallet_rpc_server: factor transfer info return and add missing info (moneromooo-monero)
2018-01-02 00:31:30 +02:00
Riccardo Spagni
d7df56341e Merge pull request #2965
5388c81b Added using TOOLCHAIN_DIR varable on symlinking in android dockerfiles (damir)
2018-01-02 00:31:15 +02:00
Riccardo Spagni
989c9309ec Merge pull request #2964
3ed1a74c tests: remove unused/unfinished keccak bits (moneromooo-monero)
2018-01-02 00:30:54 +02:00
Riccardo Spagni
753215b9c6 Merge pull request #2963
0e19a394 tests: test wallets don't need a dummy temp file anymore (moneromooo-monero)
2018-01-02 00:30:33 +02:00
Riccardo Spagni
ee02c7ab03 Merge pull request #2962
14c29814 wallet2: fix use of uninitialized data (moneromooo-monero)
2018-01-02 00:30:01 +02:00
Riccardo Spagni
eb617be8f4 Merge pull request #2960
5cbcf0aa wallet: support for multisig seeds (moneromooo-monero)
2018-01-02 00:29:36 +02:00
Riccardo Spagni
759d8e8f80 Merge pull request #2956
dc642631 performance_tests: add a test for subaddress expansion (moneromooo-monero)
2018-01-02 00:29:15 +02:00
Riccardo Spagni
dd11bfb89c Merge pull request #2934
db2bc965 Embed the translation files in the binary (Guillaume LE VAILLANT)
2018-01-02 00:28:45 +02:00
moneromooo-monero
ed215d34e9 performance_tests: add RingCT MLSAG gen/ver tests 2017-12-31 18:58:45 +00:00
moneromooo-monero
69f9a07553 cryptonote_protocol: fix missing space in version mismatch message 2017-12-31 17:32:57 +00:00
moneromooo-monero
776b44f17b Add misc hardening flags to the cmake machinery
See https://wiki.debian.org/Hardening#User_Space
2017-12-31 14:26:12 +00:00
moneromooo-monero
eb39a3d7d3 wallet_api: make this optional but not built by default
It means it can still be built with make -C build/debug wallet_api
but still not DoS us while debugging
2017-12-31 11:14:20 +00:00
ordtrogen
ab10f4cea5 added Swedish translation 2017-12-30 21:52:41 +01:00
stoffu
a4b006f965 wallet2 bugfix: initialize subaddress table when generating from keys 2017-12-29 15:53:28 +09:00
Howard Chu
294adc8341 Additional fix for core_tests
Reset thread-local info if it doesn't match the current env.
Only happens when a process opens/closes env multiple times in the
same process, doesn't affect monerod.
2017-12-28 20:24:08 +00:00
moneromooo-monero
dc6729a66a wallet2: std::unordered_set ctor is sometimes explicit 2017-12-28 10:20:12 +00:00
Riccardo Spagni
a0a8706946 Merge pull request #2955
0bcaf86c tests: fix link error in hash tests now needing common (moneromooo-monero)
2017-12-28 09:00:21 +02:00
Riccardo Spagni
a1a8262355 Merge pull request #2949
e20e489a Better definite article use (xmr-eric)
2017-12-28 09:00:00 +02:00
Riccardo Spagni
4f4174f330 Merge pull request #2947
e12ee76a README.md: Improve copy for supporting the project (xmr-eric)
2017-12-28 08:59:46 +02:00
Riccardo Spagni
3bbe2481ce Merge pull request #2946
1a686bf8 daemon: print num txes in print_bc (moneromooo-monero)
2017-12-28 08:59:31 +02:00
Riccardo Spagni
95a687d584 Merge pull request #2945
9e07ccf1 daemon: remove some superfluous includes (moneromooo-monero)
2017-12-28 08:59:16 +02:00
Riccardo Spagni
838b2e8a52 Merge pull request #2944
223e3788 unit_tests: fix memwipe test comparison (moneromooo-monero)
2017-12-28 08:59:01 +02:00
Riccardo Spagni
0ae3651cc9 Merge pull request #2942
4f45f9da simplewallet: factor out tx exceptions (moneromooo-monero)
2017-12-28 08:58:46 +02:00
Riccardo Spagni
5f562cf9e6 Merge pull request #2941
d0d38dc8 wallet2: print tx size in bytes and kB (moneromooo-monero)
2017-12-28 08:58:30 +02:00
Riccardo Spagni
8980aacbe8 Merge pull request #2940
da0fd71d only include the easylogging++ stack trace code when needed (moneromooo-monero)
81b04cfa easlogging++: omit some unneded macros (moneromooo-monero)
2017-12-28 08:57:59 +02:00
stoffu
03ac389022 zmq: use older 3-arg version of setsockopt 2017-12-28 13:15:49 +09:00
Howard Chu
d52b732efb Fix stale readcursor flags
Reset thread-specific flags when a write txn is started.
Also remove some redundant start-readtxn code.
2017-12-28 00:59:04 +00:00
stoffu
b63afbaa99 simplewallet: detect typo for incoming_transfers options 2017-12-28 07:53:31 +09:00
stoffu
6fc4fc850e sweep_below: do not prematurely exclude subaddresses set 2017-12-28 07:52:53 +09:00
moneromooo-monero
f06603a439 cryptonote_protocol: update target height when receiving blocks 2017-12-27 13:54:19 +00:00
moneromooo-monero
fe436eca46 apply_permutation.h: add #pragma once 2017-12-27 12:15:51 +00:00
Riccardo Spagni
395e209745 Merge pull request #2952
e3530789 wallet-api: added Utils::onStartup (stoffu)
2017-12-27 10:00:01 +02:00
stoffu
619bb7233b daemon+simplewallet: given an unknown command, show it 2017-12-27 15:23:34 +09:00
Michał Sałaban
07da9c806d Resolve addresses in get_transfers 2017-12-27 01:35:48 +01:00
moneromooo-monero
e4bbeff2f5 epee: check some error return values 2017-12-27 00:14:43 +00:00
Riccardo Spagni
270236e8f4 Merge pull request #2996
1a271d25 unbound: enable SHA1 (moneromooo-monero)
2017-12-26 17:42:57 +02:00
Jonny Heggheim
7883564541 Added Fedora devel dependencies 2017-12-26 15:13:41 +01:00
rbrunner7
50786ac70c simplewallet: Correct 3 multisig command usage help texts, e.g. for 'export_multisig_info' 2017-12-26 14:57:08 +01:00
moneromooo-monero
0281f63486 cmake: fix boost version detection 2017-12-26 12:09:54 +00:00
moneromooo-monero
da0fd71d3e only include the easylogging++ stack trace code when needed 2017-12-26 11:40:15 +00:00
moneromooo-monero
81b04cfa88 easlogging++: omit some unneded macros 2017-12-26 11:40:12 +00:00
stoffu
e3530789d3 wallet-api: added Utils::onStartup 2017-12-26 08:23:32 +09:00
Riccardo Spagni
4b156c003b Merge pull request #2611
cdd516fa tests : remove lib_wallet_api tests (guzzijones)
2017-12-25 22:49:07 +02:00
Riccardo Spagni
40df4905fd Merge pull request #3006
7e7b1a82 Revert "return subaddress in get_bulk_payments" (moneromooo-monero)
2017-12-25 22:08:56 +02:00
moneromooo-monero
7e7b1a8252 Revert "return subaddress in get_bulk_payments"
This reverts commit b60f48f0e3.
2017-12-25 20:04:40 +00:00
Riccardo Spagni
ca8c7e863f Merge pull request #2895
5ad312a1 wallet2: switch to chacha20 instead of chacha8 (moneromooo-monero)
1e5491e9 Add a chacha20 variant to go with chacha8 (moneromooo-monero)
2017-12-25 22:00:44 +02:00
Riccardo Spagni
0a5bfa7c73 Merge pull request #2938
aaae94f0 wallet2: reinstate the single preferred output selection (moneromooo-monero)
2017-12-25 21:42:22 +02:00
moneromooo-monero
5ad312a1c3 wallet2: switch to chacha20 instead of chacha8
Wallet caches and keys files are loaded with chacha8 as needed,
but only saved with chacha20. Other data (eg, cold wallet data
files, etc) will be incompatible.
2017-12-25 19:28:06 +00:00
moneromooo-monero
1e5491e942 Add a chacha20 variant to go with chacha8 2017-12-25 19:28:03 +00:00
Riccardo Spagni
6ca30ae666 Merge pull request #2936
cb9aa23c levin_protocol_handler_async: another attempt at fixing at exception (moneromooo-monero)
64d23ce3 Revert "epee: keep a ref to a connection we're deleting" (moneromooo-monero)
2017-12-25 21:21:17 +02:00
Riccardo Spagni
409e9bb029 Merge pull request #2931
04349492 wallet2: error out in get_seed if the language is invalid (moneromooo-monero)
2017-12-25 21:21:00 +02:00
Riccardo Spagni
effdc82b58 Merge pull request #2930
7f4bb612 levin_protocol_handler_async: add missing response handler locking (moneromooo-monero)
2017-12-25 21:20:41 +02:00
Riccardo Spagni
b38f6dcf0b Merge pull request #2929
ae55bacd resumption support for updates using range requests (moneromooo-monero)
fe0fae50 epee: add a get_file_size function (moneromooo-monero)
2017-12-25 21:20:22 +02:00
Riccardo Spagni
c611cca462 Merge pull request #2928
d28c388f p2p: stop net server before closing starting connections (moneromooo-monero)
2017-12-25 21:19:58 +02:00
Riccardo Spagni
db09247c68 Merge pull request #2926
6b5bd129 Account tagging (stoffu)
2017-12-25 21:19:33 +02:00
Riccardo Spagni
3b33bc0819 Merge pull request #2924
67fe4b1b Add Guix SD to available distro packages in README.md (vasi)
2017-12-25 21:19:16 +02:00
Riccardo Spagni
c443a98217 Merge pull request #2923
a7e2e1b0 fix: bind RPC to all interfaces inside Docker container (Alexander Azarov)
2017-12-25 21:18:59 +02:00
Riccardo Spagni
32c14e0f37 Merge pull request #2922
a1d44f27 updates: use https for updates (moneromooo-monero)
472a93c8 download: SSL suport (moneromooo-monero)
2017-12-25 21:18:29 +02:00
Riccardo Spagni
2b00899bb2 Merge pull request #2920
bd5cce07 network_throttle: fix ineffective locking (moneromooo-monero)
e0a61299 network_throttle: remove unused xxx static member (moneromooo-monero)
24f584d9 cryptonote_core: remove unused functions with off by one bugs (moneromooo-monero)
b1634aa3 blockchain: don't leave dangling pointers in this (moneromooo-monero)
8e60b81c cryptonote_core: fix db leak on error (moneromooo-monero)
213e326c abstract_tcp_server2: log init_server errors as fatal (moneromooo-monero)
b51dc566 use const refs in for loops for non tiny types (moneromooo-monero)
f0568ca6 net_parse_helpers: fix regex error checking (moneromooo-monero)
b49ddc76 check accessing an element past the end of a container (moneromooo-monero)
2305bf26 check return value for generate_key_derivation and derive_public_key (moneromooo-monero)
a4240d9f catch const exceptions (moneromooo-monero)
45a1c4c0 add empty container sanity checks when using front() and back() (moneromooo-monero)
56fa6ce1 tests: fix a buffer overread in a unit test (moneromooo-monero)
b4524892 rpc: guard against json parsing a non object (moneromooo-monero)
c2ed8618 easylogging++: avoid buffer underflow (moneromooo-monero)
187a6ab2 epee: trap failure to parse URI from request (moneromooo-monero)
061789b5 checkpoints: trap failure to load JSON checkpoints (moneromooo-monero)
ba2fefb9 checkpoints: pass std::string by const ref, not const value (moneromooo-monero)
38c8f4e0 mlog: terminate a string at last char, just in case (moneromooo-monero)
d753d716 fix a few leaks by throwing objects, not newed pointers to objects (moneromooo-monero)
fe568db8 p2p: use size_t for arbitrary counters instead of uint8_t (moneromooo-monero)
46d6fa35 cryptonote_protocol: sanity check chain hashes from peer (moneromooo-monero)
25584f86 cryptonote_protocol: print peer versions when unexpected (moneromooo-monero)
490a5d41 rpc: do not try to use an invalid txid in relay_tx (moneromooo-monero)
2017-12-25 21:17:52 +02:00
Riccardo Spagni
170f598ac9 Merge pull request #2918
f5bc7f18 simplewallet: fix default unspent_outputs output with subaddresses (moneromooo-monero)
2017-12-25 21:17:32 +02:00
Riccardo Spagni
8b40bc27a2 Merge pull request #2916
a9217641 wallet-rpc: added receiving address to res of get(_bulk)_payments; selective addresses for getaddress (stoffu)
2017-12-25 21:17:16 +02:00
Riccardo Spagni
f04d4a78de Merge pull request #2910
37f9c6e6 Dockerfile: add option to set build parallelism (MoroccanMalinois)
2017-12-25 21:17:00 +02:00
Riccardo Spagni
13b846971c Merge pull request #2909
dba2de61 levin_protocol_handler_async: call handler destroy function on dtor (moneromooo-monero)
2017-12-25 21:16:37 +02:00
Riccardo Spagni
9d1c4408ad Merge pull request #2905
bd1f6029 http_client: rewrite header parsing manually for speed (moneromooo-monero)
ec724eb6 tests: add levin fuzz test (moneromooo-monero)
f1bdc9a4 tests: add http client fuzz test (moneromooo-monero)
0272df9e add parse_url fuzz test (moneromooo-monero)
261b0dd0 tests: add base58 fuzz test (moneromooo-monero)
fd052087 fuzz_testing: allow automatically resuming an interrupted job (moneromooo-monero)
c80bb0eb tests: don't init stuff we don't need in fuzz tests - faster (moneromooo-monero)
53b83a83 tests: better load-from-binary fuzz test data file (moneromooo-monero)
1a379ef6 fuzz_testing: build with ASAN (assumed to be available) (moneromooo-monero)
4cd4a431 fuzz_testing: create out directory if needed, and fix filename passing (moneromooo-monero)
c27d9092 Makefile: build fuzz tests statically, starts faster (moneromooo-monero)
95aa0bf7 add load_from_binary/load_from_json fuzzers (moneromooo-monero)
2017-12-25 21:16:21 +02:00
Riccardo Spagni
d06f3ea9ad Merge pull request #2902
1741fb5f node_rpc_proxy: remove unused local and time call (moneromooo-monero)
2017-12-25 21:16:01 +02:00
Riccardo Spagni
b3dddb22fe Merge pull request #2899
b60f48f0 return subaddress in get_bulk_payments (Dmitriy Plekhanov)
2017-12-25 21:15:08 +02:00
Riccardo Spagni
fae44be777 Merge pull request #2897
463d385c add libsodium as dependency for building in readme (Gingeropolous)
2017-12-25 21:14:43 +02:00
Riccardo Spagni
2ef299f2a9 Merge pull request #2891
3f24e901 wallet2: don't write a .new file when not needed (moneromooo-monero)
2017-12-25 21:14:20 +02:00
Riccardo Spagni
2f09828ea8 Merge pull request #2890
83b0f9e6 version: add -master to master version (moneromooo-monero)
493f7d09 util: allow non numeric version parts (moneromooo-monero)
2017-12-25 21:13:59 +02:00
Riccardo Spagni
2d1965f31b Merge pull request #2888
ca18ff64 wallet2: detect spends in txes without a valid public tx key (moneromooo-monero)
6afcd8e3 cn_deserialize: print tx extra fields in partly decoded tx extra (moneromooo-monero)
2017-12-25 21:13:33 +02:00
stoffu
369884a669 mnemonics: typo fix (4 bytes == 3 words, not 8 bytes) 2017-12-25 19:57:38 +09:00
Riccardo Spagni
b373d0f15e Merge pull request #2994
2018cf74 Fix Windows build (dEBRUYNE-1)
2017-12-24 18:49:48 +02:00
moneromooo-monero
a2c845c7e3 cryptonote_protocol: internal error consistency size check 2017-12-24 13:04:40 +00:00
moneromooo-monero
9996d5e96c wallet2: guard against the dameon sending blocks before last checkpoint 2017-12-24 12:12:40 +00:00
moneromooo-monero
eadaa6aaa3 wallet_rpc_server: fix wallet leak on error exit
Makes it easier to debug leaks
2017-12-24 12:12:37 +00:00
moneromooo-monero
7c4f01a792 blockchain_import: more informative verification switch 2017-12-23 18:47:05 +00:00
moneromooo-monero
1a271d25a1 unbound: enable SHA1
Fixes the unit test failure about SHA1 being unavailable,
and hopefully the monerod complaints about not being able
to verify DNSSEC.

Thanks to iDunk for the remote Windows testing.
2017-12-23 16:14:49 +00:00
moneromooo-monero
6ccc51f645 wipeable_string: fix buffer overread 2017-12-23 15:30:04 +00:00
dEBRUYNE-1
2018cf74a6 Fix Windows build
Fix no new line
2017-12-23 15:27:30 +01:00
moneromooo-monero
bd1f6029a3 http_client: rewrite header parsing manually for speed
boost::regex is stupendously atrocious at parsing malformed data
2017-12-23 11:29:58 +00:00
moneromooo-monero
ec724eb64a tests: add levin fuzz test 2017-12-23 11:29:55 +00:00
moneromooo-monero
f1bdc9a42a tests: add http client fuzz test 2017-12-23 11:29:52 +00:00
moneromooo-monero
0272df9e61 add parse_url fuzz test 2017-12-23 11:29:49 +00:00
moneromooo-monero
261b0dd0e0 tests: add base58 fuzz test 2017-12-23 11:27:45 +00:00
moneromooo-monero
fd05208762 fuzz_testing: allow automatically resuming an interrupted job 2017-12-23 11:27:42 +00:00
moneromooo-monero
c80bb0eb6f tests: don't init stuff we don't need in fuzz tests - faster 2017-12-23 11:27:40 +00:00
moneromooo-monero
53b83a83fc tests: better load-from-binary fuzz test data file
Looks like there's some kind of header/signature
2017-12-23 11:27:37 +00:00
moneromooo-monero
1a379ef656 fuzz_testing: build with ASAN (assumed to be available) 2017-12-23 11:27:34 +00:00
moneromooo-monero
4cd4a4313d fuzz_testing: create out directory if needed, and fix filename passing 2017-12-23 11:27:31 +00:00
moneromooo-monero
c27d909239 Makefile: build fuzz tests statically, starts faster 2017-12-23 11:27:28 +00:00
moneromooo-monero
95aa0bf79b add load_from_binary/load_from_json fuzzers 2017-12-23 11:27:25 +00:00
moneromooo-monero
c70e8daa91 threadpool: fix deadlock in recursive waiter usage
If a queued job uses a waiter, then we want to run that waiter's
jobs in the current thread if all threads are busy, even if the
queue is empty, since there is no guarantee that any thread will
free up to take care of that new job, since all the threads might
be running a job which spawns such a recursive job and will block
till that recursive job is done, which it will never be since it
relies on the queue being polled by one of those blocked threads.
2017-12-23 09:00:43 +00:00
guzzijones
cdd516fae3 tests : remove lib_wallet_api tests 2017-12-22 20:52:22 +00:00
moneromooo-monero
2d17feb060 factor STL container serialization 2017-12-22 19:47:12 +00:00
moneromooo-monero
8a4610c315 blake256: fix wrong hash when computed in parts
This does not happen when used by the monero code
2017-12-22 12:08:02 +00:00
moneromooo-monero
66eeeaa1a2 wallet2: fix failure to create tx if inputs are not enough for fee 2017-12-21 22:11:16 +00:00
moneromooo-monero
373d1d504b epee: use strptime instead of std::get_time, for compatibility 2017-12-21 16:04:47 +00:00
Matt Smith
c765f9512c simplewallet: disable donations on testnet 2017-12-20 17:12:22 +00:00
moneromooo-monero
277a5aefaa wallet2: fix m_key_image_{partial,known} in_light_wallet code 2017-12-20 14:54:14 +00:00
moneromooo-monero
586ee64209 simplewallet: lock idle scope in {im,ex}port_{key_images,outputs}
This ensures we can't get races
2017-12-20 14:21:50 +00:00
moneromooo-monero
ae8602303a Fix exceptions not finding txpool txes when relaying 2017-12-20 13:02:53 +00:00
moneromooo-monero
5cbcf0aa25 wallet: support for multisig seeds
They are hex rather than words, because they are a lot longer
than "normal" seeds, as they have to embed a lot more information
2017-12-20 10:22:29 +00:00
moneromooo-monero
55556fabf9 wallet_rpc_server: factor transfer info return and add missing info
Additional tx keys, amounts and fees were missing in some cases
2017-12-20 08:56:31 +00:00
Riccardo Spagni
7a9a4a6669 Merge pull request #2961
6c94516f wipeable_string: move a wipe from reserve to grow (moneromooo-monero)
5f801b6a wipeable_string: ignore reserve size less than actual size (moneromooo-monero)
9ec44a2b wipeable_string: fix clear and push_back (moneromooo-monero)
2017-12-19 22:03:07 +02:00
damir
5388c81bbc Added using TOOLCHAIN_DIR varable on symlinking in android dockerfiles 2017-12-19 17:32:49 +03:00
moneromooo-monero
6c94516fb4 wipeable_string: move a wipe from reserve to grow
That way, all implicit wipes ends up in grow, which is more robust
2017-12-19 14:06:42 +00:00
moneromooo-monero
5f801b6adf wipeable_string: ignore reserve size less than actual size
This was asserting, but stoffu pointed out the std::string standard
considers this ok and ignorable
2017-12-19 14:00:41 +00:00
moneromooo-monero
3ed1a74ca3 tests: remove unused/unfinished keccak bits
The author doesn't seem to be finishing/fixing this, and it
doesn't do anything.
2017-12-19 13:14:12 +00:00
moneromooo-monero
0e19a39469 tests: test wallets don't need a dummy temp file anymore 2017-12-19 12:56:21 +00:00
moneromooo-monero
14c2981469 wallet2: fix use of uninitialized data 2017-12-19 12:33:01 +00:00
moneromooo-monero
9ec44a2b06 wipeable_string: fix clear and push_back 2017-12-19 11:55:45 +00:00
moneromooo-monero
dc64263155 performance_tests: add a test for subaddress expansion 2017-12-18 16:15:34 +00:00
moneromooo-monero
4f45f9da40 simplewallet: factor out tx exceptions 2017-12-18 15:56:36 +00:00
moneromooo-monero
bd5cce07b3 network_throttle: fix ineffective locking 2017-12-18 15:16:11 +00:00
moneromooo-monero
e0a61299fb network_throttle: remove unused xxx static member 2017-12-18 15:16:09 +00:00
moneromooo-monero
24f584d90d cryptonote_core: remove unused functions with off by one bugs 2017-12-18 15:16:06 +00:00
moneromooo-monero
b1634aa3e8 blockchain: don't leave dangling pointers in this 2017-12-18 15:16:03 +00:00
moneromooo-monero
8e60b81c48 cryptonote_core: fix db leak on error 2017-12-18 15:16:00 +00:00
moneromooo-monero
213e326cc9 abstract_tcp_server2: log init_server errors as fatal
so they show up by default
2017-12-18 15:15:57 +00:00
moneromooo-monero
b51dc56687 use const refs in for loops for non tiny types 2017-12-18 15:15:54 +00:00
moneromooo-monero
f0568ca6ac net_parse_helpers: fix regex error checking 2017-12-18 15:15:52 +00:00
moneromooo-monero
b49ddc766d check accessing an element past the end of a container 2017-12-18 15:15:49 +00:00
moneromooo-monero
2305bf260d check return value for generate_key_derivation and derive_public_key 2017-12-18 15:15:46 +00:00
moneromooo-monero
a4240d9ffc catch const exceptions 2017-12-18 15:15:43 +00:00
moneromooo-monero
45a1c4c088 add empty container sanity checks when using front() and back() 2017-12-18 15:15:40 +00:00
moneromooo-monero
56fa6ce15f tests: fix a buffer overread in a unit test
and remove a leftover debugging sanity check
2017-12-18 15:15:37 +00:00
moneromooo-monero
b4524892fb rpc: guard against json parsing a non object 2017-12-18 15:15:32 +00:00
moneromooo-monero
c2ed8618e4 easylogging++: avoid buffer underflow 2017-12-18 15:15:29 +00:00
moneromooo-monero
187a6ab2d2 epee: trap failure to parse URI from request 2017-12-18 15:15:26 +00:00
moneromooo-monero
061789b5dd checkpoints: trap failure to load JSON checkpoints 2017-12-18 15:15:23 +00:00
moneromooo-monero
ba2fefb9a4 checkpoints: pass std::string by const ref, not const value 2017-12-18 15:15:19 +00:00
moneromooo-monero
38c8f4e0a3 mlog: terminate a string at last char, just in case 2017-12-18 15:15:16 +00:00
moneromooo-monero
d753d716a6 fix a few leaks by throwing objects, not newed pointers to objects 2017-12-18 15:15:13 +00:00
moneromooo-monero
fe568db83d p2p: use size_t for arbitrary counters instead of uint8_t 2017-12-18 15:15:10 +00:00
moneromooo-monero
46d6fa35c9 cryptonote_protocol: sanity check chain hashes from peer 2017-12-18 15:15:07 +00:00
moneromooo-monero
25584f8639 cryptonote_protocol: print peer versions when unexpected
also avoid integer underflow on zero height
2017-12-18 15:15:05 +00:00
moneromooo-monero
490a5d41ca rpc: do not try to use an invalid txid in relay_tx 2017-12-18 15:15:01 +00:00
moneromooo-monero
0bcaf86cbd tests: fix link error in hash tests now needing common 2017-12-18 15:06:01 +00:00
stoffu
a921764162 wallet-rpc: added receiving address to res of get(_bulk)_payments; selective addresses for getaddress 2017-12-18 10:22:34 +09:00
stoffu
6b5bd129b4 Account tagging 2017-12-18 10:21:47 +09:00
Riccardo Spagni
1cc7451130 Merge pull request #2134
ceabc4f9 change the N-1/N multisig second message signer for auth (moneromooo-monero)
55c2845d core_tests: multisig test now tests multiple inputs (moneromooo-monero)
98db7ee4 wallet: factor multisig info parsing (moneromooo-monero)
31a97e76 wallet: use raw encrypted data in multisig import/export RPC (moneromooo-monero)
2fa707d1 wallet: add multisig sign/submit RPC (moneromooo-monero)
e36f5b60 Match surae's recommendation to derive multisig keys (moneromooo-monero)
a36c261d wallet2: fix slow multisig unit tests with subaddress patch (moneromooo-monero)
fa569712 make multisig work with subaddresses (moneromooo-monero)
dffa0dce simplewallet: add export_raw_multisig command (moneromooo-monero)
7f4c220b simplewallet: add multisig to wallet type in wallet_info output (moneromooo-monero)
26529038 wallet: guard against partly initialized multisig wallet (moneromooo-monero)
66e34e85 add multisig core test and factor multisig building blocks (moneromooo-monero)
f4eda44c N-1/N multisig (moneromooo-monero)
cd64c799 multisig address generation RPC (moneromooo-monero)
fff871a4 gen_multisig: generates multisig wallets if participants trust each other (moneromooo-monero)
95a21a79 wallet2: allow empty wallet filename to avoid saving data (moneromooo-monero)
b84b3565 tests: add multisig unit tests (moneromooo-monero)
4c313324 Add N/N multisig tx generation and signing (moneromooo-monero)
6d219a92 wallet: add multisig key generation (moneromooo-monero)
2017-12-17 21:05:16 +02:00
Riccardo Spagni
2879a9be3c Merge pull request #2950
d9b137f1 cryptonote_core: fix blockchain init call after prototype change (moneromooo-monero)
2017-12-17 21:04:17 +02:00
moneromooo-monero
d9b137f161 cryptonote_core: fix blockchain init call after prototype change 2017-12-17 18:47:46 +00:00
xmr-eric
e20e489a64 Better definite article use 2017-12-17 12:33:43 -05:00
xmr-eric
e12ee76ad2 README.md: Improve copy for supporting the project 2017-12-17 12:11:25 -05:00
moneromooo-monero
ceabc4f92b change the N-1/N multisig second message signer for auth 2017-12-17 16:12:50 +00:00
moneromooo-monero
55c2845d1a core_tests: multisig test now tests multiple inputs 2017-12-17 16:12:47 +00:00
moneromooo-monero
98db7ee467 wallet: factor multisig info parsing 2017-12-17 16:12:44 +00:00
moneromooo-monero
31a97e761e wallet: use raw encrypted data in multisig import/export RPC 2017-12-17 16:12:41 +00:00
moneromooo-monero
2fa707d1a5 wallet: add multisig sign/submit RPC 2017-12-17 16:12:35 +00:00
moneromooo-monero
e36f5b6021 Match surae's recommendation to derive multisig keys 2017-12-17 16:12:32 +00:00
moneromooo-monero
a36c261d7a wallet2: fix slow multisig unit tests with subaddress patch
While there, move the wallet2 ctor to the cpp file as it's a huge
amount of init list now, and remove an unused one.
2017-12-17 16:12:30 +00:00
moneromooo-monero
fa5697127f make multisig work with subaddresses
Thanks to kenshi84 for help getting this work
2017-12-17 16:12:27 +00:00
moneromooo-monero
dffa0dceaf simplewallet: add export_raw_multisig command
It exports raw transactions, so they may be used by other tools,
for instance to be relayed to the network externally.
2017-12-17 16:12:24 +00:00
moneromooo-monero
7f4c220b70 simplewallet: add multisig to wallet type in wallet_info output 2017-12-17 16:12:21 +00:00
moneromooo-monero
265290388b wallet: guard against partly initialized multisig wallet 2017-12-17 16:12:18 +00:00
moneromooo-monero
66e34e85b1 add multisig core test and factor multisig building blocks 2017-12-17 16:12:15 +00:00
moneromooo-monero
f4eda44ce3 N-1/N multisig 2017-12-17 16:12:12 +00:00
moneromooo-monero
cd64c7990c multisig address generation RPC 2017-12-17 16:12:09 +00:00
moneromooo-monero
fff871a455 gen_multisig: generates multisig wallets if participants trust each other 2017-12-17 16:12:06 +00:00
moneromooo-monero
95a21a793d wallet2: allow empty wallet filename to avoid saving data
Useful to speed tests up and avoid unnecessary leftover files
2017-12-17 16:12:03 +00:00
moneromooo-monero
b84b3565f3 tests: add multisig unit tests 2017-12-17 16:12:00 +00:00
moneromooo-monero
4c313324b1 Add N/N multisig tx generation and signing
Scheme by luigi1111:

    Multisig for RingCT on Monero

    2 of 2

    User A (coordinator):
    Spendkey b,B
    Viewkey a,A (shared)

    User B:
    Spendkey c,C
    Viewkey a,A (shared)

    Public Address: C+B, A

    Both have their own watch only wallet via C+B, a

    A will coordinate spending process (though B could easily as well, coordinator is more needed for more participants)

    A and B watch for incoming outputs

    B creates "half" key images for discovered output D:
    I2_D = (Hs(aR)+c) * Hp(D)

    B also creates 1.5 random keypairs (one scalar and 2 pubkeys; one on base G and one on base Hp(D)) for each output, storing the scalar(k) (linked to D),
    and sending the pubkeys with I2_D.

    A also creates "half" key images:
    I1_D = (Hs(aR)+b) * Hp(D)

    Then I_D = I1_D + I2_D

    Having I_D allows A to check spent status of course, but more importantly allows A to actually build a transaction prefix (and thus transaction).

    A builds the transaction until most of the way through MLSAG_Gen, adding the 2 pubkeys (per input) provided with I2_D
    to his own generated ones where they are needed (secret row L, R).

    At this point, A has a mostly completed transaction (but with an invalid/incomplete signature). A sends over the tx and includes r,
    which allows B (with the recipient's address) to verify the destination and amount (by reconstructing the stealth address and decoding ecdhInfo).

    B then finishes the signature by computing ss[secret_index][0] = ss[secret_index][0] + k - cc[secret_index]*c (secret indices need to be passed as well).

    B can then broadcast the tx, or send it back to A for broadcasting. Once B has completed the signing (and verified the tx to be valid), he can add the full I_D
    to his cache, allowing him to verify spent status as well.

    NOTE:
    A and B *must* present key A and B to each other with a valid signature proving they know a and b respectively.
    Otherwise, trickery like the following becomes possible:
    A creates viewkey a,A, spendkey b,B, and sends a,A,B to B.
    B creates a fake key C = zG - B. B sends C back to A.
    The combined spendkey C+B then equals zG, allowing B to spend funds at any time!
    The signature fixes this, because B does not know a c corresponding to C (and thus can't produce a signature).

    2 of 3

    User A (coordinator)
    Shared viewkey a,A
    "spendkey" j,J

    User B
    "spendkey" k,K

    User C
    "spendkey" m,M

    A collects K and M from B and C
    B collects J and M from A and C
    C collects J and K from A and B

    A computes N = nG, n = Hs(jK)
    A computes O = oG, o = Hs(jM)

    B anc C compute P = pG, p = Hs(kM) || Hs(mK)
    B and C can also compute N and O respectively if they wish to be able to coordinate

    Address: N+O+P, A

    The rest follows as above. The coordinator possesses 2 of 3 needed keys; he can get the other
    needed part of the signature/key images from either of the other two.

    Alternatively, if secure communication exists between parties:
    A gives j to B
    B gives k to C
    C gives m to A

    Address: J+K+M, A

    3 of 3

    Identical to 2 of 2, except the coordinator must collect the key images from both of the others.
    The transaction must also be passed an additional hop: A -> B -> C (or A -> C -> B), who can then broadcast it
    or send it back to A.

    N-1 of N

    Generally the same as 2 of 3, except participants need to be arranged in a ring to pass their keys around
    (using either the secure or insecure method).
    For example (ignoring viewkey so letters line up):
    [4 of 5]
    User: spendkey
    A: a
    B: b
    C: c
    D: d
    E: e

    a -> B, b -> C, c -> D, d -> E, e -> A

    Order of signing does not matter, it just must reach n-1 users. A "remaining keys" list must be passed around with
    the transaction so the signers know if they should use 1 or both keys.
    Collecting key image parts becomes a little messy, but basically every wallet sends over both of their parts with a tag for each.
    Thia way the coordinating wallet can keep track of which images have been added and which wallet they come from. Reasoning:
    1. The key images must be added only once (coordinator will get key images for key a from both A and B, he must add only one to get the proper key actual key image)
    2. The coordinator must keep track of which helper pubkeys came from which wallet (discussed in 2 of 2 section). The coordinator
    must choose only one set to use, then include his choice in the "remaining keys" list so the other wallets know which of their keys to use.

    You can generalize it further to N-2 of N or even M of N, but I'm not sure there's legitimate demand to justify the complexity. It might
    also be straightforward enough to support with minimal changes from N-1 format.
    You basically just give each user additional keys for each additional "-1" you desire. N-2 would be 3 keys per user, N-3 4 keys, etc.

The process is somewhat cumbersome:

To create a N/N multisig wallet:

 - each participant creates a normal wallet
 - each participant runs "prepare_multisig", and sends the resulting string to every other participant
 - each participant runs "make_multisig N A B C D...", with N being the threshold and A B C D... being the strings received from other participants (the threshold must currently equal N)

As txes are received, participants' wallets will need to synchronize so that those new outputs may be spent:

 - each participant runs "export_multisig FILENAME", and sends the FILENAME file to every other participant
 - each participant runs "import_multisig A B C D...", with A B C D... being the filenames received from other participants

Then, a transaction may be initiated:

 - one of the participants runs "transfer ADDRESS AMOUNT"
 - this partly signed transaction will be written to the "multisig_monero_tx" file
 - the initiator sends this file to another participant
 - that other participant runs "sign_multisig multisig_monero_tx"
 - the resulting transaction is written to the "multisig_monero_tx" file again
 - if the threshold was not reached, the file must be sent to another participant, until enough have signed
 - the last participant to sign runs "submit_multisig multisig_monero_tx" to relay the transaction to the Monero network
2017-12-17 16:11:57 +00:00
moneromooo-monero
6d219a9250 wallet: add multisig key generation
Scheme by luigi1111
2017-12-17 16:11:53 +00:00
moneromooo-monero
1a686bf8cc daemon: print num txes in print_bc 2017-12-17 12:55:40 +00:00
Riccardo Spagni
a3a8343051 Merge pull request #2857
7193b89f Scrub keys from memory just before scope end. (moneromooo-monero)
2017-12-17 13:00:11 +02:00
Riccardo Spagni
066fd7aced Merge pull request #2877
43f5269f Wallets now do not depend on the daemon rpc lib (moneromooo-monero)
bb89ae8b move connection_basic and network_throttle from src/p2p to epee (moneromooo-monero)
4abf25f3 cryptonote_core does not depend on p2p anymore (moneromooo-monero)
2017-12-17 12:59:44 +02:00
Riccardo Spagni
b806d9844e Merge pull request #2864
09ce03d6 move includes around to lessen overall load (moneromooo-monero)
2017-12-17 12:58:46 +02:00
moneromooo-monero
9e07ccf1f5 daemon: remove some superfluous includes 2017-12-17 10:28:39 +00:00
moneromooo-monero
223e3788ac unit_tests: fix memwipe test comparison
free might overwrite the memory, so we can't expect to see
the NULs we overwrote with, but at least we shouldn't see
the original data.
2017-12-17 09:56:36 +00:00
moneromooo-monero
43f5269f84 Wallets now do not depend on the daemon rpc lib
The shared RPC code is now moved off into a separate lib
2017-12-16 23:28:59 +00:00
moneromooo-monero
bb89ae8b20 move connection_basic and network_throttle from src/p2p to epee
These even had the epee namespace.
This fixes some ugly circular dependencies.
2017-12-16 23:28:43 +00:00
moneromooo-monero
4abf25f3c9 cryptonote_core does not depend on p2p anymore
As a followon side effect, this makes a lot of inline code
included only in particular cpp files (and instanciated
when necessary.
2017-12-16 23:28:38 +00:00
moneromooo-monero
09ce03d612 move includes around to lessen overall load 2017-12-16 22:46:38 +00:00
moneromooo-monero
7193b89fe5 Scrub keys from memory just before scope end.
Partially implements #74.

Securely erases keys from memory after they are no longer needed. Might have a
performance impact, which I haven't measured (perf measurements aren't
generally reliable on laptops).

Thanks to @stoffu for the suggestion to specialize the pod_to_hex/hex_to_pod
functions. Using overloads + SFINAE instead generalizes it so other types can
be marked as scrubbed without adding more boilerplate.
2017-12-16 15:40:33 -07:00
Riccardo Spagni
38ecd0526e Merge pull request #2881
41fc11fa Scheduled mandatory software upgrades (xmr-eric)
3b5382fe Keep VRP a proper noun (xmr-eric)
7160cbd6 CONTRIBUTING.md capitalization (xmr-eric)
f36ffc07 Shorten a title, remove a section, small edits (xmr-eric)
00179917 Capitalization on first word only (xmr-eric)
6ffae079 Readme.md: Normalize heading capitalization (xmr-eric)
2017-12-16 23:27:47 +02:00
Riccardo Spagni
8da24c2a57 Merge pull request #2878
abebe392 rpc: add offline state in info rpc (moneromooo-monero)
7696e849 core: make --offline also disable DNS lookups (moneromooo-monero)
2017-12-16 23:27:00 +02:00
Riccardo Spagni
ec63d64a67 Merge pull request #2874
25f4ab81 fixed linking against libreadline on OpenBSD (ston1th)
2017-12-16 23:26:13 +02:00
Riccardo Spagni
b88f0879b5 Merge pull request #2873
1c838552 Simplewallet.cpp: Fewer pleases in seed NOTE (xmr-eric)
3f18c642 Fix password capitalization mismatch (xmr-eric)
2017-12-16 23:25:43 +02:00
Riccardo Spagni
7998ffc26b Merge pull request #2871
2b0a32f8 Small cleanup of daemon synchronization output (xmr-eric)
2017-12-16 23:25:02 +02:00
Riccardo Spagni
9b511d3e93 Merge pull request #2866
cf5f6236 Corrections in rate limiting / trottle code, especially in 'out' direction (rbrunner7)
2017-12-16 23:24:41 +02:00
Riccardo Spagni
87158dca68 Merge pull request #2885
a1e3670b catch wallet decrypt false positive (Riccardo Spagni)
2017-12-16 23:24:16 +02:00
Riccardo Spagni
6c0953b15a Merge pull request #2860
3dffe71b new wipeable_string class to replace std::string passphrases (moneromooo-monero)
7a2a5741 utils: initialize easylogging++ in on_startup (moneromooo-monero)
54950829 use memwipe in a few relevant places (moneromooo-monero)
000666ff add a memwipe function (moneromooo-monero)
2017-12-16 23:19:27 +02:00
Riccardo Spagni
ce951ef560 Merge pull request #2856
009eed17 rpc: increase the max number of outs one can request (moneromooo-monero)
2017-12-16 23:15:43 +02:00
Riccardo Spagni
9045ff56fc Merge pull request #2551
3af19c80 set_node command, allows setting node without restart (Tobias Hoffmann)
2017-12-16 23:12:44 +02:00
moneromooo-monero
d0d38dc8e6 wallet2: print tx size in bytes and kB
Helpful now that tx sizes are smaller
2017-12-16 18:40:21 +00:00
moneromooo-monero
aaae94f00b wallet2: reinstate the single preferred output selection
Removing it nullified the min-outputs-{count,value} system,
and will not increase the number of attempted transactions
in the general case.
2017-12-16 12:31:03 +00:00
moneromooo-monero
cb9aa23cc5 levin_protocol_handler_async: another attempt at fixing at exception 2017-12-15 18:38:53 +00:00
Guillaume LE VAILLANT
db2bc96512 Embed the translation files in the binary
If a translation file exists in a "translations" directory located in
the same directory as the binary, it is used in priority (this can be
useful when working on translations as you don't have to recompile the
whole program all the time), and if no such file is found the embedded
translation file is used (if it exists).
2017-12-15 18:44:01 +01:00
vasi
67fe4b1b06 Add Guix SD to available distro packages in README.md 2017-12-15 15:00:04 +01:00
moneromooo-monero
64d23ce331 Revert "epee: keep a ref to a connection we're deleting"
This reverts commit f2939bdce8.
2017-12-15 13:23:21 +00:00
moneromooo-monero
043494924b wallet2: error out in get_seed if the language is invalid 2017-12-15 11:01:14 +00:00
moneromooo-monero
7f4bb612fb levin_protocol_handler_async: add missing response handler locking 2017-12-15 10:47:45 +00:00
moneromooo-monero
ae55bacd8c resumption support for updates using range requests 2017-12-15 10:46:23 +00:00
moneromooo-monero
fe0fae5089 epee: add a get_file_size function 2017-12-15 10:32:36 +00:00
moneromooo-monero
d28c388f88 p2p: stop net server before closing starting connections
This fixes a hang on exit due to race where a connection adds
itself to the server after the starting connections are closed,
but before the net server marks itself as stopped.
2017-12-15 10:31:12 +00:00
Alexander Azarov
a7e2e1b07f fix: bind RPC to all interfaces inside Docker container
Binding RPC to 127.0.0.1 makes no sense. Despite the fact port 18081 is
exposed, no one will be able to connect to the daemon.

RPC should be listening at all interfaces when running inside a Docker
container.
2017-12-14 23:11:30 +02:00
moneromooo-monero
a1d44f2746 updates: use https for updates 2017-12-14 13:33:06 +00:00
moneromooo-monero
472a93c83a download: SSL suport 2017-12-14 09:12:58 +00:00
moneromooo-monero
f5bc7f1855 simplewallet: fix default unspent_outputs output with subaddresses
If no subaddress index is given, consider all of them
2017-12-13 10:09:42 +00:00
Riccardo Spagni
319163d276 Merge pull request #2913
b927f0b1 cryptonote_protocol: fix corner case looping asking for same block hashes (moneromooo-monero)
2017-12-12 17:48:29 +02:00
MoroccanMalinois
37f9c6e651 Dockerfile: add option to set build parallelism 2017-12-11 23:33:08 +00:00
moneromooo-monero
dba2de61e7 levin_protocol_handler_async: call handler destroy function on dtor 2017-12-11 18:33:37 +00:00
Riccardo Spagni
f51bac990e Merge pull request #2906
27aa8ce9 net_utils_base: fix peer list parsing (moneromooo-monero)
fe5ab2c4 epee: fix kv_unserialize return value when a field is not found (moneromooo-monero)
2017-12-10 13:08:23 +02:00
Riccardo Spagni
f270382718 Merge pull request #2900
5cc84693 easylogging: show the 'no stack trace' warning only once (ston1th)
2017-12-10 12:57:23 +02:00
moneromooo-monero
27aa8ce95b net_utils_base: fix peer list parsing
Fields are written with their "name" as key, and that name changed.
2017-12-09 22:16:58 +00:00
Riccardo Spagni
0e7b29d62d Merge pull request #2904
46eaaae7 ringct: always use outPk.mask to decode amounts (moneromooo-monero)
2017-12-09 20:14:41 +02:00
moneromooo-monero
46eaaae79b ringct: always use outPk.mask to decode amounts 2017-12-09 18:02:55 +00:00
Riccardo Spagni
2b5abb8269 Merge pull request #2903
8d4469a0 ringct: do not include bulletproof commitments in signed message (moneromooo-monero)
2017-12-09 19:05:56 +02:00
Riccardo Spagni
2808585b24 Merge pull request #2901
ead48f7d core: fix input ordering from v7 (moneromooo-monero)
2017-12-09 19:05:37 +02:00
moneromooo-monero
8d4469a0ac ringct: do not include bulletproof commitments in signed message
Those are not serialized, but are restored from the outPk masks,
so depending on what tries to validate the tx, those commitments
may or may not be filled with valid data at the time. The outPk
masks are already hashed as part of the rctSigBase field.
2017-12-09 15:30:15 +00:00
moneromooo-monero
1741fb5f2b node_rpc_proxy: remove unused local and time call 2017-12-09 11:28:18 +00:00
moneromooo-monero
ead48f7d92 core: fix input ordering from v7 2017-12-09 11:24:38 +00:00
ston1th
5cc8469332 easylogging: show the 'no stack trace' warning only once
If execinfo.h is not available, output the stack trace warning only once, so we don't spam the build logs with it.
2017-12-09 10:01:31 +01:00
Riccardo Spagni
782a84f7b4 Merge pull request #2883
c83d0b3e add bulletproofs from v7 on testnet (moneromooo-monero)
8620ef0a bulletproofs: switch H/G in Pedersen commitments to match rct (moneromooo-monero)
d58835b2 integrate bulletproofs into monero (moneromooo-monero)
90b8d9f2 add bulletproofs to the build, with basic unit tests (moneromooo-monero)
fe120264 perf_timer: add non scoped start/stop timer defines (moneromooo-monero)
ada42914 add a version of ge_double_scalarmult_precomp_vartime with A precomp (moneromooo-monero)
d43eef6d ringct: add a version of addKeys which returns the result (moneromooo-monero)
7ff07928 sc_mul and sc_muladd (luigi1111)
3d0b54bd epee: add do while(0) around brace statement in a macro (moneromooo-monero)
2017-12-08 23:30:51 +02:00
Dmitriy Plekhanov
b60f48f0e3 return subaddress in get_bulk_payments 2017-12-08 18:45:53 +03:00
moneromooo-monero
c83d0b3ee2 add bulletproofs from v7 on testnet 2017-12-08 13:50:45 +00:00
moneromooo-monero
8620ef0a0d bulletproofs: switch H/G in Pedersen commitments to match rct
Changes from sarang
2017-12-08 13:48:18 +00:00
moneromooo-monero
d58835b2f6 integrate bulletproofs into monero 2017-12-08 13:48:15 +00:00
moneromooo-monero
90b8d9f271 add bulletproofs to the build, with basic unit tests
Based on Java code from Sarang Noether
2017-12-08 13:41:13 +00:00
Gingeropolous
463d385c96 add libsodium as dependency for building in readme
this finally got my debug-static-all to build. Obviously, its me, so this could use some edits or something.
2017-12-07 22:47:50 -05:00
xmr-eric
41fc11fab3 Scheduled mandatory software upgrades 2017-12-07 18:12:19 -05:00
moneromooo-monero
fe1202646c perf_timer: add non scoped start/stop timer defines 2017-12-07 19:23:14 +00:00
moneromooo-monero
ada4291469 add a version of ge_double_scalarmult_precomp_vartime with A precomp 2017-12-07 19:23:10 +00:00
moneromooo-monero
d43eef6def ringct: add a version of addKeys which returns the result 2017-12-07 19:23:08 +00:00
luigi1111
7ff07928ad sc_mul and sc_muladd 2017-12-07 19:23:05 +00:00
moneromooo-monero
3d0b54bd01 epee: add do while(0) around brace statement in a macro
Allows use in more complex expressions
2017-12-07 19:23:02 +00:00
moneromooo-monero
3f24e90149 wallet2: don't write a .new file when not needed 2017-12-07 12:07:18 +00:00
moneromooo-monero
83b0f9e6c5 version: add -master to master version
This makes master versions play better with automated update checks
2017-12-07 10:33:12 +00:00
moneromooo-monero
493f7d0974 util: allow non numeric version parts 2017-12-07 10:32:48 +00:00
Tobias Hoffmann
3af19c8011 set_node command, allows setting node without restart 2017-12-06 18:16:50 +01:00
moneromooo-monero
ca18ff644b wallet2: detect spends in txes without a valid public tx key 2017-12-06 15:55:06 +00:00
moneromooo-monero
6afcd8e37d cn_deserialize: print tx extra fields in partly decoded tx extra 2017-12-06 15:54:17 +00:00
xmr-eric
3b5382fe70 Keep VRP a proper noun 2017-12-05 10:54:51 -05:00
xmr-eric
7160cbd683 CONTRIBUTING.md capitalization 2017-12-04 21:21:55 -05:00
xmr-eric
f36ffc0714 Shorten a title, remove a section, small edits 2017-12-04 21:11:31 -05:00
xmr-eric
0017991753 Capitalization on first word only 2017-12-04 14:59:47 -05:00
Riccardo Spagni
a1e3670b33 catch wallet decrypt false positive 2017-12-04 11:07:32 +02:00
moneromooo-monero
b927f0b17e cryptonote_protocol: fix corner case looping asking for same block hashes 2017-12-03 13:05:10 +00:00
xmr-eric
6ffae07919 Readme.md: Normalize heading capitalization 2017-12-02 15:40:29 -05:00
Riccardo Spagni
8512a83572 Merge pull request #2845
c256a248 Android dockerfile: add zmq dependency (MoroccanMalinois)
2017-12-02 09:27:04 +02:00
Riccardo Spagni
55e2b5c0b0 Merge pull request #2844
8198f031 Add mdb_drop tool (Howard Chu)
2017-12-02 09:26:48 +02:00
Riccardo Spagni
bacbc0705f Merge pull request #2843
26ce640f Update README.md with info about release timelines (Gingeropolous)
2017-12-02 09:26:32 +02:00
Riccardo Spagni
3052dab81d Merge pull request #2836
23b6f685 RPC: allow binding of restricted port in addition to core port (Tim L)
2017-12-02 09:26:15 +02:00
Riccardo Spagni
81fb832082 Merge pull request #2833
b0426d4c Fixes #759 Add sanity check on restore height (Cifrado)
2017-12-02 09:25:53 +02:00
Riccardo Spagni
b0c63ceb73 Merge pull request #2854
36b41ab2 added missing link for OpenBSD build instructions (ston1th)
2017-12-02 09:25:05 +02:00
Riccardo Spagni
63f0031965 Merge pull request #2853
c0ae52c0 simplewallet: prevent (wrong) integrated adresses on accounts > 0 (moneromooo-monero)
2017-12-02 09:24:53 +02:00
Riccardo Spagni
476e64053d Merge pull request #2852
631b35e7 CONTRIBUTING.md: mention git add -p as a way to avoid spurious changes (moneromooo-monero)
2017-12-02 09:24:39 +02:00
Riccardo Spagni
301279709d Merge pull request #2850
d875a9ff wallet2: detect multiple outputs from a tx to different subaddresses (moneromooo-monero)
2017-12-02 09:24:25 +02:00
Riccardo Spagni
bae16bf878 Merge pull request #2847
7256d9a7 Fix versioning (vdo)
e459d467 Update snap version to 0.11.1 (vdo)
2017-12-02 09:24:08 +02:00
Riccardo Spagni
57ac2c2642 Merge pull request #2840
f9fad186 blockchain_db: sanity check on tx/hash vector sizes (flozilla)
2017-12-02 09:23:36 +02:00
Riccardo Spagni
ed8fc8ac1c Merge pull request #2838
310b790a make connection_id a string in RPC (moneromooo-monero)
2017-12-02 09:23:22 +02:00
Riccardo Spagni
4adcacd800 Merge pull request #2835
e41cc58d Fix docker image dependencies, don't install libraries statically linked (Bruno Clermont)
2ddbc3ef use make (Bruno Clermont)
81ac0e91 Force docker image to use --non-interactive (Bruno Clermont)
e03be11a fix and improve docker image, add doc for docker-compose (Bruno Clermont)
2017-12-02 09:23:01 +02:00
Riccardo Spagni
1fec38e736 Merge pull request #2832
287dde63 Added command descriptions (Cifrado)
2017-12-02 09:22:43 +02:00
Riccardo Spagni
7227cde3dc Merge pull request #2831
d73d7aca Add two configuration options to monerod.service: (0xB44EFD8751077F97)
2017-12-02 09:22:29 +02:00
Riccardo Spagni
0d7162dc10 Merge pull request #2830
f5461a6a RPC: CORS add Access-Control-Allow-Headers to OPTIONS preflight (Tim L)
2017-12-02 09:22:17 +02:00
Riccardo Spagni
0bf4d6deea Merge pull request #2828
6cbe7bcd wallet2: check generate_key_derivation return value (moneromooo-monero)
2017-12-02 09:21:55 +02:00
moneromooo-monero
fe5ab2c439 epee: fix kv_unserialize return value when a field is not found 2017-12-01 16:43:57 +00:00
moneromooo-monero
abebe392c7 rpc: add offline state in info rpc 2017-11-30 15:44:01 +00:00
moneromooo-monero
7696e84952 core: make --offline also disable DNS lookups 2017-11-30 15:35:52 +00:00
rbrunner7
cf5f623616 Corrections in rate limiting / trottle code, especially in 'out' direction
Deleted 3 out of 4 calls to method connection_basic::sleep_before_packet
that were erroneous / superfluous, which enabled the elimination of a
"fudge" factor of 2.1 in connection_basic::set_rate_up_limit;
also ended the multiplying of limit values and numbers of bytes
transferred by 1024 before handing them over to the global throttle
objects
2017-11-28 21:18:01 +01:00
ston1th
25f4ab81ce fixed linking against libreadline on OpenBSD
To fix the linking error described here https://github.com/monero-project/monero/pull/2841#issuecomment-346129030 we also need to link libcurses.
2017-11-28 19:03:07 +01:00
xmr-eric
1c838552ed Simplewallet.cpp: Fewer pleases in seed NOTE
Monero.ts: Fewer pleases in seed NOTE

Monero_it.ts: Fewer pleases in seed NOTE

Monero_fr.ts: Fewer pleases in seed NOTE
2017-11-28 11:41:26 -05:00
xmr-eric
3f18c642fc Fix password capitalization mismatch 2017-11-28 11:15:50 -05:00
moneromooo-monero
3dffe71b72 new wipeable_string class to replace std::string passphrases 2017-11-27 22:25:57 +00:00
moneromooo-monero
7a2a574118 utils: initialize easylogging++ in on_startup
It will be reinitialized later once we know about log file
and other command line configuration
2017-11-27 22:15:40 +00:00
moneromooo-monero
549508296d use memwipe in a few relevant places 2017-11-27 22:15:37 +00:00
moneromooo-monero
000666ff78 add a memwipe function
It's meant to avoid being optimized out

memory_cleanse lifted from bitcoin
2017-11-27 22:15:34 +00:00
xmr-eric
2b0a32f8af Small cleanup of daemon synchronization output
Add period to second sentence
2017-11-27 16:37:20 -05:00
Riccardo Spagni
9fad4008ef Merge pull request #2863
37c1ce3b tests: disable libwallet_api_tests when BUILD_GUI_DEPS is not set (moneromooo-monero)
2017-11-27 22:44:13 +02:00
Riccardo Spagni
c97bb7455f Merge pull request #2841
36f0538a cmake: fix building when readline is not found (moneromooo-monero)
2017-11-27 22:43:46 +02:00
Riccardo Spagni
51e7645836 Merge pull request #2839
0b08bf39 fixed common/util.cpp to link against libressl (ston1th)
2017-11-27 22:43:01 +02:00
Cifrado
287dde63d8 Added command descriptions 2017-11-26 10:37:37 +01:00
moneromooo-monero
37c1ce3b68 tests: disable libwallet_api_tests when BUILD_GUI_DEPS is not set 2017-11-26 08:25:42 +00:00
Riccardo Spagni
8a8c918dc3 Merge pull request #2827
fdf0acbf Tools, daemonizer: fix building on Windows (iDunk5400)
2017-11-25 19:54:14 +02:00
Riccardo Spagni
ac261d0d87 Merge pull request #2825
ac5cd865 simplewallet: fix typo in incoming monero message (moneromooo-monero)
2017-11-25 19:53:58 +02:00
Riccardo Spagni
2e54e7ff0b Merge pull request #2824
51895fd7 split wallet and wallet_api (moneromooo-monero)
2017-11-25 19:53:35 +02:00
Riccardo Spagni
4c90d638bc Merge pull request #2823
0d149f70 Add out-of-bound exceptions and handle them in RPC (Michał Sałaban)
2017-11-25 19:53:12 +02:00
Riccardo Spagni
a7211b5a07 Merge pull request #2822
93c33985 simplewallet: translate ring size 0 to mixin 0 (default values) (moneromooo-monero)
2017-11-25 19:52:52 +02:00
Riccardo Spagni
64d301a7b0 Merge pull request #2817
f493eabb unit_tests: fix running without --data-dir (moneromooo-monero)
2017-11-25 19:52:33 +02:00
Riccardo Spagni
fbfdaae06f Merge pull request #2807
61712384 daemon & simplewallet: don't set max-concurrency when unspecified (stoffu)
2017-11-25 19:51:52 +02:00
Riccardo Spagni
82375f7de7 Merge pull request #2806
da706b61 Fix false GCC warning '‘*((void*)& subaddr_account +4)’ may be used unitialized' (binaryFate)
2017-11-25 19:51:28 +02:00
Riccardo Spagni
df032aac69 Merge pull request #2800
0b726be7 wallet2: minimize the number of construct_tx calls (moneromooo-monero)
9d505d26 wallet2: cleanup some debug logs (moneromooo-monero)
2017-11-25 19:50:58 +02:00
Riccardo Spagni
1de386111f Merge pull request #2797
7e387fb1 wallet2: only add a dummy 0 output if there's one output otherwise (moneromooo-monero)
2017-11-25 19:50:21 +02:00
Riccardo Spagni
eefd6a7878 Merge pull request #2796
b42ee213 Wallet: update ring size in outdated error msgs with set_default_ring_size (binaryFate)
2017-11-25 19:49:48 +02:00
Riccardo Spagni
7dc58410e5 Merge pull request #2784
54a4c1cb cryptonote: do not overwrite const data (moneromooo-monero)
2017-11-25 19:49:22 +02:00
Riccardo Spagni
539f511eb1 Merge pull request #2368
b0b7e0f0 Spend proof without txkey (stoffu)
2017-11-25 19:48:56 +02:00
Riccardo Spagni
ed2fc4a1ff Merge pull request #2794
43f27c7d core: warn when free disk space is low (moneromooo-monero)
2017-11-25 19:48:33 +02:00
Riccardo Spagni
7ae7e5ef93 Merge pull request #2793
3501ed1f Do not require libatomic on FreeBSD (Vasil Dimov)
2017-11-25 19:48:12 +02:00
Riccardo Spagni
29b0bb8952 Merge pull request #2792
47c0948a Implement missing miner functions on FreeBSD (Vasil Dimov)
fdb5bd16 Remove unused variables and fix typos in comments (Vasil Dimov)
2017-11-25 19:47:49 +02:00
Riccardo Spagni
d3785066d0 Merge pull request #2791
5b452248 fixed easylogging compile issue on OpenBSD (Dyrcona)
2017-11-25 19:47:36 +02:00
Riccardo Spagni
d80a3e5c38 Merge pull request #2788
9739da1e wallet_rpc_server: new relay_tx command (moneromooo-monero)
01dc8297 wallet: transfer RPC can now return tx metadata (pending_tx) (moneromooo-monero)
83fa9047 serialization: add std::set and std::unordered_set serialization (moneromooo-monero)
2017-11-25 19:47:05 +02:00
Riccardo Spagni
5eb825b876 Merge pull request #2785
2d1ccc1b mnemonics: support for arbitrary (if multiple of 4 bytes) length data (moneromooo-monero)
2017-11-25 19:46:52 +02:00
Riccardo Spagni
7a6358408d Merge pull request #2846
be1c0129 fix for tx proof: use exception instead of error_str when signature gen failed (stoffu)
2017-11-25 19:46:07 +02:00
moneromooo-monero
9739da1e84 wallet_rpc_server: new relay_tx command
It takes a full tx+metadata hex string as input
2017-11-24 14:03:55 +00:00
moneromooo-monero
01dc829784 wallet: transfer RPC can now return tx metadata (pending_tx) 2017-11-24 14:03:52 +00:00
moneromooo-monero
83fa9047d8 serialization: add std::set and std::unordered_set serialization 2017-11-24 13:45:48 +00:00
moneromooo-monero
009eed17f1 rpc: increase the max number of outs one can request
It's getting hit too easily
2017-11-23 19:15:45 +00:00
ston1th
36b41ab2d1 added missing link for OpenBSD build instructions 2017-11-22 22:27:28 +01:00
moneromooo-monero
c0ae52c081 simplewallet: prevent (wrong) integrated adresses on accounts > 0 2017-11-22 16:20:11 +00:00
moneromooo-monero
631b35e7db CONTRIBUTING.md: mention git add -p as a way to avoid spurious changes 2017-11-22 13:30:11 +00:00
moneromooo-monero
54a4c1cbf7 cryptonote: do not overwrite const data 2017-11-22 11:17:22 +00:00
vdo
7256d9a7cd Fix versioning 2017-11-22 11:18:54 +01:00
moneromooo-monero
d875a9ff90 wallet2: detect multiple outputs from a tx to different subaddresses 2017-11-21 23:22:15 +00:00
stoffu
b0b7e0f09a Spend proof without txkey 2017-11-21 16:49:16 +09:00
stoffu
be1c01298a fix for tx proof: use exception instead of error_str when signature gen failed 2017-11-21 16:48:22 +09:00
vdo
e459d467f6 Update snap version to 0.11.1 2017-11-20 22:33:23 +01:00
Riccardo Spagni
49ce59462a Merge pull request #2783
416a7933 Print msg upon success for commands that were silent (binaryFate)
2017-11-20 12:09:02 +09:00
Riccardo Spagni
8d9e4920fc Merge pull request #2768
ef941855 Wallet RPC: Add prompt-for-password flag (Tim L)
2017-11-20 12:08:31 +09:00
Riccardo Spagni
72dfce861f Merge pull request #2487
998777ec Tx proof (revised): - refactoring: proof generation/checking code was moved from simplewallet.cpp to wallet2.cpp - allow an arbitrary message to be signed together with txid - introduce two types (outbound & inbound) of tx proofs; with the same syntax, inbound is selected when <address> belongs to this wallet, outbound otherwise. see GitHub thread for more discussion - wallet RPC: added get_tx_key, check_tx_key, get_tx_proof, check_tx_proof - wallet API: moved WalletManagerImpl::checkPayment to Wallet::checkTxKey, added Wallet::getTxProof/checkTxProof - get_tx_key/check_tx_key: handle additional tx keys by concatenating them into a single string (stoffu)
2017-11-20 12:07:24 +09:00
MoroccanMalinois
c256a248a5 Android dockerfile: add zmq dependency 2017-11-20 00:36:11 +00:00
Howard Chu
8198f031f3 Add mdb_drop tool 2017-11-19 19:48:01 +00:00
Gingeropolous
26ce640f82 Update README.md with info about release timelines
Added a heading in the readme that describes the release staging schedule and protocol.
2017-11-19 13:16:34 -05:00
moneromooo-monero
36f0538a0a cmake: fix building when readline is not found 2017-11-19 09:27:26 +00:00
ston1th
0b08bf3968 fixed common/util.cpp to link against libressl 2017-11-18 19:02:09 +01:00
stoffu
998777ecd7 Tx proof (revised):
- refactoring: proof generation/checking code was moved from simplewallet.cpp to wallet2.cpp
- allow an arbitrary message to be signed together with txid
- introduce two types (outbound & inbound) of tx proofs; with the same syntax, inbound is selected when <address> belongs to this wallet, outbound otherwise. see GitHub thread for more discussion
- wallet RPC: added get_tx_key, check_tx_key, get_tx_proof, check_tx_proof
- wallet API: moved WalletManagerImpl::checkPayment to Wallet::checkTxKey, added Wallet::getTxProof/checkTxProof
- get_tx_key/check_tx_key: handle additional tx keys by concatenating them into a single string
2017-11-18 20:44:27 +09:00
Bruno Clermont
e41cc58d7a Fix docker image dependencies, don't install libraries statically linked 2017-11-18 14:45:39 +08:00
Bruno Clermont
2ddbc3ef6e use make 2017-11-18 11:27:14 +08:00
Bruno Clermont
81ac0e91cb Force docker image to use --non-interactive 2017-11-18 11:22:45 +08:00
moneromooo-monero
310b790a64 make connection_id a string in RPC
It's sent as JSON, so raw binary is not appropriate
2017-11-18 00:13:07 +00:00
Tim L
23b6f685de RPC: allow binding of restricted port in addition to core port 2017-11-17 16:23:41 -05:00
Bruno Clermont
e03be11a0e fix and improve docker image, add doc for docker-compose 2017-11-17 21:51:22 +08:00
Cifrado
b0426d4cf2 Fixes #759 Add sanity check on restore height 2017-11-17 08:35:59 +01:00
0xB44EFD8751077F97
d73d7aca86 Add two configuration options to monerod.service:
Restart=always
    PrivateTmp=true
2017-11-16 11:58:18 -07:00
Tim L
f5461a6a07 RPC: CORS add Access-Control-Allow-Headers to OPTIONS preflight 2017-11-16 13:56:16 -05:00
moneromooo-monero
51895fd7df split wallet and wallet_api
This speeds up building a lot when wallet2.h (or something it
includes) changes, since all the API includes wallet2.h
2017-11-16 12:10:29 +00:00
moneromooo-monero
6cbe7bcdd2 wallet2: check generate_key_derivation return value 2017-11-16 10:31:47 +00:00
stoffu
6171238416 daemon & simplewallet: don't set max-concurrency when unspecified 2017-11-16 08:03:25 +09:00
iDunk5400
fdf0acbf97 Tools, daemonizer: fix building on Windows 2017-11-15 23:12:02 +01:00
Tim L
ef941855ae Wallet RPC: Add prompt-for-password flag 2017-11-15 13:21:55 -05:00
moneromooo-monero
0b726be703 wallet2: minimize the number of construct_tx calls 2017-11-15 18:01:35 +00:00
moneromooo-monero
9d505d26b8 wallet2: cleanup some debug logs 2017-11-15 18:01:32 +00:00
moneromooo-monero
ac5cd865b2 simplewallet: fix typo in incoming monero message 2017-11-15 17:52:37 +00:00
Michał Sałaban
0d149f708f Add out-of-bound exceptions and handle them in RPC 2017-11-15 16:35:14 +01:00
moneromooo-monero
93c3398503 simplewallet: translate ring size 0 to mixin 0 (default values)
Avoids turning it to a huge number
2017-11-15 15:07:10 +00:00
Riccardo Spagni
dc6a8014bd Merge pull request #2818
c4587e83 simplewallet: wrong ns for input_line in sweep_single (fix #2634) (stoffu)
2017-11-15 16:56:18 +02:00
stoffu
c4587e83f8 simplewallet: wrong ns for input_line in sweep_single (fix #2634) 2017-11-15 20:45:58 +09:00
moneromooo-monero
f493eabba7 unit_tests: fix running without --data-dir
While there, also use the new is_arg_defaulted API instead of
going to poke the internal API directly.
2017-11-15 10:45:14 +00:00
flozilla
f9fad18608 blockchain_db: sanity check on tx/hash vector sizes
It could trip on a corrupt/crafted file if the user has disabled
input verification.
2017-11-15 10:02:23 +00:00
Riccardo Spagni
cd070874bf Merge pull request #2778
c957795b fix output_stream_header memory leak (MaxXor)
2017-11-15 11:40:38 +02:00
Riccardo Spagni
3abd6f1fd0 Merge pull request #2773
ffe5b857 Correct totals computation (Michał Sałaban)
2017-11-15 11:24:08 +02:00
Riccardo Spagni
c9a410e394 Merge pull request #2772
5d92c7cc wallet2: typo fix in error message (moneromooo-monero)
2017-11-15 11:23:22 +02:00
Riccardo Spagni
5c2dfe157b Merge pull request #2771
e3e838d0 kaccak: remove unused return value (moneromooo-monero)
4877aca2 keccak: some paranoid "can't happen" checks (moneromooo-monero)
2017-11-15 11:22:56 +02:00
Riccardo Spagni
0d4d628805 Merge pull request #2634
b738f4b5 wallet: add sweep_single command (stoffu)
2017-11-15 11:17:01 +02:00
Riccardo Spagni
39bc39b86e Merge pull request #2628
7cb303a4 wallet2: simplify incoming tx processing code (moneromooo-monero)
2017-11-15 11:14:58 +02:00
stoffu
b738f4b59d wallet: add sweep_single command 2017-11-15 17:51:54 +09:00
Riccardo Spagni
2751a477d8 Merge pull request #2816
a17b8233 wallet2 bugfix: loading old m_unconfirmed_payments (stoffu)
2017-11-15 10:48:09 +02:00
stoffu
a17b8233da wallet2 bugfix: loading old m_unconfirmed_payments 2017-11-15 17:30:49 +09:00
Riccardo Spagni
0ddf3b6c75 Merge pull request #2814
987eb662 More missed readline dependencies thru scoped_message_writer (Howard Chu)
2017-11-15 00:47:28 +02:00
Howard Chu
987eb662bf More missed readline dependencies thru scoped_message_writer 2017-11-14 22:43:52 +00:00
Riccardo Spagni
e35162b366 Merge pull request #2813
29cee4ec Fix 383ff4f689 (Howard Chu)
b85e82bf Fix e89994e98f (Howard Chu)
95e784ad Fix 437421ce42 (Howard Chu)
2017-11-14 22:40:04 +02:00
Howard Chu
29cee4ec4f Fix 383ff4f689
Missed a crypto::null_pkey in PR#2629
2017-11-14 20:36:21 +00:00
Howard Chu
b85e82bf6a Fix e89994e98f
Missed an input_line() change
2017-11-14 20:34:32 +00:00
Howard Chu
95e784ad00 Fix 437421ce42
Missing an error argument for an exception
2017-11-14 20:29:05 +00:00
Riccardo Spagni
86a35eeed2 Merge pull request #2789
b0416f07 checkpoints: add a testnet checkpoint at 1000000 (moneromooo-monero)
2017-11-14 22:17:07 +02:00
Riccardo Spagni
0c4df51bbb Merge pull request #2765
fc85d7a9 simplewallet: fix in show_transfer passing wrong arg to wallet2::get_payments etc (stoffu)
2017-11-14 22:16:37 +02:00
Riccardo Spagni
6e92354284 Merge pull request #2774
a3ea62f2 CMake: include RPC when building GUI deps (anonimal)
2017-11-14 22:16:06 +02:00
anonimal
a3ea62f209 CMake: include RPC when building GUI deps 2017-11-14 19:45:58 +00:00
Riccardo Spagni
74b699beda Merge pull request #2812
9ac52127 unit_tests: fix build after wallet2 list/vector change (moneromooo-monero)
2017-11-14 21:33:38 +02:00
Riccardo Spagni
2c12847dd6 Merge pull request #2811
f80f408b epee: don't disable -Wtautological-constant-out-of-range-compare on GCC (moneromooo-monero)
2017-11-14 21:33:20 +02:00
Riccardo Spagni
10a237783a Merge pull request #2692
0f2c2d4c rpc: remove obsolete busy core checks (moneromooo-monero)
2017-11-14 21:32:33 +02:00
Riccardo Spagni
815e158bdf Merge pull request #2739
99f398a2 wallet2: avoid growing the short history when refreshing in a loop (moneromooo-monero)
2017-11-14 21:32:13 +02:00
Riccardo Spagni
edebe4e3b6 Merge pull request #2736
0d9c0db9 Do not build against epee_readline if it was not built (Howard Chu)
178014c9 split off readline code into epee_readline (moneromooo-monero)
a9e14a19 link against readline only for monerod and wallet-wallet-{rpc,cli} (moneromooo-monero)
437421ce wallet: move some scoped_message_writer calls from the libs (moneromooo-monero)
e89994e9 wallet: rejig to avoid prompting in wallet2 (moneromooo-monero)
ec5135e5 move input_line from command_line to simplewallet (moneromooo-monero)
082db75f move cryptonote command line options to cryptonote_core (moneromooo-monero)
2017-11-14 21:31:51 +02:00
Riccardo Spagni
922aaf4e2a Merge pull request #2644
a17efcb0 make this build on SunOS/Solaris (Pavel Maryanov)
2017-11-14 21:31:09 +02:00
Riccardo Spagni
41a8bf4f4c Merge pull request #2636
ad03f778 simplewallet: factor transfer related exception handling (moneromooo-monero)
2017-11-14 21:30:25 +02:00
Riccardo Spagni
5de492be40 Merge pull request #2629
383ff4f6 remove "using namespace std" from headers (moneromooo-monero)
2017-11-14 21:29:49 +02:00
moneromooo-monero
9ac5212775 unit_tests: fix build after wallet2 list/vector change 2017-11-14 18:30:58 +00:00
moneromooo-monero
f80f408b7e epee: don't disable -Wtautological-constant-out-of-range-compare on GCC
It's a CLANG only option, and causes GCC to error out
2017-11-14 17:22:39 +00:00
moneromooo-monero
0f2c2d4c34 rpc: remove obsolete busy core checks 2017-11-14 17:15:19 +00:00
moneromooo-monero
99f398a25e wallet2: avoid growing the short history when refreshing in a loop 2017-11-14 17:09:11 +00:00
Howard Chu
0d9c0db996 Do not build against epee_readline if it was not built 2017-11-14 17:06:37 +00:00
moneromooo-monero
178014c995 split off readline code into epee_readline 2017-11-14 17:06:35 +00:00
moneromooo-monero
a9e14a19dc link against readline only for monerod and wallet-wallet-{rpc,cli} 2017-11-14 17:06:32 +00:00
moneromooo-monero
437421ce42 wallet: move some scoped_message_writer calls from the libs 2017-11-14 17:06:29 +00:00
moneromooo-monero
e89994e98f wallet: rejig to avoid prompting in wallet2
wallet2 is a library, and should not prompt for stdin. Instead,
pass a function so simplewallet can prompt on stdin, and a GUI
might display a window, etc.
2017-11-14 17:06:26 +00:00
moneromooo-monero
ec5135e5b7 move input_line from command_line to simplewallet
It was only used there, and this removes one part of the common
dependency on libreadline
2017-11-14 17:06:23 +00:00
moneromooo-monero
082db75f28 move cryptonote command line options to cryptonote_core
Those have no reason to be in a generic module
2017-11-14 17:06:19 +00:00
Pavel Maryanov
a17efcb039 make this build on SunOS/Solaris 2017-11-14 17:03:48 +00:00
moneromooo-monero
ad03f77856 simplewallet: factor transfer related exception handling
This ensures they don't go out of sync when adding/changing them,
and makes the code easier to deal with.
2017-11-14 17:00:39 +00:00
moneromooo-monero
383ff4f689 remove "using namespace std" from headers
It's nasty, and actually breaks on Solaris, where if.h fails to
build due to:

  struct map *if_memmap;
2017-11-14 16:56:10 +00:00
stoffu
fc85d7a998 simplewallet: fix in show_transfer passing wrong arg to wallet2::get_payments etc 2017-11-15 00:25:17 +09:00
Riccardo Spagni
f48aeab5c4 Merge pull request #2756
0bf09154 Fix file permission issue (Tim L)
2017-11-14 16:02:28 +02:00
Riccardo Spagni
910218b14e Merge pull request #2755
d70515fc Used declared default refresh status as default rather than it's current value (Maxime THIEBAUT)
2017-11-14 15:57:25 +02:00
Riccardo Spagni
a2241e8151 Merge pull request #2753
fa514082 RPC: get_info add rpc_connections_count (Tim L)
2017-11-14 15:54:33 +02:00
Riccardo Spagni
68d5952f6a Merge pull request #2752
68c01782 updates: add a special case for "install-" build tags on windows (moneromooo-monero)
2017-11-14 15:49:53 +02:00
Riccardo Spagni
95c34e17cd Merge pull request #2750
424852a6 Fix 'sweep_all' command when called with no args (Leon Klingele)
2017-11-14 15:49:15 +02:00
Riccardo Spagni
a2b427b1bf Merge pull request #2749
f732e723 Disguise password length in prompt (Leon Klingele)
2017-11-14 15:35:47 +02:00
Riccardo Spagni
1e874186b3 Merge pull request #2747
37e1fd94 simplewallet: mark the active account in print_accounts (moneromooo-monero)
2017-11-14 15:32:29 +02:00
Riccardo Spagni
55603627c9 Merge pull request #2745
6cf33446 Remove wallet dependency on p2p (moneromooo-monero)
2017-11-14 15:31:40 +02:00
Riccardo Spagni
176dd1fbe5 Merge pull request #2743
9ff8e139 epee: disable a spurious warning for a storage function (moneromooo-monero)
2017-11-14 15:30:43 +02:00
Riccardo Spagni
0d0ce8c21e Merge pull request #2742
7c7d3672 Increase LMDB maxreaders if large number of threads in use (Howard Chu)
6738753b Use max_concurrency as-is (Howard Chu)
2017-11-14 15:30:03 +02:00
Riccardo Spagni
e0e6e375bb Merge pull request #2738
4a17f0c2 rpc: add performance timers (moneromooo-monero)
2017-11-14 15:28:47 +02:00
Riccardo Spagni
e759c78a17 Merge pull request #2735
a524b750 rpc: added miner_tx_hash to resp of getblock (stoffu)
2017-11-14 15:27:51 +02:00
Riccardo Spagni
90d78b825a Merge pull request #2730
ba1b89fb Updated OpenBSD build instructions and fixed libressl linking issue (ston1th)
2017-11-14 15:26:57 +02:00
Riccardo Spagni
29d77e5686 Merge pull request #2727
9d6c6c5d wallet2: do not bother downloading block hashes below last checkpoint (moneromooo-monero)
2017-11-14 15:21:58 +02:00
moneromooo-monero
7cb303a44b wallet2: simplify incoming tx processing code 2017-11-14 13:20:51 +00:00
Riccardo Spagni
25b97ee937 Merge pull request #2624
2677ade5 simplewallet: forbid 0 ring size (moneromooo-monero)
da8b60cb simplewallet: reject attempts to use too low mixin early (moneromooo-monero)
2017-11-14 15:20:45 +02:00
Riccardo Spagni
4754390725 Merge pull request #2720
110339f5 unit_tests: fix data dir determination (moneromooo-monero)
2017-11-14 15:16:23 +02:00
Riccardo Spagni
cdab85db41 Merge pull request #2701
867b67c4 Wallet API: override update subdir when built from src (Jaquee)
2017-11-14 15:15:25 +02:00
Riccardo Spagni
2458ff1a6d Merge pull request #2697
d269bff2 wallet2: use a vector, not a list, for selected_transfers (moneromooo-monero)
2017-11-14 15:14:07 +02:00
Riccardo Spagni
8df6b010eb Merge pull request #2696
937e7f8a Initialize openssl on startup (moneromooo-monero)
2017-11-14 15:13:44 +02:00
moneromooo-monero
2677ade502 simplewallet: forbid 0 ring size
It'd be interpreted as a huge one (~0 fake outs)
2017-11-14 13:12:42 +00:00
Riccardo Spagni
8d8032b4c6 Merge pull request #2691
f92f1606 core_tests: do not include chaingen_tests_list.h in all tests (moneromooo-monero)
2017-11-14 15:12:40 +02:00
moneromooo-monero
da8b60cbbf simplewallet: reject attempts to use too low mixin early
This yields a clear error message rather then some possibly
confusing more technical errors down the line
2017-11-14 13:12:39 +00:00
Riccardo Spagni
0c5872c869 Merge pull request #2686
21b9f6f3 always use core_tests for consistency, not coretests (moneromooo-monero)
2017-11-14 15:12:23 +02:00
Riccardo Spagni
6172248acf Merge pull request #2685
1ff638e9 protocol: drop connections which don't handshake after some time (moneromooo-monero)
2017-11-14 15:04:40 +02:00
Riccardo Spagni
f4fded6fcf Merge pull request #2683
105425b7 simplewallet: reject invalid argument for boolean parameter (stoffu)
2017-11-14 15:04:15 +02:00
Riccardo Spagni
f1ca1f35d1 Merge pull request #2682
8ddcf1e7 simplewallet: remove XMR mentions (moneromooo-monero)
2017-11-14 15:03:15 +02:00
Riccardo Spagni
48ff10f77f Merge pull request #2681
ec48e8d8 core: do not forbid txes without destination (moneromooo-monero)
523084bc core: don't add empty additional pub keys field to extra (moneromooo-monero)
2017-11-14 15:02:55 +02:00
Riccardo Spagni
256a1d9ead Merge pull request #2675
00cc1fdd subaddress: remove unneeded scalarmultBase (kenshi84)
2017-11-14 15:02:14 +02:00
Riccardo Spagni
5d52463b57 Merge pull request #2670
4fb77946 unit tests: OOB indexes & adding subaddress (Cole Lightfighter)
4fd6a3d2 Subaddress unit tests (Cole Lightfighter)
2017-11-14 15:01:49 +02:00
Riccardo Spagni
2ddb894607 Merge pull request #2661
ac4018a7 wallet2: workaround for lightwallet before supporting subaddress (followup #2656) (kenshi84)
2017-11-14 15:01:25 +02:00
Riccardo Spagni
474e02ccde Merge pull request #2651
118a1bed rpc: make get_coinbase_tx_sum a restricted RPC (moneromooo-monero)
2017-11-14 15:00:39 +02:00
Riccardo Spagni
9d481f57f9 Merge pull request #2645
6bab9efe debug utils: fix debug build: rm unused identifier (redfish)
b92d3f96 cmake: fix shared library build (redfish)
2017-11-14 15:00:00 +02:00
Riccardo Spagni
395025bb23 Merge pull request #2633
ad96c478 wallet-cli: added --generate-from-spend-key option (stoffu)
2017-11-14 14:56:07 +02:00
Riccardo Spagni
94b85b450b Merge pull request #2630
0aa4cc80 ITS#8339 Solaris 10/11 robust mutex fixes (Howard Chu)
2017-11-14 14:55:14 +02:00
Riccardo Spagni
f26e7a84a6 Merge pull request #2620
6bd4dac6 util: ignore SIGPIPE (moneromooo-monero)
2017-11-14 14:54:42 +02:00
Riccardo Spagni
9317c9c57e Merge pull request #2617
7dbf76d0 Fix an object lifetime bug in net load tests (moneromooo-monero)
2017-11-14 14:54:05 +02:00
Riccardo Spagni
fd0740e5e7 Merge pull request #2615
10013e94 Protect node privacy by proper filtering in restricted-mode RPC answers (binaryFate)
2017-11-14 14:53:10 +02:00
Riccardo Spagni
3fff292dc1 Merge pull request #2509
ccf53a56 track double spending in the txpool (moneromooo-monero)
2017-11-14 14:50:03 +02:00
Riccardo Spagni
0fa3c27869 Merge pull request #2805
78cf010e Add stoffu's GPG key (stoffu)
2017-11-14 14:08:41 +02:00
moneromooo-monero
43f27c7d43 core: warn when free disk space is low 2017-11-14 10:21:34 +00:00
binaryFate
da706b6102 Fix false GCC warning '‘*((void*)& subaddr_account +4)’ may be used unitialized' 2017-11-14 09:45:43 +01:00
stoffu
78cf010e4e Add stoffu's GPG key 2017-11-14 16:34:37 +09:00
stoffu
105425b7f6 simplewallet: reject invalid argument for boolean parameter 2017-11-14 16:33:17 +09:00
stoffu
a524b7508e rpc: added miner_tx_hash to resp of getblock 2017-11-14 16:31:46 +09:00
stoffu
ad96c478b1 wallet-cli: added --generate-from-spend-key option 2017-11-14 16:30:59 +09:00
moneromooo-monero
d269bff2ab wallet2: use a vector, not a list, for selected_transfers
Friendlier on memory/speed, we know in advance the max amount
of items, which are small and constant size, and there's a lot
of list walking involved.
2017-11-13 19:36:18 +00:00
moneromooo-monero
7e387fb1ad wallet2: only add a dummy 0 output if there's one output otherwise 2017-11-13 14:08:10 +00:00
binaryFate
b42ee213e8 Wallet: update ring size in outdated error msgs with set_default_ring_size 2017-11-13 09:53:18 +01:00
Dyrcona
5b452248a8 fixed easylogging compile issue on OpenBSD
Issue: #2575
Add ELPP_OS_OPENBSD macros to easylogging++.h so that it will build on
OpenBSD.
2017-11-12 00:56:07 +01:00
Vasil Dimov
47c0948ab0 Implement missing miner functions on FreeBSD
cryptonote::miner::get_system_times(): Fetch the system's total and
idle time using sysctl kern.cp_time.

cryptonote::miner::get_process_time(): Use the same implementation as
Linux and OSX, the times(3) function conforms to POSIX.1 and is
available on FreeBSD.

cryptonote::miner::on_battery_power(): Try to fetch the battery status
using sysctl hw.acpi.acline. If that fails (if ACPI is not enabled on
the system), then try querying /dev/apm.
2017-11-11 16:27:19 +02:00
Vasil Dimov
fdb5bd161d Remove unused variables and fix typos in comments 2017-11-11 16:17:19 +02:00
Vasil Dimov
3501ed1fdf Do not require libatomic on FreeBSD
f3e09f36 hooked a dependency on libatomic on 32 bit machines if Clang is
used because compilation failed with:

`std::__atomic_base<unsigned long long>::load(std::memory_order) const':
/usr/bin/../lib/gcc/i686-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/atomic_base.h:396:
undefined reference to `__atomic_load_8'

But that does not happen on FreeBSD. The problem is likely that on Linux
Clang tries to use GCC-provided C++11 library. Further,
__atomic_load_8() (for 8-byte integers) is not readily available on 32
bit machines. From https://gcc.gnu.org/wiki/Atomic/GCCMM: "When lock
free instructions are not available (either through hardware or OS
support) atomic operations are left as function calls to be resolved by
a library."
2017-11-11 15:29:42 +02:00
moneromooo-monero
e3e838d0cf kaccak: remove unused return value 2017-11-11 11:20:48 +00:00
moneromooo-monero
b0416f070e checkpoints: add a testnet checkpoint at 1000000
Makes working on testnet a lot easier (much less I/O when loading
and saving wallets, and exercises the hashchain code before any
changes are merged)
2017-11-11 11:16:48 +00:00
binaryFate
416a793326 Print msg upon success for commands that were silent 2017-11-10 09:42:40 +01:00
Riccardo Spagni
af448d3883 Merge pull request #2694
11e0deef cmake: add dep of version lib on version.cpp (redfish)
35340259 .gitignore: do not ignore cmake source files (redfish)
2017-11-09 18:22:25 +02:00
moneromooo-monero
2d1ccc1b88 mnemonics: support for arbitrary (if multiple of 4 bytes) length data 2017-11-09 10:58:10 +00:00
MaxXor
c957795bfa fix output_stream_header memory leak 2017-11-08 19:59:09 +01:00
binaryFate
10013e9434 Protect node privacy by proper filtering in restricted-mode RPC answers
This patch allows to filter out sensitive information for queries that rely on the pool state, when running in restricted mode.
This filtering is only applied to data sent back to RPC queries. Results of inline commands typed locally in the daemon are not affected.
In practice, when running with `--restricted-rpc`:
* get_transaction_pool will list relayed transactions with the fields "last relayed time" and "received time" set to zero.
* get_transaction_pool will not list transaction that have do_not_relay set to true, and will not list key images that are used only for such transactions
* get_transaction_pool_hashes.bin will not list such transaction
* get_transaction_pool_stats will not count such transactions in any of the aggregated values that are computed

The implementation does not make filtering the default, so developers should be mindful of this if they add new RPC functionality.
Fixes #2590.
2017-11-08 13:07:07 +01:00
Michał Sałaban
ffe5b857e1 Correct totals computation 2017-11-08 12:09:50 +01:00
Tim L
fa51408272 RPC: get_info add rpc_connections_count 2017-11-07 16:34:49 -05:00
Riccardo Spagni
a2c2f4e4b0 Merge pull request #2764
37c3792b wallet2 bugfix: supply missing subaddr_account arg to balance() and unlocked balance() (stoffu)
2017-11-07 19:14:40 +02:00
moneromooo-monero
5d92c7ccf6 wallet2: typo fix in error message 2017-11-07 14:04:40 +00:00
moneromooo-monero
4877aca2b6 keccak: some paranoid "can't happen" checks 2017-11-07 14:02:37 +00:00
stoffu
37c3792b00 wallet2 bugfix: supply missing subaddr_account arg to balance() and unlocked balance() 2017-11-06 10:15:38 +09:00
moneromooo-monero
ccf53a566c track double spending in the txpool
Transactions in the txpool are marked when another transaction
is seen double spending one or more of its inputs.
This is then exposed wherever appropriate.

Note that being marked with this "double spend seen" flag does
NOT mean this transaction IS a double spend and will never be
mined: it just means that the network has seen at least another
transaction spending at least one of the same inputs, so care
should be taken to wait for a few confirmations before acting
upon that transaction (ie, mostly of use for merchants wanting
to accept unconfirmed transactions).
2017-11-06 00:05:44 +00:00
Riccardo Spagni
3dd31d33fa Merge pull request #2605
b370ef54 Wallet: Descriptions through new commands 'set_description', 'get_description' (rbrunner7)
2017-11-06 01:56:06 +02:00
Riccardo Spagni
f960ef9454 Merge pull request #2595
8041b4e9 wallet-cli: allow priority argument for sweep_all and donate (stoffu)
2017-11-06 01:55:15 +02:00
Riccardo Spagni
7452359d8f Merge pull request #2591
93ad1f87 Fix #2559: more flexible print_tx daemon command (binaryFate)
2017-11-06 01:54:48 +02:00
Riccardo Spagni
32b083d8bd Merge pull request #2546
b2d416f2 Distinguish "not enough money" and "not enough unlocked money" (binaryFate)
2017-11-06 01:53:43 +02:00
Riccardo Spagni
9d65a9cc98 Merge pull request #2483
ff7745bb Edited test readme for accuracy and depth (Cole Lightfighter)
c300ae56 Added test documentation & Keccak unit test (Cole Lightfighter)
f6119a8e Added test documentation & Keccak unit test (Cole Lightfighter)
2017-11-06 01:52:08 +02:00
Riccardo Spagni
4022a0a57e Merge pull request #2729
161401dd Fix JSON-RPC response object over ZMQ (Lee Clagett)
2017-11-06 01:42:55 +02:00
stoffu
8041b4e901 wallet-cli: allow priority argument for sweep_all and donate 2017-11-04 12:11:04 +09:00
Tim L
0bf0915446 Fix file permission issue
This branch fixes a file permission issue introduced by 69c37200aa
2017-11-03 11:27:50 -04:00
Maxime THIEBAUT
d70515fca4 Used declared default refresh status as default rather than it's current value 2017-11-03 16:15:02 +01:00
Riccardo Spagni
13a84caa22 Merge pull request #2662
88ebfd64 core_tests: fix for subaddress patch (kenshi84)
e373a203 performance_tests: add master spend pubkey to subaddress hashtable (kenshi84)
2017-11-03 11:58:06 +02:00
moneromooo-monero
68c0178220 updates: add a special case for "install-" build tags on windows
Those will have a ".exe" file extension, not .zip.
2017-11-03 09:45:08 +00:00
Leon Klingele
424852a627 Fix 'sweep_all' command when called with no args
Executing 'sweep_all' with no arguments segfaulted before.
2017-11-03 04:52:26 +01:00
Leon Klingele
f732e723b7 Disguise password length in prompt 2017-11-03 04:04:54 +01:00
moneromooo-monero
37e1fd94d5 simplewallet: mark the active account in print_accounts 2017-11-02 23:46:12 +00:00
Howard Chu
7c7d36725a Increase LMDB maxreaders if large number of threads in use 2017-11-02 16:33:48 +00:00
Howard Chu
6738753b30 Use max_concurrency as-is
Don't try to 2nd guess user
2017-11-02 16:33:48 +00:00
moneromooo-monero
6cf3344605 Remove wallet dependency on p2p 2017-11-02 16:13:24 +00:00
Riccardo Spagni
4146f2e202 Merge pull request #2666
8233a24b unit_tests: fix build on windows (moneromooo-monero)
2017-11-02 11:44:36 +02:00
Riccardo Spagni
ef3c77117a Merge pull request #2689
6a90506a Link against libpgm/libnorm if found, optional libzmq ldependencies (moneromooo-monero)
2017-11-01 11:26:22 +02:00
Riccardo Spagni
35dbb3be33 Merge pull request #2663
4b228dd3 cmake: epee: use var from FindOpenSSL.cmake (redfish)
29497f79 epee: use boost type for SSL error code (redfish)
2017-11-01 11:25:53 +02:00
Riccardo Spagni
32b46c594b Merge pull request #2703
d0463312 fix libwallet api test after api change (Jaquee)
a46c1eed Wallet2: Don't throw when subaddress label doesn't exist (Jaquee)
086b7db2 Wallet API: default values for account and subaddr index (Jaquee)
2017-11-01 11:24:54 +02:00
Riccardo Spagni
1648c1d466 Merge pull request #2659
52c13810 blockchain_utilities: Add monero-blockchain-{ex,im}port binaries to default install targets (Bertrand Jacquin)
2017-10-31 20:42:48 +02:00
Riccardo Spagni
9b5e2ceb40 Merge pull request #2684
66255c0e Problem: Copyright notice is very confusing (Gareth)
2017-10-31 20:41:45 +02:00
Riccardo Spagni
54463b33b3 Merge pull request #2723
69c37200 RPC Add cross origin resource sharing support (Tim L)
2017-10-31 20:38:38 +02:00
Riccardo Spagni
5ef9c69ef5 Merge pull request #2711
fab3b722 Add more specific RPC error codes (Michał Sałaban)
2017-10-31 20:35:41 +02:00
Riccardo Spagni
00270dd279 Merge pull request #2737
935f7462 blockchain: do not lock the blockchain lock for simple DB getters (moneromooo-monero)
2017-10-31 20:34:22 +02:00
Riccardo Spagni
c97fbb0176 Merge pull request #2718
626e8078 wallet2: fix show_transfers missing multiple incoming outputs (moneromooo-monero)
2017-10-31 20:33:44 +02:00
Riccardo Spagni
3fe07603e4 Merge pull request #2705
44f14638 wallet2: fix tx size estimator for large number of inputs (moneromooo-monero)
2017-10-31 20:33:19 +02:00
Riccardo Spagni
75ad92c82c Merge pull request #2702
f946bb7b fixed an LMDB issue on OpenBSD (#2699) which leads to a crash in monerod (ston1th)
2017-10-31 20:31:42 +02:00
Riccardo Spagni
0e15653536 Merge pull request #2687
969b5a2a net_helper: fix massive slowdown after SSL support (moneromooo-monero)
2017-10-31 20:30:36 +02:00
Riccardo Spagni
784f7b07f0 Merge pull request #2660
4dd05a2f subaddress: change prefix so that it starts with 8 (kenshi84)
2017-10-31 20:28:00 +02:00
Riccardo Spagni
6d1562d94c Merge pull request #2715
ca87cbd8 wallet2: fix subaddress fields serialization (moneromooo-monero)
2017-10-31 20:25:40 +02:00
moneromooo-monero
9d6c6c5dec wallet2: do not bother downloading block hashes below last checkpoint 2017-10-31 10:29:54 +00:00
Tim L
69c37200aa RPC Add cross origin resource sharing support 2017-10-30 13:55:56 -04:00
moneromooo-monero
4a17f0c2c7 rpc: add performance timers
Enable with perf:DEBUG
2017-10-30 09:39:36 +00:00
moneromooo-monero
935f746249 blockchain: do not lock the blockchain lock for simple DB getters
It is safe in those cases, though might return slightly out of date
information if another thread is busy modifying the blockchain,
but it avoids potentially lengthy delays just to get things like
the current blockchain height.
2017-10-30 08:23:40 +00:00
Jaquee
d04633121b fix libwallet api test after api change 2017-10-29 15:26:23 +01:00
Jaquee
a46c1eed8c Wallet2: Don't throw when subaddress label doesn't exist 2017-10-29 15:26:22 +01:00
Jaquee
867b67c4fd Wallet API: override update subdir when built from src 2017-10-29 15:17:31 +01:00
moneromooo-monero
9ff8e139cd epee: disable a spurious warning for a storage function 2017-10-28 11:52:14 +01:00
ston1th
ba1b89fbb7 Updated OpenBSD build instructions and fixed libressl linking issue
Issue: #2575

Build instructions for OpenBSD 6.2:
* boost (built with clang)
* cppzmq

Fixed a issue, where cmake was not able to find and link against libressl in unbound.

restored OpenBSD 5.8 build instructions
2017-10-27 18:18:18 +02:00
Lee Clagett
161401ddca Fix JSON-RPC response object over ZMQ 2017-10-26 17:25:14 -04:00
ston1th
f946bb7be6 fixed an LMDB issue on OpenBSD (#2699) which leads to a crash in monerod 2017-10-26 17:16:06 +02:00
moneromooo-monero
110339f553 unit_tests: fix data dir determination 2017-10-24 10:22:46 +01:00
moneromooo-monero
626e80780b wallet2: fix show_transfers missing multiple incoming outputs 2017-10-23 14:38:07 +01:00
moneromooo-monero
ca87cbd852 wallet2: fix subaddress fields serialization
When loading an older wallet cache, they wouldn't be initialized,
leading them to have random(ish) values, and so assigned to some
random subaddress.
2017-10-23 11:53:49 +01:00
Michał Sałaban
fab3b7221b Add more specific RPC error codes 2017-10-23 04:27:02 +02:00
moneromooo-monero
44f1463867 wallet2: fix tx size estimator for large number of inputs 2017-10-22 19:46:07 +01:00
moneromooo-monero
1ff638e927 protocol: drop connections which don't handshake after some time 2017-10-22 19:45:30 +01:00
Jaquee
086b7db2c7 Wallet API: default values for account and subaddr index 2017-10-22 18:15:23 +02:00
moneromooo-monero
937e7f8aa6 Initialize openssl on startup 2017-10-21 10:17:18 +01:00
moneromooo-monero
6a90506a8d Link against libpgm/libnorm if found, optional libzmq ldependencies 2017-10-21 08:39:52 +01:00
redfish
11e0deef31 cmake: add dep of version lib on version.cpp
Also, move cmake source files into cmake/ to keep them together.
2017-10-20 22:07:34 -04:00
redfish
353402595c .gitignore: do not ignore cmake source files 2017-10-20 22:05:41 -04:00
moneromooo-monero
f92f160674 core_tests: do not include chaingen_tests_list.h in all tests
This fixes all tests being annoyingly rebuilt when one changes
2017-10-20 18:53:43 +01:00
moneromooo-monero
969b5a2ae3 net_helper: fix massive slowdown after SSL support 2017-10-20 17:27:15 +01:00
Cole Lightfighter
4fb7794651 unit tests: OOB indexes & adding subaddress
Tests for checking proper error throwing for out-of-bounds subaddress
indexes, and proper addition of subaddresses.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
2017-10-19 20:33:58 -06:00
moneromooo-monero
21b9f6f3c7 always use core_tests for consistency, not coretests
Other tests use unit_tests, performance_tests, etc.
This fixes getting it wrong half the time when typing.
2017-10-19 23:11:29 +01:00
Gareth
66255c0ea1 Problem: Copyright notice is very confusing
Solution: add line break to copyright notice and fix grammar.
2017-10-19 21:21:52 +08:00
moneromooo-monero
8ddcf1e714 simplewallet: remove XMR mentions
They are actually wrong if the wallet is setup in a different
denomination, and it's incursion of extrinsic lingo where monero
fits perfectly in the first place.
2017-10-19 13:10:29 +01:00
moneromooo-monero
ec48e8d81d core: do not forbid txes without destination
This was spuriously forbidden in the recent subaddress patch,
which isn't inherently incompatible with these.
2017-10-19 09:11:12 +01:00
moneromooo-monero
523084bc79 core: don't add empty additional pub keys field to extra
Saves a couple bytes per tx
2017-10-19 09:11:10 +01:00
kenshi84
00cc1fdd22 subaddress: remove unneeded scalarmultBase 2017-10-18 08:46:00 +09:00
redfish
4b228dd356 cmake: epee: use var from FindOpenSSL.cmake
This fixes linking when path to openssl
is defined manually:
cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0;/usr/lib/openssl-1.0' ...

This is useful for building with OpenSSL v1.0
when default system installation is v1.1.

The linking error is undefined SSL_load_error_strings symbol.
This is due to -L /usr/lib/openssl-1.0 not making it onto
the linkline (so -lssl pulls in the default system openssl).
2017-10-17 16:13:07 -04:00
redfish
29497f7920 epee: use boost type for SSL error code
Fixes compile error when building with OpenSSL v1.1:

contrib/epee/include/net/net_helper.h: In member function ‘void epee::net_utils::blocked_mode_client::shutdown_ssl()’:
contrib/epee/include/net/net_helper.h:579:106: error: ‘SSL_R_SHORT_READ’ was not declared in this scope
    if (ec.category() == boost::asio::error::get_ssl_category() && ec.value() != ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ))
                                                                                                          ^
contrib/epee/include/net/net_helper.h:579:106: note: suggested alternative: ‘SSL_F_SSL_READ’

See boost/asio/ssl/error.hpp.
Boost handles differences between OpenSSL versions.

cmake: fail if Boost is too old for OpenSSL v1.1
2017-10-17 16:12:58 -04:00
Cole Lightfighter
4fd6a3d27f Subaddress unit tests
Basic unit test fixture, and initialization of a subaddress account.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
2017-10-17 10:59:53 -06:00
kenshi84
88ebfd646a core_tests: fix for subaddress patch 2017-10-17 22:29:01 +09:00
rbrunner7
b370ef54b9 Wallet: Descriptions through new commands 'set_description', 'get_description' 2017-10-16 22:24:09 +02:00
binaryFate
b2d416f211 Distinguish "not enough money" and "not enough unlocked money"
Fix #1530
2017-10-16 15:14:09 +02:00
moneromooo-monero
8233a24ba8 unit_tests: fix build on windows
Reported by iDunk on IRC
2017-10-16 09:37:51 +01:00
kenshi84
e373a2037b performance_tests: add master spend pubkey to subaddress hashtable 2017-10-16 13:08:44 +09:00
kenshi84
ac4018a7e6 wallet2: workaround for lightwallet before supporting subaddress (followup #2656) 2017-10-16 12:03:09 +09:00
kenshi84
4dd05a2f9b subaddress: change prefix so that it starts with 8 2017-10-16 10:35:59 +09:00
Bertrand Jacquin
52c1381049 blockchain_utilities: Add monero-blockchain-{ex,im}port binaries to
default install targets

Binaries available to download on https://getmonero.org/downloads/ as
embedding monerod, monero-wallet-{cli,rpc} and
monero-blockchain-{ex,im}port.

This change synchronise download results with a manual build from
source
2017-10-15 22:19:38 +01:00
Riccardo Spagni
8d511f3c24 Merge pull request #2601
4d35ad76 Fix compiler warnings with Clang 6.0.0. (Vasil Dimov)
2017-10-15 21:36:36 +02:00
Vasil Dimov
4d35ad7603 Fix compiler warnings with Clang 6.0.0.
monero/src/cryptonote_protocol/block_queue.cpp:208:44: error:
      suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  static const boost::uuids::uuid uuid0 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                           {                                          }

monero/src/wallet/wallet_rpc_server.cpp:1895:43: error:
      lambda capture 'wal' is not used [-Werror,-Wunused-lambda-capture]
  tools::signal_handler::install([&wrpc, &wal](int) {
                                          ^

monero/src/cryptonote_protocol/cryptonote_protocol_handler.inl:1616:40: error:
      lambda capture 'arg' is not used [-Werror,-Wunused-lambda-capture]
    m_p2p->for_each_connection([this, &arg, &fluffy_arg, &exclude_context, &fullConnections...
                                       ^

monero/src/cryptonote_protocol/cryptonote_protocol_handler.inl:1616:46: error:
      lambda capture 'fluffy_arg' is not used [-Werror,-Wunused-lambda-capture]
    m_p2p->for_each_connection([this, &arg, &fluffy_arg, &exclude_context, &fullConnections...
                                             ^

monero/src/blockchain_utilities/blockchain_export.cpp:181:3: error:
      bool literal returned from 'main' [-Werror,-Wmain]
  CHECK_AND_ASSERT_MES(r, false, "Failed to initialize source blockchain storage");
  ^                       ~~~~~
monero/contrib/epee/include/misc_log_ex.h:180:97: note:
      expanded from macro 'CHECK_AND_ASSERT_MES'
  ...fail_ret_val, message)   do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0)
                                                                  ^      ~~~~~~~~~~~~
monero/src/blockchain_utilities/blockchain_export.cpp:195:3: error:
      bool literal returned from 'main' [-Werror,-Wmain]
  CHECK_AND_ASSERT_MES(r, false, "Failed to export blockchain raw data");
  ^                       ~~~~~
monero/contrib/epee/include/misc_log_ex.h:180:97: note:
      expanded from macro 'CHECK_AND_ASSERT_MES'
  ...fail_ret_val, message)   do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0)
                                                                  ^      ~~~~~~~~~~~~
2017-10-15 22:02:24 +03:00
Riccardo Spagni
48af25ed83 Merge pull request #2658
fddd8d22 performance_tests: fix build after subaddress patch (moneromooo-monero)
2017-10-15 21:01:20 +02:00
moneromooo-monero
fddd8d226f performance_tests: fix build after subaddress patch 2017-10-15 19:58:53 +01:00
Riccardo Spagni
da1bb4b0af Merge pull request #2657
52ec0e7f epee: link against ssl/crypto for the new SSL code (moneromooo-monero)
2017-10-15 20:13:53 +02:00
moneromooo-monero
52ec0e7f4e epee: link against ssl/crypto for the new SSL code 2017-10-15 19:11:34 +01:00
Riccardo Spagni
97c11caf07 Merge pull request #2656
3492de01 fix lightwallet and subaddresses conflict (Jaquee)
329f149e remove reference to cryptonote::null_hash (Jaquee)
2017-10-15 19:32:18 +02:00
Jaquee
3492de010b fix lightwallet and subaddresses conflict 2017-10-15 19:19:40 +02:00
Jaquee
329f149e95 remove reference to cryptonote::null_hash 2017-10-15 19:19:40 +02:00
Riccardo Spagni
b293ad9a1a Merge pull request #2640
22b51e06 db_lmdb: include chain height when failing to find an output key (moneromooo-monero)
5db433b3 blockchain: avoid exceptions in output verification (moneromooo-monero)
2017-10-15 18:59:45 +02:00
Riccardo Spagni
344c01c712 Merge pull request #2638
529a6a4a core: guard against a mined block not finding all txes in the pool (moneromooo-monero)
2017-10-15 18:58:57 +02:00
Riccardo Spagni
845afb5191 Merge pull request #2613
2051f89f cmake: build tests last (redfish)
2017-10-15 18:58:31 +02:00
Riccardo Spagni
b4126266d4 Merge pull request #2610
44c1d160 unit_tests: fix compiling on Windows (iDunk5400)
2017-10-15 18:54:32 +02:00
Riccardo Spagni
6159a83175 Merge pull request #2608
fe484f30 unit_tests: data dir is now overridden with --data-dir (moneromooo-monero)
2017-10-15 18:54:16 +02:00
Riccardo Spagni
73f0c16743 Merge pull request #2606
4090e8c6 simplewallet: add get/set for refresh-from-height (moneromooo-monero)
2017-10-15 18:51:11 +02:00
Riccardo Spagni
d5ab55b8d7 Merge pull request #2604
0a872798 protocol: kick idle peers by dropping them (moneromooo-monero)
2017-10-15 18:50:32 +02:00
Riccardo Spagni
f1bee553b1 Merge pull request #2602
bc1b9333 frob level 1 logs a bit for consistency (moneromooo-monero)
2017-10-15 18:49:48 +02:00
Riccardo Spagni
62d2a55719 Merge pull request #2600
885c773a cmake: print which stack trace lib is used (redfish)
2017-10-15 18:49:11 +02:00
Riccardo Spagni
f484b162db Merge pull request #2599
b776c725 daemon: use @N syntax to output_histogram for specific amounts (moneromooo-monero)
2017-10-15 18:48:19 +02:00
Riccardo Spagni
e50bf5f811 Merge pull request #2597
c4136134 miner: always update block template when starting (moneromooo-monero)
2017-10-15 18:47:43 +02:00
Riccardo Spagni
5c3275ddbe Merge pull request #2596
06fb9bcf wallet2: fix refresh height calc for new wallets (moneromooo-monero)
2017-10-15 18:47:16 +02:00
Riccardo Spagni
71253c1dcd Merge pull request #2592
dc19659d Remove network_address_base which has been merged with ipv4_network_address in 8b006877 (Michał Sałaban)
2183ade0 Don't try to create wallet-dir when it's not given, don't crash if wallet-dir already exists. (Michał Sałaban)
2017-10-15 18:39:13 +02:00
Riccardo Spagni
1280ba4f5b Merge pull request #2589
8f0cea63 add a command_line function to check for defaulted options (moneromooo-monero)
2017-10-15 18:38:46 +02:00
Riccardo Spagni
3eac7ab94f Merge pull request #2587
cba34494 rpc: out_peers now works again (moneromooo-monero)
2017-10-15 18:38:12 +02:00
Riccardo Spagni
50f0c1f0e0 Merge pull request #2586
7b8d3ec6 wallet-cli: add --do-not-relay option (stoffu)
2017-10-15 18:37:38 +02:00
Riccardo Spagni
1740f0a13e Merge pull request #2583
27fdaaa4 Fix building with -DARCH=default -DNO_AES=ON (moneromooo-monero)
2017-10-15 18:37:14 +02:00
Riccardo Spagni
cb9b1fcc94 Merge pull request #2582
240f769d tests: add sha256sum unit test (moneromooo-monero)
2017-10-15 18:36:38 +02:00
Riccardo Spagni
6ad660a82e Merge pull request #2578
e6636577 Add needed dependencies (Emilien Devos)
2017-10-15 18:36:05 +02:00
Riccardo Spagni
147ecb6b7a Merge pull request #2573
7e7acdc3 daemon: catch out of range exceptions too when calling stoll/stoi (moneromooo-monero)
2017-10-15 18:34:48 +02:00
Riccardo Spagni
1e577e8fbf Merge pull request #2571
8028dde7 block_queue: use boost::uuids::nil_uuid where appropriate (moneromooo-monero)
2017-10-15 18:34:26 +02:00
Riccardo Spagni
27ed7419bb Merge pull request #2570
f139a6ca wallet2: fix backlog being off by 1 (moneromooo-monero)
2017-10-15 18:33:51 +02:00
Riccardo Spagni
1039b5e813 Merge pull request #2569
b5b4abb8 simplewallet: fix setting default-ring-size to 0 (moneromooo-monero)
2017-10-15 18:32:41 +02:00
Riccardo Spagni
c45f3ac4d9 Merge pull request #2568
7130cf0c Add tools::on_startup, and warn about glibc 2.25 bug if found (moneromooo-monero)
2017-10-15 18:32:09 +02:00
Riccardo Spagni
2babd2e0a3 Merge pull request #2567
54940d8c blockchain_import: remove a few commented out obsolete lines (moneromooo-monero)
2017-10-15 18:29:18 +02:00
Riccardo Spagni
1c546e0d81 Merge pull request #2565
452d4fae tests: fix hashchain unit tests (moneromooo-monero)
2017-10-15 18:27:08 +02:00
Riccardo Spagni
51bfdfb674 Merge pull request #2556
acc186eb README: Add package installation instructions for Void Linux (Helmut Pozimski)
2017-10-15 18:26:46 +02:00
Riccardo Spagni
960886aa04 Merge pull request #2109
97c2e449 wallet2+API: use separate callbacks for lightwallets (Jaquee)
d9261867 walletAPI: correct confirmations in txHistory for unsynced wallets (Jaquee)
9442b043 walletAPI: lightwallet exceptions (Jaquee)
fc922934 walletAPI: add lightwallet login() and importWalletRequest() (Jaquee)
79207743 walletAPI: init() lightwallet and SSL support (Jaquee)
dde5a1fc walletAPI: add tx unlock_time (Jaquee)
bba5cbed wallet2: remove obsolete get_num_rct_outputs() call from create_transactions_2 (Jaquee)
7a482f30 wallet2: create_transactions_2 lightwallet support (Jaquee)
ce61b818 wallet2: get_outs lightwallet support (Jaquee)
1197cb71 wallet2: commit_tx() lightwallet support (Jaquee)
43b57804 wallet2: refactor is_tx_spendtime_unlocked() (Jaquee)
32e2b003 wallet2: add lightwallet exceptions to common functions (Jaquee)
2e692fc0 wallet2: refresh() lightwallet support (Jaquee)
f44d156c my/openmonero API functions (Jaquee)
288d3c75 wallet2: add remove_obsolete_pool_txs() (Jaquee)
2c6aad7e wallet2: add on_pool_tx_removed callback (Jaquee)
ff7c30aa wallet2: light wallet member variables (Jaquee)
e2a276cb wallet2: add ssl option to init() (Jaquee)
a13540be add string_tools::validate_hex() (Jaquee)
fd773d88 refactor cryptonote_basic::add_tx_pub_key_to_extra (Jaquee)
8bfa6c2d lightwallet rpc server commands (Jaquee)
76961ddc Serializer: string to integer conversion for MyMonero compatibility (Jaquee)
1cf940f2 epee http_client SSL support (Jaquee)
eec10137 CMakeLists.txt - Add openssl include dir (Jaquee)
2017-10-15 18:25:08 +02:00
Jaquee
97c2e449ce wallet2+API: use separate callbacks for lightwallets 2017-10-15 17:58:28 +02:00
Jaquee
d92618675b walletAPI: correct confirmations in txHistory for unsynced wallets 2017-10-15 17:58:28 +02:00
Jaquee
9442b04302 walletAPI: lightwallet exceptions 2017-10-15 17:57:45 +02:00
Jaquee
fc9229342d walletAPI: add lightwallet login() and importWalletRequest() 2017-10-15 17:57:43 +02:00
Jaquee
79207743b8 walletAPI: init() lightwallet and SSL support 2017-10-15 17:56:35 +02:00
Jaquee
dde5a1fc36 walletAPI: add tx unlock_time 2017-10-15 17:54:17 +02:00
Jaquee
bba5cbed8f wallet2: remove obsolete get_num_rct_outputs() call from create_transactions_2 2017-10-15 17:54:14 +02:00
Jaquee
7a482f302b wallet2: create_transactions_2 lightwallet support 2017-10-15 17:51:20 +02:00
Jaquee
ce61b8189b wallet2: get_outs lightwallet support 2017-10-15 17:50:03 +02:00
Jaquee
1197cb71e9 wallet2: commit_tx() lightwallet support 2017-10-15 17:48:45 +02:00
Jaquee
43b57804f8 wallet2: refactor is_tx_spendtime_unlocked() 2017-10-15 17:48:45 +02:00
Jaquee
32e2b0030e wallet2: add lightwallet exceptions to common functions 2017-10-15 17:48:41 +02:00
Jaquee
2e692fc05a wallet2: refresh() lightwallet support 2017-10-15 17:42:50 +02:00
Jaquee
f44d156cbd my/openmonero API functions 2017-10-15 17:42:29 +02:00
Jaquee
288d3c75c3 wallet2: add remove_obsolete_pool_txs() 2017-10-15 17:39:54 +02:00
Jaquee
2c6aad7ea7 wallet2: add on_pool_tx_removed callback 2017-10-15 17:35:15 +02:00
Jaquee
ff7c30aadc wallet2: light wallet member variables 2017-10-15 17:35:08 +02:00
Riccardo Spagni
56ea442fd3 Merge pull request #2555
a4b4651c dns_utils: allow an optional DNS server IP in DNS_PUBLIC (moneromooo-monero)
2017-10-15 17:33:09 +02:00
Riccardo Spagni
d316b3d266 Merge pull request #2554
d74336d5 wallet: encrypt (un)signed tx, also optionally save unencrypted raw tx hexstr (stoffu)
2017-10-15 17:32:30 +02:00
Jaquee
e2a276cbb5 wallet2: add ssl option to init() 2017-10-15 17:32:13 +02:00
Jaquee
a13540be6f add string_tools::validate_hex() 2017-10-15 17:32:13 +02:00
Jaquee
fd773d88cd refactor cryptonote_basic::add_tx_pub_key_to_extra 2017-10-15 17:32:09 +02:00
Riccardo Spagni
d8bc28cc36 Merge pull request #2552
69ce33f2 core: fix failure to sync when a tx is already in the pool (moneromooo-monero)
2017-10-15 17:31:37 +02:00
Riccardo Spagni
62629541a5 Merge pull request #2550
735fafec simplewallet: allow 1/yes/y as well as true for start_mining options (moneromooo-monero)
2017-10-15 17:31:14 +02:00
Riccardo Spagni
ce1016254a Merge pull request #2549
bf2d9113 simplewallet: fix --restore-from-height being ignored (moneromooo-monero)
2017-10-15 17:30:53 +02:00
Jaquee
8bfa6c2d9f lightwallet rpc server commands 2017-10-15 17:30:23 +02:00
Riccardo Spagni
bb268cad96 Merge pull request #2538
efb95f96 readme: update Arch/AUR pkg name; post-rebranding (redfish)
2017-10-15 17:30:13 +02:00
Riccardo Spagni
cce1548db8 Merge pull request #2507
787ff011 add Mishi Choudhary's GPG key (Riccardo Spagni)
2017-10-15 17:29:41 +02:00
Jaquee
76961ddc3e Serializer: string to integer conversion for MyMonero compatibility
mymonero timestamp conversion
2017-10-15 17:29:07 +02:00
Jaquee
1cf940f2a1 epee http_client SSL support 2017-10-15 17:29:04 +02:00
Riccardo Spagni
5df4ecbb83 Merge pull request #2528
551a8ea6 mnemonics: new Lojban word list (Wei Tang)
2017-10-15 17:27:58 +02:00
Jaquee
eec1013785 CMakeLists.txt - Add openssl include dir 2017-10-15 17:25:26 +02:00
Riccardo Spagni
5ea20d6944 Merge pull request #2469
7adceee6 precomputed block hashes are now in blocks of N (currently 256) (moneromooo-monero)
2017-10-15 17:23:50 +02:00
Riccardo Spagni
f7b9f44c1b Merge pull request #2056
53ad5a0f Subaddresses (kenshi84)
2017-10-15 17:21:12 +02:00
moneromooo-monero
118a1bed28 rpc: make get_coinbase_tx_sum a restricted RPC
It's pretty slow and I/O intensive
2017-10-14 09:49:24 +01:00
moneromooo-monero
7130cf0c61 Add tools::on_startup, and warn about glibc 2.25 bug if found
https://sourceware.org/bugzilla/show_bug.cgi?id=21778
2017-10-14 09:12:28 +01:00
redfish
6bab9efe00 debug utils: fix debug build: rm unused identifier 2017-10-13 15:38:02 +00:00
redfish
b92d3f96c0 cmake: fix shared library build 2017-10-13 15:37:52 +00:00
moneromooo-monero
22b51e0672 db_lmdb: include chain height when failing to find an output key
To help debugging logs.
2017-10-12 13:28:28 +01:00
moneromooo-monero
5db433b3f7 blockchain: avoid exceptions in output verification
This can happen if we get a bad tx, so let's not spam the log.
2017-10-12 13:27:20 +01:00
moneromooo-monero
529a6a4af8 core: guard against a mined block not finding all txes in the pool
This can happen for several reasons, but mainly if another block
was received, which took that tx off the pool.
2017-10-11 13:00:49 +01:00
Howard Chu
0aa4cc8028 ITS#8339 Solaris 10/11 robust mutex fixes
Check for PTHREAD_MUTEX_ROBUST_NP definition (this doesn't work
on Linux/glibc because they used an enum). Zero out mutex before
initing.
2017-10-10 19:04:11 +01:00
moneromooo-monero
a4b4651cb0 dns_utils: allow an optional DNS server IP in DNS_PUBLIC
tcp://a.b.c.d
2017-10-10 12:29:05 +01:00
moneromooo-monero
6bd4dac6e2 util: ignore SIGPIPE
In practice, this seems to cause monero-wallet-rpc to exit
when ^C quits whatever its output is piped into (such as tee),
but it saves, while it did not before.
2017-10-09 21:46:01 +01:00
moneromooo-monero
7dbf76d0da Fix an object lifetime bug in net load tests
The commands handler must not be destroyed before the config
object, or we'll be accessing freed memory.

An earlier attempt at using boost::shared_ptr to control object
lifetime turned out to be very invasive, though would be a
better solution in theory.
2017-10-09 16:46:42 +01:00
redfish
2051f89fbe cmake: build tests last
Keep -Werror for src, contrib and do not pass it for tests/
2017-10-08 20:47:50 -04:00
iDunk5400
44c1d160c8 unit_tests: fix compiling on Windows 2017-10-08 23:59:08 +02:00
binaryFate
93ad1f8723 Fix #2559: more flexible print_tx daemon command 2017-10-08 22:35:35 +02:00
moneromooo-monero
fe484f3049 unit_tests: data dir is now overridden with --data-dir
rather than a raw string without option
2017-10-08 21:19:05 +01:00
moneromooo-monero
4090e8c6e5 simplewallet: add get/set for refresh-from-height 2017-10-08 10:14:44 +01:00
moneromooo-monero
0a872798bc protocol: kick idle peers by dropping them
This is safer, as we don't risk break expectations (eg, requesting
block hashes and then receiving a late set of blocks). Dropping a
connection means another will be attempted in a fresh state.

Also bump the kick timeout to 5 minutes, to ensure we only kick
really idle peers.
2017-10-07 20:29:11 +01:00
moneromooo-monero
bc1b93333e frob level 1 logs a bit for consistency
Level 1 logs map to INFO, so setting log level to 1 should
show these. Demote some stuff to DEBUG to avoid spam, though.
2017-10-07 20:03:42 +01:00
Michał Sałaban
dc19659d16 Remove network_address_base which has been merged with ipv4_network_address in 8b006877 2017-10-07 19:29:30 +02:00
redfish
885c773af3 cmake: print which stack trace lib is used
To avoid the suprize of stack tracing being enabled
but libunwind not being linked in.
2017-10-07 12:13:31 -04:00
moneromooo-monero
b776c72568 daemon: use @N syntax to output_histogram for specific amounts
Makes debugging tx verification easier
2017-10-07 16:45:54 +01:00
moneromooo-monero
c413613416 miner: always update block template when starting
This fixes using the previous address when starting mining,
then stopping and restarting with a different address
2017-10-07 11:32:36 +01:00
moneromooo-monero
06fb9bcfcc wallet2: fix refresh height calc for new wallets 2017-10-07 11:21:11 +01:00
kenshi84
53ad5a0f42 Subaddresses 2017-10-07 13:06:21 +09:00
stoffu
7b8d3ec6ba wallet-cli: add --do-not-relay option 2017-10-07 12:46:09 +09:00
stoffu
d74336d5c9 wallet: encrypt (un)signed tx, also optionally save unencrypted raw tx hexstr 2017-10-07 12:45:32 +09:00
Michał Sałaban
2183ade0c4 Don't try to create wallet-dir when it's not given, don't crash if wallet-dir already exists. 2017-10-07 02:04:33 +02:00
Riccardo Spagni
86e9de588c Merge pull request #2548
7d4ef258 rpc: fix getting txpool transactions (moneromooo-monero)
2017-10-06 23:00:43 +04:00
Riccardo Spagni
09ccd07bbc Merge pull request #2542
180a848c wallet2: Missing underflow check on low heights (landergate)
2017-10-06 23:00:24 +04:00
Riccardo Spagni
e8a7291d12 Merge pull request #2541
15e62581 connection_context: initialize m_callback_request_count to 0 (moneromooo-monero)
5fa199c6 copyable_atomic: add a ctor with initial value (moneromooo-monero)
2017-10-06 22:58:54 +04:00
Riccardo Spagni
2ff832c576 Merge pull request #2540
71c7f8d0 core: fix logging the one time public key on error (moneromooo-monero)
2017-10-06 22:58:20 +04:00
Riccardo Spagni
fb7dcb6ec0 Merge pull request #2539
93ed9321 cmake: add libversion and libcheckpoints to libwallet_merged (redfish)
2017-10-06 22:57:20 +04:00
Riccardo Spagni
4a20a5b5ea Merge pull request #2537
269a2a01 blockchain: fix off by one getting blocks (moneromooo-monero)
2017-10-06 22:56:17 +04:00
Riccardo Spagni
478b14b565 Merge pull request #2534
4e115a3a core: remove out sorting from v7 rules (moneromooo-monero)
2017-10-06 22:55:00 +04:00
Riccardo Spagni
6cf36b4e96 Merge pull request #2530
cbc5508b construct_tx_and_get_tx_key: return sorted sources for print_ring_memebrs to work properly (stoffu)
2017-10-06 22:54:19 +04:00
Riccardo Spagni
1c044b162c Merge pull request #2529
bd937139 wallet2: error check for generate_key_image_helper, removed redundant wallet_generate_key_image_helper (stoffu)
2017-10-06 22:53:28 +04:00
Riccardo Spagni
a21572757e Merge pull request #2524
38f2ccbe fix portable binaries build targets (lancillotto)
2017-10-06 22:52:45 +04:00
Riccardo Spagni
8661f4e868 Merge pull request #2523
540d6fa3 tests: pass data dir as arg (redfish)
2017-10-06 22:51:22 +04:00
Riccardo Spagni
c58ec8cdc1 Merge pull request #2468
986d03d4 simplewallet: allow to set threshold before warning about tx backlog (selsta)
2017-10-06 22:50:41 +04:00
Riccardo Spagni
3bcce5be86 Merge pull request #2345
8b006877 Upgrades to epee::net_utils::network_address   - internal nullptr checks   - prevent modifications to network_address (shallow copy issues)   - automagically works with any type containing interface functions   - removed fnv1a hashing   - ipv4_network_address now flattened with no base class (Lee Clagett)
2017-10-06 22:49:45 +04:00
moneromooo-monero
8f0cea6355 add a command_line function to check for defaulted options 2017-10-06 10:56:18 +01:00
moneromooo-monero
27fdaaa409 Fix building with -DARCH=default -DNO_AES=ON 2017-10-06 08:47:03 +01:00
moneromooo-monero
cba3449415 rpc: out_peers now works again 2017-10-06 08:40:14 +01:00
moneromooo-monero
240f769d21 tests: add sha256sum unit test 2017-10-05 17:03:37 +01:00
Lee Clagett
8b00687735 Upgrades to epee::net_utils::network_address
- internal nullptr checks
  - prevent modifications to network_address (shallow copy issues)
  - automagically works with any type containing interface functions
  - removed fnv1a hashing
  - ipv4_network_address now flattened with no base class
2017-10-05 11:57:09 -04:00
Emilien Devos
e663657727 Add needed dependencies 2017-10-04 14:05:11 +02:00
moneromooo-monero
7e7acdc32b daemon: catch out of range exceptions too when calling stoll/stoi
And any other exception, just to be safe
2017-10-03 17:36:44 +01:00
moneromooo-monero
8028dde7a6 block_queue: use boost::uuids::nil_uuid where appropriate 2017-10-03 11:55:45 +01:00
moneromooo-monero
f139a6cad0 wallet2: fix backlog being off by 1
We don't want to count "partly filled" blocks in this case
2017-10-03 11:49:46 +01:00
moneromooo-monero
b5b4abb8a6 simplewallet: fix setting default-ring-size to 0
It'd be set to the current wallet default instead
2017-10-03 11:45:02 +01:00
moneromooo-monero
54940d8ca4 blockchain_import: remove a few commented out obsolete lines 2017-10-03 09:15:57 +01:00
moneromooo-monero
452d4fae39 tests: fix hashchain unit tests
and relax the not-empty safety check to stay more intuitiuve
2017-10-03 00:51:53 +01:00
stoffu
bd9371395e wallet2: error check for generate_key_image_helper, removed redundant wallet_generate_key_image_helper 2017-10-03 08:13:00 +09:00
stoffu
cbc5508b15 construct_tx_and_get_tx_key: return sorted sources for print_ring_memebrs to work properly 2017-10-03 08:12:28 +09:00
Riccardo Spagni
a2041c9874 Merge pull request #2518
6a0fb301 performance_tests: adjust some iterations down a bit (moneromooo-monero)
2017-10-02 23:31:27 +04:00
Riccardo Spagni
5f430cedd8 Merge pull request #2515
c34093db simplewallet: add privacy warning when using an untrusted demon (moneromooo-monero)
2017-10-02 23:30:20 +04:00
Riccardo Spagni
87d0516f7d Merge pull request #2513
309290d1 Source updates are in a source subdirectory (moneromooo-monero)
2017-10-02 23:29:25 +04:00
Riccardo Spagni
3bab2676ec Merge pull request #2512
792ba4f0 Log categories can now be added to and removed from (moneromooo-monero)
48f92eb6 easylogging++: add categories getter (moneromooo-monero)
f35afe62 epee: factor log level/categories setting (moneromooo-monero)
2017-10-02 23:28:59 +04:00
Riccardo Spagni
db45291c8d Merge pull request #2506
c3de19ed json_object: add missing do_not_relay to tx_in_pool serialization (moneromooo-monero)
2017-10-02 23:27:21 +04:00
selsta
986d03d4b2 simplewallet: allow to set threshold before warning about tx backlog 2017-10-02 21:23:33 +02:00
Riccardo Spagni
abe24f4429 Merge pull request #2504
f182acdd dns_utils: query DNS records in parallel (moneromooo-monero)
2017-10-02 23:21:10 +04:00
Riccardo Spagni
fb568a6e8e Merge pull request #2503
d73162f9 update translation: final changes (lancillotto)
688acacb update translation: typo fix and changes (lancillotto)
2017-10-02 23:20:10 +04:00
Riccardo Spagni
1aab83ebf7 Merge pull request #2502
e914153f Include additional instructions for Jessie (Mike C)
7cdb3431 Update Raspberry Pi build instructions (Mike C)
2017-10-02 23:19:30 +04:00
Riccardo Spagni
4a450042f7 Merge pull request #2495
2540d162 Add -a append option to mdb_load (Howard Chu)
2017-10-02 23:18:48 +04:00
Riccardo Spagni
737717c111 Merge pull request #2491
d5a9edf2 wallet2: fix exception on split txes (moneromooo-monero)
5c5b0fd0 wallet2: print unused indices on a single line (moneromooo-monero)
2017-10-02 23:17:57 +04:00
Riccardo Spagni
c08b6cc485 Merge pull request #2475
f2939bdc epee: keep a ref to a connection we're deleting (moneromooo-monero)
2017-10-02 23:15:56 +04:00
Riccardo Spagni
3bf20a77f2 Merge pull request #2470
2e59f6ea rpc: add new RPCs to get and set limits (MaxXor)
2017-10-02 23:15:22 +04:00
Riccardo Spagni
e93e0c2be3 Merge pull request #2467
2e82b232 epee: give virtual dtor to network_address_base (moneromooo-monero)
2017-10-02 23:14:03 +04:00
Riccardo Spagni
27da943d9f Merge pull request #2561
37c12119 wallet2: fix hash chain trimming when the inner chain becomes empty (moneromooo-monero)
2017-10-02 23:11:49 +04:00
moneromooo-monero
37c12119ab wallet2: fix hash chain trimming when the inner chain becomes empty
It'd prevent further syncing. Recovery of empty hash chains is
automatic, but requires a running daemon
2017-10-02 12:52:22 +01:00
Cole Lightfighter
ff7745bb87 Edited test readme for accuracy and depth
Removed some erroneous instructions, and added information about
different test suites.

Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
2017-10-01 12:11:59 -06:00
Helmut Pozimski
acc186ebb1 README: Add package installation instructions for Void Linux 2017-10-01 10:42:38 +02:00
moneromooo-monero
69ce33f217 core: fix failure to sync when a tx is already in the pool 2017-09-29 21:34:10 +01:00
moneromooo-monero
735fafecb0 simplewallet: allow 1/yes/y as well as true for start_mining options
Also mention those options in the start_mining help line
2017-09-29 19:17:25 +01:00
moneromooo-monero
bf2d911365 simplewallet: fix --restore-from-height being ignored 2017-09-29 19:06:14 +01:00
moneromooo-monero
7d4ef25800 rpc: fix getting txpool transactions 2017-09-29 16:29:26 +01:00
redfish
540d6fa3d5 tests: pass data dir as arg
This fixes test failure on builds that happen
to be built in 'build/' instead of 'build/release'.

Use boost filesystem path type.
2017-09-28 01:41:44 -04:00
moneromooo-monero
4e115a3a4c core: remove out sorting from v7 rules
and restore random shuffle of outputs

This turned out to have a flaw (sort order depends on output
index), and this doesn't really bring much anyway
2017-09-27 12:42:08 +01:00
landergate
180a848cbe wallet2: Missing underflow check on low heights
Lack of it results in `m_refresh_from_block_height` being < 0 (18446744...) on low heights, which blocks `process_new_blockchain_entry` and never process coins on heights less than blocks_per_month.
Follow-up to #2258
2017-09-27 14:17:48 +03:00
moneromooo-monero
15e6258136 connection_context: initialize m_callback_request_count to 0 2017-09-27 11:43:12 +01:00
moneromooo-monero
5fa199c652 copyable_atomic: add a ctor with initial value 2017-09-27 11:43:08 +01:00
moneromooo-monero
71c7f8d0dc core: fix logging the one time public key on error 2017-09-27 11:40:05 +01:00
redfish
93ed932143 cmake: add libversion and libcheckpoints to libwallet_merged
Needed to link monero-core Qt wallet.
2017-09-27 00:57:02 -04:00
redfish
efb95f9615 readme: update Arch/AUR pkg name; post-rebranding 2017-09-26 21:19:50 -04:00
moneromooo-monero
269a2a01ef blockchain: fix off by one getting blocks 2017-09-27 00:31:49 +01:00
Mike C
e914153ff5 Include additional instructions for Jessie
Raspbian Jessie users must compile boost themselves.
2017-09-26 13:00:21 -06:00
Riccardo Spagni
5f7cddeb53 Merge pull request #2533
97cdd4c9 core: undo output sorting (moneromooo-monero)
2017-09-26 15:59:32 +02:00
moneromooo-monero
97cdd4c92f core: undo output sorting
It looks like it may be buggy
2017-09-26 13:23:31 +01:00
Wei Tang
551a8ea60e mnemonics: new Lojban word list
Word list authored by: sorpaas
Sources:
  lo gimste jo'u lo ma'oste (http://guskant.github.io/lojbo/gismu-cmavo.html)
  N-grams of Lojban corpus (https://mw.lojban.org/papri/N-grams_of_Lojban_corpus)
2017-09-26 06:42:17 +08:00
Riccardo Spagni
21c2c08041 Merge pull request #2527
ba6907f6 core: fix creation of v1 txes (moneromooo-monero)
2017-09-25 23:29:32 +02:00
moneromooo-monero
ba6907f661 core: fix creation of v1 txes 2017-09-25 22:27:30 +01:00
Riccardo Spagni
0c5730b101 Merge pull request #2526
db215ecd checkpoints: add missing CMakeLists.txt (moneromooo-monero)
2017-09-25 22:46:46 +02:00
moneromooo-monero
db215ecdb6 checkpoints: add missing CMakeLists.txt 2017-09-25 21:44:53 +01:00
Riccardo Spagni
29d601563f Merge pull request #2434
36c3465b wallet2: do not keep block hashes below last checkpoint (moneromooo-monero)
cdbbe99c checkpoints: add a token checkpoint on testnet (the genesis block) (moneromooo-monero)
493fad80 serialization: add deque serialization (moneromooo-monero)
fa54b205 fix typo in basic and core CMakeLists.txt (moneromooo-monero)
5d65a75b move checkpoints in a separate library (moneromooo-monero)
2017-09-25 22:27:44 +02:00
moneromooo-monero
36c3465b98 wallet2: do not keep block hashes below last checkpoint
This saves a lot of space and load/save time for wallet caches
2017-09-25 21:16:40 +01:00
moneromooo-monero
cdbbe99c82 checkpoints: add a token checkpoint on testnet (the genesis block) 2017-09-25 21:16:35 +01:00
moneromooo-monero
493fad8053 serialization: add deque serialization 2017-09-25 21:16:32 +01:00
moneromooo-monero
fa54b20584 fix typo in basic and core CMakeLists.txt 2017-09-25 21:16:29 +01:00
moneromooo-monero
5d65a75b69 move checkpoints in a separate library 2017-09-25 21:16:26 +01:00
Riccardo Spagni
85f4b600d2 Merge pull request #2466
bc429e9c daemon: make this build with boost 1.61 (moneromooo-monero)
2017-09-25 21:06:47 +02:00
Riccardo Spagni
031f486e12 Merge pull request #2486
8b1acc9a Fix OpenSSL 1.1 detection for static builds (hyc)
2017-09-25 20:25:29 +02:00
Riccardo Spagni
7b8398eed7 Merge pull request #2485
a3691ae3 daemon: fix static building with libzmq (iDunk5400)
2017-09-25 20:25:10 +02:00
Riccardo Spagni
0d52b1392f Merge pull request #2525
8e0670c6 version: fix link to new version strings (moneromooo-monero)
2017-09-25 20:14:18 +02:00
Riccardo Spagni
999c097941 Merge pull request #2439
06a681cf performance_tests: add a test for is_out_to_acc_precomp (moneromooo-monero)
2ec928ba wallet2: simplify tx processing a bit (moneromooo-monero)
740e6533 wallet2: factor some of the tx scanning code (moneromooo-monero)
2017-09-25 20:13:34 +02:00
moneromooo-monero
8e0670c684 version: fix link to new version strings
p2p uses it, and the cpp file needs to know the symbols should
be public
2017-09-25 19:01:56 +01:00
moneromooo-monero
06a681cf5b performance_tests: add a test for is_out_to_acc_precomp 2017-09-25 18:35:55 +01:00
moneromooo-monero
2ec928badb wallet2: simplify tx processing a bit 2017-09-25 18:35:51 +01:00
lancillotto
38f2ccbe1e fix portable binaries build targets 2017-09-25 19:04:03 +02:00
moneromooo-monero
740e6533a5 wallet2: factor some of the tx scanning code 2017-09-25 16:11:28 +01:00
Riccardo Spagni
5530a0e4db Merge pull request #2500
022888fd README Network Consensus Protocol Upgrade Table (Gingeropolous)
2017-09-25 17:06:49 +02:00
Riccardo Spagni
d812d4ed82 Merge pull request #2498
527472d0 README: Add libzmq to dependencies and update MSYS2 dependencies (iDunk5400)
2017-09-25 17:06:20 +02:00
Riccardo Spagni
74c4f1a563 Merge pull request #2460
3487d810 cryptonote_protocol: fix needless chain hashes downloads (moneromooo-monero)
2017-09-25 17:01:53 +02:00
Riccardo Spagni
13be8115e4 Merge pull request #2458
7f2f6ee1 protocol: remove hop count on block propagation (moneromooo-monero)
2017-09-25 17:00:47 +02:00
Riccardo Spagni
e5a2cdbfad Merge pull request #2457
d2d8a41c Use actual batch size for resize estimates (Howard Chu)
2017-09-25 16:57:07 +02:00
Riccardo Spagni
cd22a268ea Merge pull request #2454
5112b28d Readline is now supported directly (Howard Chu)
2017-09-25 16:54:27 +02:00
Riccardo Spagni
32bbe62120 Merge pull request #2456
91def9a5 daemon, wallet: add --max-log-file-size option (selsta)
2017-09-25 16:54:08 +02:00
Riccardo Spagni
0e74777071 Merge pull request #2452
0aaaca29 tx_pool: set the "invalid input" bit when check_tx_inputs fails (moneromooo-monero)
9236823b simplewallet: print tx rejection reason where it was missing (moneromooo-monero)
3dee3301 core_rpc_server: print tx rejection reason at L0 too (moneromooo-monero)
2017-09-25 16:53:07 +02:00
Riccardo Spagni
c2346c6c59 Merge pull request #2424
28b72b6e tx_pool: pre-init tvc.m_verifivation_failed before processing (moneromooo-monero)
50a629b2 core_tests: catch (impossible in practice) tx extra api failure (moneromooo-monero)
fee15ef1 wallet2: catch failure to parse address (moneromooo-monero)
1399e26d net_peerlist: remove dead code (moneromooo-monero)
50e09698 tx_pool: guard against failure getting tx hash (moneromooo-monero)
54cc209a wallet_rpc_server: catch failure to create directory (moneromooo-monero)
3e55099c wallet_rpc_server: init m_vm to NULL in ctor (moneromooo-monero)
7d0dde5e wallet_args: remove redundant default value for --log-file (moneromooo-monero)
ed4a3350 wallet2: catch failure to save keys file (moneromooo-monero)
44434c8a wallet2_api: check whether dynamic_cast returns NULL (moneromooo-monero)
92f2f687 core: check return value from parse_hexstr_to_binbuff (moneromooo-monero)
5475692e wallet2_api: remove an unused, uninitialized, field (moneromooo-monero)
a7ba3de1 libwallet_api_tests: initialize newblock_triggered on reset (moneromooo-monero)
b2763ace wallet2_api: init error code to "no error" in the ctor (moneromooo-monero)
b5faac53 get_blockchain_top now returns void (moneromooo-monero)
2e44d8f2 wallet_rpc_server: guard against exceptions (moneromooo-monero)
4230876b simplewallet: guard against I/O exceptions (moneromooo-monero)
06c1e057 daemon: initialize decode_as_json in RPC request (moneromooo-monero)
11f71af5 http_base: init size_t in http_request_info ctor (moneromooo-monero)
2017-09-25 16:52:27 +02:00
Riccardo Spagni
5953724f69 Merge pull request #2443
ffe27127 wallet_rpc_server: fix index for newly added address book entry (moneromooo-monero)
2017-09-25 16:51:07 +02:00
Riccardo Spagni
b911130a46 Merge pull request #2442
e29282d2 build: auto update version info without manually deleting version.h (stoffu)
2017-09-25 16:50:35 +02:00
Riccardo Spagni
08ada1fa8b Merge pull request #2440
6137a0b9 blockchain: reject unsorted ins and outs from v7 (moneromooo-monero)
16afab90 core: sort ins and outs key key image and public key, respectively (moneromooo-monero)
0c36b9f9 common: add apply_permutation file and function (moneromooo-monero)
2017-09-25 16:49:01 +02:00
moneromooo-monero
28b72b6ecc tx_pool: pre-init tvc.m_verifivation_failed before processing
CID 175316
2017-09-25 15:48:59 +01:00
moneromooo-monero
50a629b2e6 core_tests: catch (impossible in practice) tx extra api failure
CID 175301
2017-09-25 15:48:51 +01:00
moneromooo-monero
fee15ef1a9 wallet2: catch failure to parse address
CID 175297
2017-09-25 15:48:48 +01:00
moneromooo-monero
1399e26d7e net_peerlist: remove dead code
CID 175290
2017-09-25 15:48:45 +01:00
moneromooo-monero
50e096987b tx_pool: guard against failure getting tx hash
Should be impossible in practice, but easy change

CID 175282
2017-09-25 15:48:42 +01:00
moneromooo-monero
54cc209a5e wallet_rpc_server: catch failure to create directory
CID 175281
2017-09-25 15:48:39 +01:00
moneromooo-monero
3e55099cb2 wallet_rpc_server: init m_vm to NULL in ctor
CID 175279
2017-09-25 15:48:36 +01:00
moneromooo-monero
7d0dde5eb5 wallet_args: remove redundant default value for --log-file
CID 175265
2017-09-25 15:48:33 +01:00
moneromooo-monero
ed4a33502d wallet2: catch failure to save keys file
CID 161848
2017-09-25 15:48:30 +01:00
moneromooo-monero
44434c8a37 wallet2_api: check whether dynamic_cast returns NULL
CID 161844
2017-09-25 15:48:27 +01:00
moneromooo-monero
92f2f687b9 core: check return value from parse_hexstr_to_binbuff 2017-09-25 15:48:24 +01:00
moneromooo-monero
5475692ed5 wallet2_api: remove an unused, uninitialized, field
Silences CID 161874
2017-09-25 15:48:21 +01:00
moneromooo-monero
a7ba3de1d3 libwallet_api_tests: initialize newblock_triggered on reset
CID 161873
2017-09-25 15:48:18 +01:00
moneromooo-monero
b2763ace06 wallet2_api: init error code to "no error" in the ctor
CID 161872
2017-09-25 15:48:16 +01:00
moneromooo-monero
b5faac5304 get_blockchain_top now returns void
It was always returning true, and could not be foreseen to
usefully return errors in the future. This silences CID 162652
as well as saves some checking code in a few places.
2017-09-25 15:48:13 +01:00
moneromooo-monero
2e44d8f23c wallet_rpc_server: guard against exceptions
CID 175305
2017-09-25 15:48:10 +01:00
moneromooo-monero
4230876b31 simplewallet: guard against I/O exceptions
CID 175308
2017-09-25 15:48:06 +01:00
moneromooo-monero
06c1e05735 daemon: initialize decode_as_json in RPC request
CID 161886
2017-09-25 15:48:03 +01:00
moneromooo-monero
11f71af56c http_base: init size_t in http_request_info ctor
CID 161879
2017-09-25 15:47:59 +01:00
Riccardo Spagni
76312e04b9 Merge pull request #2435
74a465c8 Repo: remove in-tree VRP, link to single-policy VRP (anonimal)
2017-09-25 16:47:21 +02:00
Riccardo Spagni
174f2fb4da Merge pull request #2428
054054c9 p2p: disable gray list housekeeping when an exclusive node is given (moneromooo-monero)
2017-09-25 16:46:26 +02:00
Riccardo Spagni
4c58b7edb8 Merge pull request #2425
df322ddd utils: systemd: dir for pidfile with permissions (redfish)
2017-09-25 16:46:08 +02:00
Riccardo Spagni
c339d06a5b Merge pull request #2418
50431112 cmake: make warning about headers not fatal (redfish)
0a70ba2c cmake: fix setting of -Werror (redfish)
2017-09-25 16:45:52 +02:00
Riccardo Spagni
c2e46edca2 Merge pull request #2398
e0592e87 dns_utils: remove a few obsolete things (moneromooo-monero)
2017-09-25 16:44:37 +02:00
Riccardo Spagni
ce37967dd2 Merge pull request #2386
a15e8583 wallet2: guard against daemon sending txes in the wrong order (moneromooo-monero)
8fe5f609 rpc: order transactions in the order they were requested (moneromooo-monero)
2017-09-25 16:40:54 +02:00
Riccardo Spagni
216395d43e Merge pull request #2379
9c83f806 Do not create file when RPC user/pass is given and use file locking (Lee Clagett)
2017-09-25 16:40:35 +02:00
Riccardo Spagni
ec0e144e90 Merge pull request #2377
b5cbdce8 wallet2: correctly handle in/out payments for view-only wallet (stoffu)
2017-09-25 16:40:16 +02:00
Riccardo Spagni
44ad32fd4a Merge pull request #2357
58015df4 Fix getblocktemplate RPC returning wrong reserved_offset (Guillaume LE VAILLANT)
2017-09-25 16:39:01 +02:00
Riccardo Spagni
40d213154b Merge pull request #2289
6ee1116d store is optional during close and defaults to true; except during descruction (m2049r)
2017-09-25 16:38:14 +02:00
Riccardo Spagni
c6306e75e7 Merge pull request #2257
651baaec wallet: add encrypted seed functionality (moneromooo-monero)
2017-09-25 16:37:17 +02:00
redfish
504311128d cmake: make warning about headers not fatal
Warning issued on older boost and/or OS:

In file included from /usr/include/boost/asio/detail/socket_types.hpp:61:0,
                 from /usr/include/boost/asio/detail/epoll_reactor.hpp:30,
                 from /usr/include/boost/asio/detail/reactor.hpp:21,
                 from /usr/include/boost/asio/detail/impl/task_io_service.ipp:24,
                 from /usr/include/boost/asio/detail/task_io_service.hpp:198,
                 from /usr/include/boost/asio/impl/io_service.hpp:71,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:20,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:21,
                 from /home/vagrant/slave/monero-static-alpine-3_5-x86_64/build/src/common/download.cpp:32:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
2017-09-24 11:25:16 -04:00
redfish
0a70ba2c01 cmake: fix setting of -Werror
Setting COMPILE_FLAGS (or COMPILE_OPTIONS) property directly does not
end up on the command line (even though it should because
add_compile_options does just that).

Also, set -Werror for tests as well, because no warnings now.

Not set for 'external' only because simply moving add_compile_options
above add_subdirectory(external) doesn't do it, and moving add_usbdirectory
down is too big of a change (it will pick up new flags).

-Werror set only for GCC on Linux, since warnings not yet
cleared for other compilers/systems.
2017-09-24 11:25:11 -04:00
moneromooo-monero
6a0fb301bb performance_tests: adjust some iterations down a bit 2017-09-24 11:00:31 +01:00
iDunk5400
a3691ae31c daemon: fix static building with libzmq 2017-09-23 12:34:02 +02:00
m2049r
6ee1116d75 store is optional during close and defaults to true; except during descruction 2017-09-23 00:52:09 +02:00
moneromooo-monero
c34093db58 simplewallet: add privacy warning when using an untrusted demon 2017-09-22 22:19:22 +01:00
moneromooo-monero
309290d1c7 Source updates are in a source subdirectory
rather than in the same directory as the prebuilt versions
2017-09-22 21:48:19 +01:00
lancillotto
d73162f9fb update translation: final changes 2017-09-22 21:43:54 +02:00
moneromooo-monero
792ba4f0fe Log categories can now be added to and removed from
Also, set_log without parameters now prints the log categories
2017-09-22 18:08:14 +01:00
moneromooo-monero
48f92eb665 easylogging++: add categories getter 2017-09-22 14:33:09 +01:00
moneromooo-monero
f35afe62a4 epee: factor log level/categories setting 2017-09-22 14:14:58 +01:00
Riccardo Spagni
787ff01168 add Mishi Choudhary's GPG key 2017-09-21 15:23:37 +02:00
moneromooo-monero
c3de19edd6 json_object: add missing do_not_relay to tx_in_pool serialization 2017-09-21 13:37:30 +01:00
Riccardo Spagni
1f9058187c Merge pull request #2496
3b8b4be5 tx_pool: drop invalid txes from the pool on startup (moneromooo-monero)
2017-09-21 12:07:35 +02:00
Riccardo Spagni
8cc9b0e739 Merge pull request #2492
e457aa51 blockchain: fix crash checking pre-validated txids (moneromooo-monero)
2017-09-21 12:07:22 +02:00
Riccardo Spagni
bd85a47a29 Merge pull request #2477
9aeae7a2 db_lmdb: fix use of uninitialized key in for_blocks_range (moneromooo-monero)
2017-09-21 12:07:08 +02:00
Riccardo Spagni
0f071848a1 Merge pull request #2479
58908295 Fixes static_assert on arm and ppc builds (Lee Clagett)
2017-09-21 11:50:34 +02:00
iDunk5400
527472d0f7 README: Add libzmq to dependencies and update MSYS2 dependencies 2017-09-21 10:49:39 +02:00
moneromooo-monero
f182acdd36 dns_utils: query DNS records in parallel 2017-09-21 09:23:08 +01:00
Riccardo Spagni
48512acda9 Merge pull request #2324
c09aa94d daemon: indicate whether  the spent key image is mined or unconfirmed (stoffu)
2017-09-21 10:12:24 +02:00
Riccardo Spagni
07312a7d6e Merge pull request #2302
ef005f5e p2p: add a couple early outs when the stop signal is received (moneromooo-monero)
80d361c7 abstract_tcp_server2: improve tracking/cancelling of early connections (moneromooo-monero)
2017-09-21 10:11:33 +02:00
lancillotto
688acacbec update translation: typo fix and changes 2017-09-21 01:47:34 +02:00
Mike C
7cdb343184 Update Raspberry Pi build instructions
We don't have to compile boost by ourselves anymore!
2017-09-20 16:56:20 -06:00
stoffu
e29282d208 build: auto update version info without manually deleting version.h 2017-09-21 07:47:37 +09:00
stoffu
c09aa94d34 daemon: indicate whether the spent key image is mined or unconfirmed 2017-09-21 07:46:44 +09:00
stoffu
b5cbdce8a6 wallet2: correctly handle in/out payments for view-only wallet 2017-09-21 07:46:19 +09:00
Gingeropolous
022888fdc8 README Network Consensus Protocol Upgrade Table
Aligned table for all you terminal knuckleheads and tried to better explain the schedule and what a user needs to do
2017-09-20 17:32:56 -04:00
Riccardo Spagni
a6403846ef Merge pull request #2441
fee3c3ed Update wallet2.cpp for misspelling (Matthew Campassi)
2017-09-20 21:41:33 +02:00
Riccardo Spagni
786a4ae9ea Merge pull request #2429
55b91d86 wallet: fix --help and --version erroring out (moneromooo-monero)
2017-09-20 21:41:09 +02:00
Riccardo Spagni
10d60d2524 Merge pull request #2414
ea016330 updated clarification bc_dyn_stats (Matthew Campassi)
5aa2f24b clarification bc_dyn_stats (Matthew Campassi)
2017-09-20 21:37:55 +02:00
Riccardo Spagni
8f1f43163a Merge pull request #2412
81fb2f53 Silence more stupid gcc warnings (Howard Chu)
2017-09-20 21:37:40 +02:00
Riccardo Spagni
8711c355fc Merge pull request #2410
20256b7c Fix AC power supply detection on Linux (Guillaume LE VAILLANT)
2017-09-20 21:36:09 +02:00
Riccardo Spagni
90498f0013 Merge pull request #2405
9cad4981 readme.me again, fixed v2 fork info on table (Gingeropolous)
8f68291d README.md - update info for first fork (Gingeropolous)
43813327 README.md - update fork table with fork height (Gingeropolous)
0e7e307c update hardfork table with height and version info (Gingeropolous)
2017-09-20 21:35:47 +02:00
Riccardo Spagni
d835a3f691 Merge pull request #2399
d0bbc591 Only check for upnp version if version is determined (Orestis Konstantinidis)
2017-09-20 21:35:12 +02:00
Riccardo Spagni
72207fd27a Merge pull request #2381
840aed1c monero-wallet-cli: New command 'wallet_info' improved (rbrunner7)
9bdd985c monero-wallet-cli: New command 'wallet_info' (rbrunner7)
2017-09-20 21:34:48 +02:00
Riccardo Spagni
75563db6e3 Merge pull request #2376
e3680b69 Rename m_listenning_port to m_listening_port (MaxXor)
a1ea475f Delete UPnP port mapping on exit (MaxXor)
2017-09-20 21:33:21 +02:00
moneromooo-monero
3b8b4be5cb tx_pool: drop invalid txes from the pool on startup
instead of just failing

This is a workaround for bad tx blobs being inserted in the
pool for unknown reasons
2017-09-20 18:55:16 +01:00
Howard Chu
2540d162be Add -a append option to mdb_load
To allow reloading of custom-sorted DBs from mdb_dump
2017-09-20 18:50:38 +01:00
moneromooo-monero
e457aa51f4 blockchain: fix crash checking pre-validated txids 2017-09-20 10:46:13 +01:00
moneromooo-monero
d5a9edf27a wallet2: fix exception on split txes 2017-09-20 10:35:15 +01:00
moneromooo-monero
5c5b0fd048 wallet2: print unused indices on a single line
Decreases log spam massively on large wallets
2017-09-20 10:34:45 +01:00
hyc
8b1acc9a86 Fix OpenSSL 1.1 detection for static builds 2017-09-20 01:38:43 +01:00
Cole Lightfighter
c300ae56ca Added test documentation & Keccak unit test 2017-09-19 15:09:38 -06:00
Cole Lightfighter
f6119a8eaa Added test documentation & Keccak unit test 2017-09-19 15:08:38 -06:00
Lee Clagett
5890829552 Fixes static_assert on arm and ppc builds 2017-09-19 10:57:01 -04:00
moneromooo-monero
9aeae7a224 db_lmdb: fix use of uninitialized key in for_blocks_range 2017-09-19 14:11:24 +01:00
MaxXor
2e59f6ea50 rpc: add new RPCs to get and set limits 2017-09-19 10:30:55 +02:00
moneromooo-monero
f2939bdce8 epee: keep a ref to a connection we're deleting
close might end up dropping a ref, ending up removing the
connection from m_connects, as the lock is recursive. This'd
cause an out of bounds exception and kill the idle connection
maker thread
2017-09-19 09:25:17 +01:00
moneromooo-monero
7adceee634 precomputed block hashes are now in blocks of N (currently 256)
This shaves a lot of space off binaries
2017-09-18 16:29:00 +01:00
moneromooo-monero
2e82b232e8 epee: give virtual dtor to network_address_base
It has virtual functions and is used as a base class
2017-09-18 12:30:48 +01:00
Riccardo Spagni
1a73843cec Merge pull request #2446
6d0ca7d1 Tweak concurrency limits (Howard Chu)
510d0d47 Use a threadpool (Howard Chu)
2017-09-18 13:19:26 +02:00
Riccardo Spagni
4c202b199e Merge pull request #2416
2b363e10 README.md: add instructions to fix core pattern (moneromooo-monero)
2017-09-18 13:18:52 +02:00
Riccardo Spagni
b7d52c3205 Merge pull request #2174
87f58974 Docs: C4 revisions as discussed in #2174 (anonimal)
84d25d25 Docs: C4 development process addendum (anonimal)
e022c4e9 Docs: add C4 to contributing guide (anonimal)
2017-09-18 13:14:32 +02:00
Riccardo Spagni
69e039aa19 Merge pull request #2023
f761dbae Remove 1.25x multiplier from tx_pool (Nano Akron)
2017-09-18 13:11:57 +02:00
Riccardo Spagni
591e53445b Merge pull request #2044
0299cb77 Fix various oversights/bugs in ZMQ RPC server code (Thomas Winget)
77986023 json serialization for rpc-relevant monero types (Thomas Winget)
5c1e08fe Refactor some things into more composable (smaller) functions (Thomas Winget)
9ac2ad07 DRY refactoring (Thomas Winget)
2017-09-18 13:08:16 +02:00
moneromooo-monero
bc429e9c6d daemon: make this build with boost 1.61 2017-09-18 11:24:49 +01:00
moneromooo-monero
6137a0b94d blockchain: reject unsorted ins and outs from v7
This ensures no information is leaked by the ordering
2017-09-18 11:23:15 +01:00
Howard Chu
d2d8a41c47 Use actual batch size for resize estimates
And optimize import startup:

Remember start_height position during initial count_blocks pass
to avoid having to reread entire file again to arrive at start_height
2017-09-17 22:08:40 +01:00
moneromooo-monero
3487d81034 cryptonote_protocol: fix needless chain hashes downloads
The last known hash was calculated incorrectly, causing
further chain hash downloads to restart from the current
chain. When the block queue has close to 10k blocks waiting,
this causes frequent downloads of 10k more hashes, but
with only the last few hashes actually being useful.
2017-09-17 14:13:59 +01:00
moneromooo-monero
7f2f6ee1c9 protocol: remove hop count on block propagation
It is unused, as it was apparently a future optimization,
and it leaks some information (though since pools publish
thei blocks they find, that amount seems small).
2017-09-17 10:26:12 +01:00
selsta
91def9a59b daemon, wallet: add --max-log-file-size option 2017-09-17 04:42:45 +02:00
Howard Chu
5112b28d38 Readline is now supported directly
Remove rlwrap info
2017-09-16 17:54:22 +01:00
moneromooo-monero
0aaaca29a2 tx_pool: set the "invalid input" bit when check_tx_inputs fails 2017-09-16 11:27:52 +01:00
moneromooo-monero
9236823bf4 simplewallet: print tx rejection reason where it was missing 2017-09-16 10:33:42 +01:00
moneromooo-monero
3dee3301ba core_rpc_server: print tx rejection reason at L0 too 2017-09-16 10:32:42 +01:00
Howard Chu
6d0ca7d11f Tweak concurrency limits
Create capacity for 2x max, but lie about it
2017-09-15 00:28:48 +01:00
Howard Chu
510d0d4753 Use a threadpool
Instead of constantly creating and destroying threads
2017-09-14 21:42:48 +01:00
Nano Akron
f761dbaeaf Remove 1.25x multiplier from tx_pool 2017-09-14 21:26:19 +01:00
Riccardo Spagni
13a263894a Merge pull request #2378
b338dad2 update miniupnpc (MaxXor)
2017-09-14 21:04:12 +02:00
Riccardo Spagni
7abdba0a5c Merge pull request #2438
9443eec1 core: guard against exceptions in tx verification worker threads (moneromooo-monero)
2017-09-14 18:31:46 +02:00
Riccardo Spagni
81ac8c49ec Merge pull request #2421
edda2014 ITS#8728 fix MDB_VL32 freeing overflow page (Howard Chu)
2017-09-14 18:26:45 +02:00
Riccardo Spagni
e0382a8da2 Merge pull request #2417
a9845cc3 rpc: get_txpool_backlog is now unrestricted (moneromooo-monero)
2017-09-14 18:26:30 +02:00
Riccardo Spagni
3399c2a257 Merge pull request #2404
e5238adf update checkpoint hashes (Riccardo Spagni)
d4f56bdf update hardcoded checkpoints (Riccardo Spagni)
ed730511 update checkpoints.dat (Riccardo Spagni)
2017-09-14 18:25:43 +02:00
Riccardo Spagni
718820cd96 Merge pull request #2396
dbfef643 tx_pool: catch exceptions in LockedTXN dtor (moneromooo-monero)
2017-09-14 18:25:28 +02:00
Riccardo Spagni
4c07297dc6 Merge pull request #2392
6ac61100 Add a --fluffy-blocks option to relay blocks as fluffy blocks (moneromooo-monero)
2017-09-14 18:25:15 +02:00
Riccardo Spagni
f0523ae391 Merge pull request #2389
11818487 Use latest height for fork date estimate (Howard Chu)
2017-09-14 18:24:52 +02:00
moneromooo-monero
ffe2712726 wallet_rpc_server: fix index for newly added address book entry 2017-09-13 11:02:06 +01:00
moneromooo-monero
16afab900d core: sort ins and outs key key image and public key, respectively
This avoids leaking some small amount of information
2017-09-13 09:25:05 +01:00
moneromooo-monero
0c36b9f931 common: add apply_permutation file and function
This algorithm is adapted from Raymond Chen's code:
https://blogs.msdn.microsoft.com/oldnewthing/20170109-00/?p=95145
2017-09-13 09:25:01 +01:00
Matthew Campassi
fee3c3ed1e Update wallet2.cpp for misspelling
Misspelling in wallet2.cpp
2017-09-12 16:11:45 -05:00
moneromooo-monero
651baaec46 wallet: add encrypted seed functionality
This uses luigi1111's CN_Add method.
See https://xmr.llcoins.net for details.
2017-09-12 13:56:01 +01:00
moneromooo-monero
9443eec10f core: guard against exceptions in tx verification worker threads 2017-09-12 12:07:10 +01:00
anonimal
87f5897499 Docs: C4 revisions as discussed in #2174 2017-09-12 02:47:36 +00:00
anonimal
74a465c83e Repo: remove in-tree VRP, link to single-policy VRP 2017-09-11 22:00:21 +00:00
moneromooo-monero
a15e858302 wallet2: guard against daemon sending txes in the wrong order 2017-09-11 16:48:28 +01:00
moneromooo-monero
8fe5f609d1 rpc: order transactions in the order they were requested 2017-09-11 16:48:25 +01:00
redfish
df322ddde5 utils: systemd: dir for pidfile with permissions
monerod runs as user monero which does not have write
permissions for /var/run. Use systemd's RuntimeDirectory
feature to handle this.
2017-09-10 14:41:08 -04:00
Gingeropolous
9cad498121 readme.me again, fixed v2 fork info on table
included increased fee free zone of 60 kb, changed data of v2
2017-09-10 09:25:16 -04:00
moneromooo-monero
55b91d8605 wallet: fix --help and --version erroring out 2017-09-10 14:12:32 +01:00
Gingeropolous
8f68291d60 README.md - update info for first fork
Include change in blocktime
2017-09-10 08:56:54 -04:00
Gingeropolous
4381332710 README.md - update fork table with fork height
I added a column for fork height and included the september 2016 fork info
2017-09-10 08:53:29 -04:00
moneromooo-monero
054054c92f p2p: disable gray list housekeeping when an exclusive node is given
Exclusive nodes may be used for privacy reasons, and thus we don't
want to connect to other nodes, even for checking connectivity.

See https://github.com/monero-project/monero/issues/2346
2017-09-10 13:11:42 +01:00
Howard Chu
edda20146e ITS#8728 fix MDB_VL32 freeing overflow page
Fix #2420
2017-09-09 15:10:23 +01:00
moneromooo-monero
a9845cc344 rpc: get_txpool_backlog is now unrestricted 2017-09-08 23:47:11 +01:00
moneromooo-monero
2b363e104f README.md: add instructions to fix core pattern 2017-09-08 18:41:27 +01:00
Matthew Campassi
ea01633024 updated clarification bc_dyn_stats
updated clarification of required parameter for bc_dyn_stats
2017-09-08 11:31:58 -05:00
Matthew Campassi
5aa2f24b2a clarification bc_dyn_stats
clarification of required parameter for bc_dyn_stats
2017-09-08 11:03:16 -05:00
Howard Chu
81fb2f5347 Silence more stupid gcc warnings 2017-09-08 11:36:49 +01:00
Guillaume LE VAILLANT
20256b7c04 Fix AC power supply detection on Linux
The /sys/class/power_supply/*/present file usually does not exist for
AC power supplies.
2017-09-08 11:07:56 +02:00
Riccardo Spagni
e5238adfb3 update checkpoint hashes 2017-09-06 17:32:48 +02:00
Gingeropolous
0e7e307ca1 update hardfork table with height and version info 2017-09-06 07:47:14 -04:00
Riccardo Spagni
d4f56bdf09 update hardcoded checkpoints 2017-09-06 09:18:46 +02:00
Riccardo Spagni
ed730511dc update checkpoints.dat 2017-09-06 09:18:40 +02:00
Thomas Winget
0299cb77ca Fix various oversights/bugs in ZMQ RPC server code
- Add some RPC commands (and touch up a couple others)
- some bounds checking
- some better pointer management
- const correctness and error handling

-- Thanks @vtnerd for type help with serialization and CMake changes
2017-09-05 12:20:40 -04:00
Thomas Winget
77986023c3 json serialization for rpc-relevant monero types
Structured {de-,}serialization methods for (many new) types
which are used for requests or responses in the RPC.

New types include RPC requests and responses, and structs which compose
types within those.

# Conflicts:
#	src/cryptonote_core/blockchain.cpp
2017-09-05 12:20:27 -04:00
Thomas Winget
5c1e08fe80 Refactor some things into more composable (smaller) functions
This commit refactors some of the rpc-related functions in the
Blockchain class to be more composable.  This change was made
in order to make implementing the new zmq rpc easier without
trampling on the old rpc.

New functions:
  Blockchain::get_num_mature_outputs
  Blockchain::get_random_outputs
  Blockchain::get_output_key
  Blockchain::get_output_key_mask_unlocked

  Blockchain::find_blockchain_supplement (overload)

functions which previously had this functionality inline now call these
functions as necessary.
2017-09-05 12:17:32 -04:00
Orestis Konstantinidis
d0bbc5912a Only check for upnp version if version is determined 2017-09-04 15:56:14 +03:00
moneromooo-monero
dbfef643ed tx_pool: catch exceptions in LockedTXN dtor
This might prevent some calls to terminate when the LockedTXN
dtor is called as part of stack unwinding caused by another
exception in the first place.
2017-09-04 10:18:38 +01:00
moneromooo-monero
e0592e87d8 dns_utils: remove a few obsolete things 2017-09-04 10:04:31 +01:00
moneromooo-monero
6ac61100a1 Add a --fluffy-blocks option to relay blocks as fluffy blocks
Defaults to off, but fluffy blocks are forced enabled on testnet
2017-09-03 11:11:11 +01:00
Howard Chu
1181848748 Use latest height for fork date estimate 2017-09-02 11:44:12 +01:00
Riccardo Spagni
02e5dcd2fa Merge pull request #2384
4e0e4e99 blockchain_import: warn for chunks over 500000, not 100000 (moneromooo-monero)
5b29e87f blockchain_import: properly cleanup core/db on exit (moneromooo-monero)
e167c4d9 blockchain_import: do not error out on truncated files (moneromooo-monero)
2017-09-02 11:32:46 +02:00
Riccardo Spagni
c919ca4f1d Merge pull request #2374
e72e625e tx_pool: wrap tx meta updates in a LockedTXN (moneromooo-monero)
2017-09-02 11:31:19 +02:00
Riccardo Spagni
1e57e48342 Merge pull request #2372
c867357a cryptonote_protocol: error handling on cleanup_handle_incoming_blocks (moneromooo-monero)
ce901fcb Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks (moneromooo-monero)
84fa015e core: guard against exceptions in handle_incoming_{block,tx} (moneromooo-monero)
2017-09-02 11:30:57 +02:00
Riccardo Spagni
ee1a766861 Merge pull request #2370
3d19ab70 Revert "Cleanup test impact of moving blockchain_db_types()" (Howard Chu)
a95e460c move db specific options to BlockchainDB (moneromooo-monero)
2017-09-02 11:30:38 +02:00
Riccardo Spagni
eb8dac52df Merge pull request #2364
63d8dddc cryptonote_protocol: remove old spans when received as old blocks (moneromooo-monero)
2017-09-02 11:30:21 +02:00
Riccardo Spagni
e19b68b005 Merge pull request #2362
adce8ae4 simplewallet: new "fee" command to display fee information (moneromooo-monero)
2017-09-02 11:30:07 +02:00
Riccardo Spagni
2560948f69 Merge pull request #2342
2e338ca5 wallet2: account for huge testnet reorgs for estimating height (moneromooo-monero)
2017-09-02 11:29:53 +02:00
Riccardo Spagni
5551fcf60b Merge pull request #2329
e3c4395a p2p: init hashes after deserializing a network address (moneromooo-monero)
2017-09-02 11:29:40 +02:00
Riccardo Spagni
eec3527e33 Merge pull request #2316
0c6c3eb3 Silence stupid fallthru warning in gcc 7 (Howard Chu)
2017-09-02 11:29:11 +02:00
Riccardo Spagni
79a0defad7 Merge pull request #2310
ea996f91 clarification of parameters for print_coinbase_tx_sum (Matthew Campassi)
2017-09-02 11:28:41 +02:00
Riccardo Spagni
10da3051c2 Merge pull request #2309
d58700e0 WalletAPI: only allow trusted daemon when importing key images (Jaquee)
8a9bbd26 WalletAPI: copy wallet data when creating a view only wallet (Jaquee)
d27fe32e wallet2: export/import wallet data functions (Jaquee)
225a25f3 import_key_images - allow importing without being connected to daemon (Jaquee)
2017-09-02 11:28:25 +02:00
moneromooo-monero
4e0e4e9942 blockchain_import: warn for chunks over 500000, not 100000
We have a lot of 350000 byte blocks now.
2017-09-01 22:48:33 +01:00
moneromooo-monero
5b29e87f85 blockchain_import: properly cleanup core/db on exit 2017-09-01 11:59:24 +01:00
moneromooo-monero
e167c4d9a1 blockchain_import: do not error out on truncated files
This will happen often when downloading from a live file
2017-09-01 11:58:51 +01:00
MaxXor
e3680b6936 Rename m_listenning_port to m_listening_port 2017-09-01 09:50:22 +02:00
rbrunner7
840aed1cf3 monero-wallet-cli: New command 'wallet_info' improved 2017-08-31 18:01:15 +02:00
Thomas Winget
9ac2ad0744 DRY refactoring 2017-08-31 07:48:27 -04:00
rbrunner7
9bdd985cee monero-wallet-cli: New command 'wallet_info' 2017-08-31 10:11:20 +02:00
Lee Clagett
9c83f8063d Do not create file when RPC user/pass is given and use file locking 2017-08-30 17:39:59 -04:00
MaxXor
b338dad241 update miniupnpc 2017-08-30 21:13:02 +02:00
MaxXor
a1ea475fff Delete UPnP port mapping on exit 2017-08-29 23:28:23 +02:00
moneromooo-monero
e72e625eb1 tx_pool: wrap tx meta updates in a LockedTXN 2017-08-29 16:35:19 +01:00
moneromooo-monero
adce8ae466 simplewallet: new "fee" command to display fee information
including expected transaction backlog at different priorities
2017-08-29 16:28:18 +01:00
moneromooo-monero
c867357adc cryptonote_protocol: error handling on cleanup_handle_incoming_blocks 2017-08-29 16:11:39 +01:00
moneromooo-monero
ce901fcb31 Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks 2017-08-29 15:43:32 +01:00
Howard Chu
3d19ab7067 Revert "Cleanup test impact of moving blockchain_db_types()"
This reverts commit 3dd34a49ef.
2017-08-29 13:28:16 +01:00
moneromooo-monero
84fa015e77 core: guard against exceptions in handle_incoming_{block,tx}
When one happens, cleanup must be called or the incoming tx
lock will stay locked
2017-08-29 13:01:45 +01:00
moneromooo-monero
a95e460c71 move db specific options to BlockchainDB
Avoids common depending on blockchain_db, which can cause
link errors.
2017-08-29 11:43:34 +01:00
moneromooo-monero
63d8dddc0a cryptonote_protocol: remove old spans when received as old blocks
fixes getting those in a loop
2017-08-28 00:42:58 +01:00
Riccardo Spagni
72b5f37f58 Merge pull request #2349
1914c999 txpool: update db tx metadata when it changes (moneromooo)
4dbf29bd txpool: add tx size median to the pool stats (moneromooo)
2017-08-27 18:15:13 +02:00
Riccardo Spagni
e00238a355 Merge pull request #2347
5807529e blockchain: cap memory size of retrieved blocks (moneromooo-monero)
c1b10381 rpc: decrease memory usage a bit in getblocks.bin (moneromooo-monero)
2017-08-27 18:13:50 +02:00
Riccardo Spagni
48f96c18df Merge pull request #2320
c656dd0e Fix refresh counter display (Howard Chu)
c088d38a Simplify readline support (Howard Chu)
2017-08-26 23:44:03 +02:00
Riccardo Spagni
36b978f50e Merge pull request #2314
c22d22e2 Cleanup test impact of adding safesyncmode() method (Howard Chu)
9a859844 Toggle SAFE syncmode on and off automatically (Howard Chu)
2017-08-26 23:43:22 +02:00
Riccardo Spagni
ff0afc196e Merge pull request #2313
3dd34a49 Cleanup test impact of moving blockchain_db_types() (Howard Chu)
80344740 More DB support cleanup (Howard Chu)
4c7f8ac0 DB cleanup (Howard Chu)
2017-08-26 23:43:09 +02:00
Riccardo Spagni
30eae5f150 Merge pull request #2353
19393115 daemon: fix backlog estimating at max block size (moneromooo-monero)
2017-08-26 23:37:30 +02:00
Riccardo Spagni
193b28506e Merge pull request #2355
f906d87e wallet: new option to check/confirm txpool backlog when sending (moneromooo-monero)
55bec1f0 rpc: add a new RPC to get current txpool backlog (sizes and fees) (moneromooo-monero)
2017-08-26 23:37:16 +02:00
moneromooo-monero
5807529e69 blockchain: cap memory size of retrieved blocks
It helps keep memory usage down when a wallet refreshes through
a string of large blocks
2017-08-26 20:53:58 +01:00
moneromooo-monero
c1b10381fc rpc: decrease memory usage a bit in getblocks.bin 2017-08-26 20:53:54 +01:00
Guillaume LE VAILLANT
58015df4cf Fix getblocktemplate RPC returning wrong reserved_offset
The byte for TX_EXTRA_TAG_PUBKEY is already included in
res.reserved_offset by the call to slow_memmem.
2017-08-26 18:38:27 +02:00
moneromooo-monero
f906d87e66 wallet: new option to check/confirm txpool backlog when sending 2017-08-26 17:16:30 +01:00
moneromooo-monero
19393115dc daemon: fix backlog estimating at max block size
Block size will pretty much never be fully used, unless all txes
are using max fee.
2017-08-26 17:11:40 +01:00
moneromooo-monero
55bec1f03d rpc: add a new RPC to get current txpool backlog (sizes and fees) 2017-08-26 16:23:31 +01:00
moneromooo
1914c999c7 txpool: update db tx metadata when it changes 2017-08-25 22:21:51 +01:00
moneromooo
4dbf29bd32 txpool: add tx size median to the pool stats 2017-08-25 22:21:38 +01:00
moneromooo-monero
2e338ca574 wallet2: account for huge testnet reorgs for estimating height 2017-08-25 11:03:51 +01:00
Riccardo Spagni
335681896a Merge pull request #2311
df0cffed cryptonote_protocol: warn if we see a higher top version we expect (moneromooo-monero)
317ab21a cryptonote_protocol: less strict check on top version on connect (moneromooo-monero)
cc81a371 cryptonote_protocol: update target height when syncing too (moneromooo-monero)
e2ad372b cryptonote_protocol: simplify and remove unnecessary casts (moneromooo-monero)
727e67ca cryptonote_protocol: print peer top height along with its version (moneromooo-monero)
b5345ef4 crypto: use malloc instead of alloca (moneromooo-monero)
80794b31 thread_group: set thread size to THREAD_STACK_SIZE (moneromooo-monero)
5524bc31 print peer id in 0 padded hex for consistency (moneromooo-monero)
8f8cc09b contrib: add sync_info to rlwrap command set (moneromooo-monero)
70b8c6d7 cryptonote_protocol: misc fixes to the new sync algorithm (moneromooo-monero)
2017-08-25 00:21:28 +02:00
Riccardo Spagni
944bbdb51e Merge pull request #2330
ea15e72d tx_pool: fix crash in stats (Howard Chu)
2017-08-25 00:18:42 +02:00
Riccardo Spagni
9b4117b401 Merge pull request #2328
679a5ab8 daemon: print estimated tx backlog in print_pool_stats (moneromooo-monero)
2017-08-25 00:17:32 +02:00
Riccardo Spagni
65ee63e5bf Merge pull request #2326
64ab8844 rpc_client: print destination host/port when failing to connect (moneromooo-monero)
333f7012 http_client: add getters for host and port (moneromooo-monero)
2017-08-25 00:17:02 +02:00
Riccardo Spagni
4ff968d0f5 Merge pull request #2306
5d989b66 core: add mainnet v6 fork height at 1400000 (moneromooo-monero)
2017-08-25 00:16:29 +02:00
Howard Chu
ea15e72d73 tx_pool: fix crash in stats
if tx receive_time == now. supersedes #2322
2017-08-23 14:22:25 +01:00
moneromooo-monero
df0cffede0 cryptonote_protocol: warn if we see a higher top version we expect 2017-08-23 13:38:18 +01:00
moneromooo-monero
317ab21a03 cryptonote_protocol: less strict check on top version on connect
This allows peers who synced past a fork on the wrong height
to reorg to the right chain after they updated their software
to include the new version.
2017-08-23 13:38:15 +01:00
moneromooo-monero
cc81a37155 cryptonote_protocol: update target height when syncing too 2017-08-23 13:38:13 +01:00
moneromooo-monero
e2ad372b87 cryptonote_protocol: simplify and remove unnecessary casts 2017-08-23 13:38:10 +01:00
moneromooo-monero
727e67cada cryptonote_protocol: print peer top height along with its version 2017-08-23 13:38:06 +01:00
moneromooo-monero
b5345ef4f0 crypto: use malloc instead of alloca 2017-08-23 13:38:03 +01:00
moneromooo-monero
80794b3114 thread_group: set thread size to THREAD_STACK_SIZE 2017-08-23 13:38:00 +01:00
moneromooo-monero
5524bc3151 print peer id in 0 padded hex for consistency 2017-08-23 13:37:56 +01:00
moneromooo-monero
e3c4395ab7 p2p: init hashes after deserializing a network address
Fixes multiple connections to the same address
2017-08-23 13:32:02 +01:00
moneromooo-monero
679a5ab85b daemon: print estimated tx backlog in print_pool_stats 2017-08-23 12:12:06 +01:00
Howard Chu
3dd34a49ef Cleanup test impact of moving blockchain_db_types() 2017-08-22 15:11:28 +01:00
Howard Chu
c22d22e2db Cleanup test impact of adding safesyncmode() method 2017-08-22 15:11:09 +01:00
moneromooo-monero
64ab88446a rpc_client: print destination host/port when failing to connect 2017-08-22 12:00:37 +01:00
moneromooo-monero
333f70120c http_client: add getters for host and port 2017-08-22 12:00:21 +01:00
moneromooo-monero
8f8cc09ba1 contrib: add sync_info to rlwrap command set 2017-08-22 11:40:41 +01:00
Howard Chu
c656dd0ede Fix refresh counter display
Suspend readline when refreshing
2017-08-22 08:30:04 +01:00
Howard Chu
c088d38a57 Simplify readline support
And don't use std::mutex
2017-08-22 08:30:04 +01:00
moneromooo-monero
70b8c6d77a cryptonote_protocol: misc fixes to the new sync algorithm
Fix sync wedge corner case:
It could happen if a connection went into standby mode, while
it was the one which had requested the next span, and that span
was still waiting for the data, and that peer is not on the
main chain. Other peers can then start asking for that data
again and again, but never get it as only that forked peer does.

And various other fixes
2017-08-21 21:57:19 +01:00
Howard Chu
0c6c3eb3f2 Silence stupid fallthru warning in gcc 7 2017-08-21 10:16:10 +01:00
Jaquee
d58700e003 WalletAPI: only allow trusted daemon when importing key images 2017-08-21 08:11:12 +02:00
Jaquee
8a9bbd26d3 WalletAPI: copy wallet data when creating a view only wallet 2017-08-21 08:11:12 +02:00
Jaquee
d27fe32e4a wallet2: export/import wallet data functions 2017-08-21 08:11:12 +02:00
Howard Chu
9a859844f4 Toggle SAFE syncmode on and off automatically
If monerod is started with default sync mode, set it to SAFE after
synchronization completes. Set it back to FAST if synchronization
restarts (e.g. because another peer has a longer blockchain).

If monerod is started with an explicit sync mode, none of this
automation takes effect.
2017-08-20 16:30:28 +01:00
Howard Chu
80344740bd More DB support cleanup
Hide DB types from db_types.h - no reason to recompile dependencies
when DB types change.

Also remove lingering in-memory DB references, they've been
obsolete since 9e82b694da
2017-08-20 13:57:36 +01:00
Howard Chu
4c7f8ac04f DB cleanup
Hide LMDB-specific stuff behind blockchain_db.h. Nobody besides blockchain_db.cpp
should ever be including DB-specific headers any more.
2017-08-19 18:11:38 +01:00
Jaquee
225a25f327 import_key_images - allow importing without being connected to daemon 2017-08-18 16:11:30 +02:00
Matthew Campassi
ea996f91b5 clarification of parameters for print_coinbase_tx_sum 2017-08-18 08:54:32 -05:00
moneromooo-monero
5d989b661a core: add mainnet v6 fork height at 1400000 2017-08-18 10:03:49 +01:00
Riccardo Spagni
4466b6d1b0 Merge pull request #2303
5a283078 cryptonote_protocol: large block sync size before v4 (moneromooo-monero)
7b747607 cryptonote_protocol: kick idle synchronizing peers (moneromooo-monero)
2017-08-17 21:39:44 +02:00
Riccardo Spagni
0d15fab49a Merge pull request #2301
1249a2a5 Construct on first use for completion_commands (Jethro Grassie)
67dd4933 Add sync lock on stop (Jethro Grassie)
2017-08-17 21:36:36 +02:00
Riccardo Spagni
4859a00134 Merge pull request #2300
42b34b35 Consistently print peer id in hex and on 16 chars (moneromooo-monero)
2017-08-17 21:36:15 +02:00
Riccardo Spagni
1d32a5a445 Merge pull request #2291
b59cd074 befor -> before (Nano Akron)
2017-08-17 21:35:48 +02:00
Riccardo Spagni
4b2cc123ff Merge pull request #2287
827afcb7 protocol: pass blockchain cumulative difficulty when syncing (moneromooo-monero)
2017-08-17 21:35:02 +02:00
moneromooo-monero
5a283078ec cryptonote_protocol: large block sync size before v4 2017-08-17 13:11:52 +01:00
moneromooo-monero
7b74760756 cryptonote_protocol: kick idle synchronizing peers
In case they dropped off downloading for any reason, they'll get
sent to download again.
2017-08-16 22:24:50 +01:00
moneromooo-monero
ef005f5e72 p2p: add a couple early outs when the stop signal is received
This avoids quicker exit
2017-08-16 15:44:52 +01:00
moneromooo-monero
80d361c795 abstract_tcp_server2: improve tracking/cancelling of early connections
We don't actually need to keep them past the call to start, as this
adds them to the config object list, and so they'll then be cancelled
already when the stop signal arrives. This allows removing the periodic
call to cleanup connections.
2017-08-16 15:41:34 +01:00
Jethro Grassie
1249a2a550 Construct on first use for completion_commands 2017-08-16 09:34:32 -04:00
Jethro Grassie
67dd4933e6 Add sync lock on stop
Also added and moved two free's hoping to fix leaks.
2017-08-16 08:58:12 -04:00
moneromooo-monero
42b34b3545 Consistently print peer id in hex and on 16 chars 2017-08-16 10:56:55 +01:00
Nano Akron
b59cd0745b befor -> before
Really unique yet consistent spelling mistake
2017-08-15 23:23:26 +01:00
moneromooo-monero
827afcb7ea protocol: pass blockchain cumulative difficulty when syncing
Not used yet.
2017-08-15 21:03:37 +01:00
Riccardo Spagni
d0a610183a Merge pull request #2297
78ecb2ad update major version number (Riccardo Spagni)
2017-08-15 21:12:25 +02:00
Riccardo Spagni
78ecb2ad0b update major version number 2017-08-15 21:04:37 +02:00
Riccardo Spagni
3ff67323b7 Merge pull request #2288
c6e200a8 core: add --db-salvage command line flag (moneromooo-monero)
2017-08-15 20:57:26 +02:00
Riccardo Spagni
061930d6b4 Merge pull request #2293
dee41efa simplewallet: mnemonic language command-line arg (Eugene Otto)
2017-08-15 20:57:09 +02:00
Riccardo Spagni
124cbe3cf3 Merge pull request #2292
cb2d5ac7 mnemonics: new Esperanto word list (moneromooo-monero)
2017-08-15 20:56:49 +02:00
Riccardo Spagni
9e6bcbc014 Merge pull request #2286
8655ba04 wallet_rpc_server: adjust small ring sizes to 5 for v6 (moneromooo-monero)
2017-08-15 20:55:30 +02:00
Riccardo Spagni
fa0c168947 Merge pull request #2285
9c6eb75c ITS#8704 add MDB_PREVSNAPSHOT flag to mdb_env_open (Howard Chu)
2017-08-15 20:55:15 +02:00
Riccardo Spagni
7b14a96c03 Merge pull request #2283
d1f204d6 miner: set thread name before logging (moneromooo-monero)
2017-08-15 20:54:53 +02:00
Riccardo Spagni
4bfb58328d Merge pull request #2282
7fdc178a p2p: fix random peer index being too large (moneromooo-monero)
2017-08-15 20:54:38 +02:00
Riccardo Spagni
e457cc7891 Merge pull request #2281
e499ff33 simplewallet: factor out message_writer (moneromooo-monero)
7ed5ab47 scoped_message_writer: pause readline to match simplewallet (moneromooo-monero)
2017-08-15 20:54:21 +02:00
Riccardo Spagni
a861cbb465 Merge pull request #2279
359517c7 wallet_rpc_server: fix possible privacy leak in on_import_key_images() (Jaquee)
20495b27 simplewallet: fix possible privacy leak in import_key_images() (Jaquee)
2017-08-15 20:53:58 +02:00
Riccardo Spagni
53dde37ceb Merge pull request #2276
a1891ebe tests: fix tests build (moneromooo-monero)
2017-08-15 20:53:41 +02:00
Riccardo Spagni
f980b2ca89 Merge pull request #2277
6ce769c1 p2p: get net log spam down a bit (moneromooo-monero)
2017-08-15 20:53:27 +02:00
Riccardo Spagni
86cf8cac86 Merge pull request #2275
88e83f94 cryptonote_protocol_handler: log versions as unsigned ints (moneromooo-monero)
2017-08-15 20:53:08 +02:00
Riccardo Spagni
74522c7e84 Merge pull request #2236
cb2d5110 Tweak net logs so we get more info on why networking can't start (moneromooo-monero)
2017-08-15 20:52:44 +02:00
Riccardo Spagni
fa73d6cbf1 Merge pull request #2274
7591c528 p2p: fallback on seed nodes if we can't make a connection (moneromooo-monero)
2017-08-15 20:52:04 +02:00
Riccardo Spagni
1d093eff67 Merge pull request #2273
0e8d60c0 cryptonote_protocol: fix recv/send idle time before handshake (moneromooo-monero)
2017-08-15 20:51:50 +02:00
Riccardo Spagni
e0df740bc9 Merge pull request #2272
f90bbe2a cryptonote_protocol: keep target in sync with dropped connections (moneromooo-monero)
2017-08-15 20:51:35 +02:00
Riccardo Spagni
b6fc7f283f Merge pull request #2270
1307e3cc WalletAPI: add getDefaultDataDir() (Jaquee)
2017-08-15 20:51:11 +02:00
Riccardo Spagni
1b54bcdc08 Merge pull request #2266
7007bd14 Change default block sync size from 200 to 20 (moneromooo-monero)
2017-08-15 20:50:44 +02:00
Riccardo Spagni
973cc7ffdf Merge pull request #2264
980e476c cryptonote_basic: fix silly CLANG warning about not emitting function (moneromooo-monero)
2017-08-15 20:50:27 +02:00
Riccardo Spagni
9721b37bd5 Merge pull request #2258
74597bd1 wallet2: improve refresh height determination (moneromooo-monero)
2017-08-15 20:49:56 +02:00
Riccardo Spagni
718941bee0 Merge pull request #2256
042b86c4 simplewallet: do not ask wallet filename twice when restoring (moneromooo-monero)
2017-08-15 20:49:26 +02:00
moneromooo-monero
cb2d5110ff Tweak net logs so we get more info on why networking can't start
This should prevent "silent" failures to start
2017-08-15 19:49:25 +01:00
Riccardo Spagni
85211cda22 Merge pull request #2255
8bbed275 simplewallet: Be explicit about secret keys (Erik de Castro Lopo)
2017-08-15 20:49:10 +02:00
Riccardo Spagni
170526dc02 Merge pull request #2253
51ebedb8 epee: remove a couple unused locals (moneromooo-monero)
2017-08-15 20:48:45 +02:00
Riccardo Spagni
085ef96768 Merge pull request #2252
9707998a wallet2: clear some missing containers in clear() (moneromooo-monero)
2017-08-15 20:48:31 +02:00
Riccardo Spagni
79479a3614 Merge pull request #2250
f4f7eeba blockchain: log more info when we reject an orphan (moneromooo-monero)
2017-08-15 20:48:08 +02:00
Riccardo Spagni
5ee3798da3 Merge pull request #2248
71e28760 debug_utilities: only build for debug builds (moneromooo-monero)
55e150ff debug_utilities: new object-sizes debug tool (moneromooo-monero)
fbaf5375 cn_deserialize: move to new debug_utilities subdirectory (moneromooo-monero)
2017-08-15 20:47:49 +02:00
Riccardo Spagni
12c70fedc0 Merge pull request #2246
d732c73e blockchain: remove a few unused variables (moneromooo-monero)
2017-08-15 20:47:32 +02:00
Riccardo Spagni
e5a1628c88 Merge pull request #2245
c8640a3d difficulty: fix misleading comment (Guillaume LE VAILLANT)
2017-08-15 20:46:48 +02:00
Riccardo Spagni
6f60613ffb Merge pull request #2240
b7d6ec83 simplewallet: add (out of sync) or (no daemon) markers in the prompt (moneromooo-monero)
fa23a500 wallet2: add a is_synced function (moneromooo-monero)
f1307bbd node_rpc_proxy: add a proxy for target height (moneromooo-monero)
2017-08-15 20:46:31 +02:00
Riccardo Spagni
4c24eb050b Merge pull request #2238
ad4649ac Enable verifying wallet password with having to load wallet. (m2049r)
2017-08-15 20:46:09 +02:00
Riccardo Spagni
1cf4665d2a Merge pull request #2237
5d4ef719 core: speed up output index unique set calculation (moneromooo-monero)
19d7f568 perf_timer: allow profiling more granular than millisecond (moneromooo-monero)
bda8c598 epee: add nanosecond timer and pause/restart profiling macros (moneromooo-monero)
2017-08-15 20:45:47 +02:00
Riccardo Spagni
d64b9c1c9e Merge pull request #2233
67ce4910 wallet2: store testnet bool in keys file (Jaquee)
2017-08-15 20:45:19 +02:00
Riccardo Spagni
da2c662cf2 Merge pull request #2232
87b5ede9 miner: fix ignoring battery from command line (moneromooo-monero)
2017-08-15 20:45:02 +02:00
Riccardo Spagni
68ccc10b29 Merge pull request #2205
c97d1bd3 wallet: return unlock_time in get_transfers (moneromooo-monero)
2017-08-15 20:44:44 +02:00
Riccardo Spagni
c1f651175a Merge pull request #2295
35e01a6e cryptonote_protocol: fix "holes" in block download schedule (moneromooo-monero)
3da1edfd cryptonote_protocol: fix out of order addition (moneromooo-monero)
6edb1b3e block_queue: do not add empty spans (moneromooo-monero)
2017-08-15 20:42:47 +02:00
moneromooo-monero
35e01a6e50 cryptonote_protocol: fix "holes" in block download schedule 2017-08-15 17:49:06 +01:00
moneromooo-monero
3da1edfde5 cryptonote_protocol: fix out of order addition
This was broken by the reorg fix, since we now have to add blocks
regardless of their starting height. We now check whether we know
the parent for the first block in the next span, or whether it was
requested. If neither, it's an orphan. If it is not known, but was
requested, we wait to get that block.
2017-08-15 16:54:08 +01:00
moneromooo-monero
6edb1b3e46 block_queue: do not add empty spans 2017-08-15 11:38:59 +01:00
moneromooo-monero
cb2d5ac788 mnemonics: new Esperanto word list
Word list authored by: Engelberg, ProkhorZ
Sources:
  Baza Radikaro Oficiala
  Reta Vortaro (http://www.reta-vortaro.de/revo/)
  Esperanto Panorama - Esperanto-English Dictionary (http://www.esperanto-panorama.net/vortaro/eoen.htm)
  ESPDIC - Paul Denisowski (http://www.denisowski.org/Esperanto/ESPDIC/espdic.txt)
2017-08-14 17:46:46 +01:00
Eugene Otto
dee41efa20 simplewallet: mnemonic language command-line arg
Add `--mnemonic-language` command-line arg so it's possible to generate a wallet
without interacting with the CLI.
2017-08-13 20:00:25 -07:00
Riccardo Spagni
70495665f9 Merge pull request #2284
2ec15a69 daemon: print peers' top height in sync_info (moneromooo-monero)
08abb670 protocol: fix reorgs while syncing (moneromooo-monero)
2017-08-13 15:59:30 +02:00
moneromooo-monero
2ec15a6931 daemon: print peers' top height in sync_info 2017-08-12 20:36:31 +01:00
moneromooo-monero
c6e200a8ab core: add --db-salvage command line flag
Use to load the database when the primary meta page is corrupted
2017-08-12 19:04:44 +01:00
moneromooo-monero
8655ba04ba wallet_rpc_server: adjust small ring sizes to 5 for v6 2017-08-12 12:59:06 +01:00
Howard Chu
9c6eb75c65 ITS#8704 add MDB_PREVSNAPSHOT flag to mdb_env_open
used to open the previous snapshot, in case the latest one
is corrupted
2017-08-12 12:21:25 +01:00
moneromooo-monero
88e83f9427 cryptonote_protocol_handler: log versions as unsigned ints
They're interpreted as characters otherwise
2017-08-12 11:57:05 +01:00
moneromooo-monero
08abb670e1 protocol: fix reorgs while syncing 2017-08-12 11:22:42 +01:00
moneromooo-monero
d1f204d640 miner: set thread name before logging 2017-08-12 09:07:40 +01:00
moneromooo-monero
7fdc178abb p2p: fix random peer index being too large 2017-08-11 14:29:55 +01:00
moneromooo-monero
e499ff3322 simplewallet: factor out message_writer 2017-08-11 13:38:42 +01:00
moneromooo-monero
7ed5ab47ea scoped_message_writer: pause readline to match simplewallet 2017-08-11 13:38:18 +01:00
Jaquee
359517c7f5 wallet_rpc_server: fix possible privacy leak in on_import_key_images() 2017-08-11 11:18:21 +02:00
Jaquee
20495b27e8 simplewallet: fix possible privacy leak in import_key_images() 2017-08-11 11:16:30 +02:00
moneromooo-monero
6ce769c123 p2p: get net log spam down a bit 2017-08-10 14:30:42 +01:00
moneromooo-monero
a1891ebea9 tests: fix tests build
Add get_fork_version and add_ideal_fork_version to core so
cryptonote_protocol does not have to need the Blockchain
class directly, as it's not in its dependencies, and add
those to the fake core classes in tests too.
2017-08-10 11:12:56 +01:00
moneromooo-monero
7591c528d0 p2p: fallback on seed nodes if we can't make a connection
This avoids failing to connect to the network in case all
known peers are unavailable (which can happen if the peer
list is small).
2017-08-09 22:55:25 +01:00
moneromooo-monero
0e8d60c06c cryptonote_protocol: fix recv/send idle time before handshake 2017-08-09 21:22:05 +01:00
moneromooo-monero
f90bbe2a5c cryptonote_protocol: keep target in sync with dropped connections
When a node is dropped, we stop considering its claimed blockchain
height as a factor in the target height calculation. This prevents
a runaway chain from being still thought to be the target even if
the nodes carrying it are dropped.
2017-08-09 20:49:24 +01:00
Riccardo Spagni
181a008aa3 Merge pull request #2271
3ff5ce63 connection_context: initialize state (moneromooo-monero)
2017-08-09 20:23:17 +02:00
moneromooo-monero
3ff5ce63c5 connection_context: initialize state
Why this was initialized properly before I have no idea, but
it is not anymore. Fix it, which fixes syncing in release mode.
2017-08-09 19:01:27 +01:00
Riccardo Spagni
f43d59d8b3 Merge pull request #2269
635929ea protocol: add checks for top block hard fork version (moneromooo-monero)
7482253a epee: fixup KV_SERIALIZE_OPT to work in more cases (moneromooo-monero)
2017-08-09 14:58:11 +02:00
Jaquee
1307e3cc12 WalletAPI: add getDefaultDataDir() 2017-08-09 12:38:29 +02:00
moneromooo-monero
635929eaca protocol: add checks for top block hard fork version
We won't even talk to a peer which claims a wrong version
for its top block. This will avoid syncing to known bad
peers in the first place.
Also add IP fails when failing to verify a block.
2017-08-09 10:28:41 +01:00
moneromooo-monero
7482253a6d epee: fixup KV_SERIALIZE_OPT to work in more cases 2017-08-09 09:30:22 +01:00
Riccardo Spagni
b3d595582a Merge pull request #2267
e49f6d43 net_node: fix m_in_timedsync initialization (moneromooo-monero)
2017-08-09 09:21:22 +02:00
moneromooo-monero
e49f6d439d net_node: fix m_in_timedsync initialization
This fixes nodes not being able to connect to nodes which use
recent code. While there, init peer_id too.
2017-08-08 17:23:02 +01:00
moneromooo-monero
7007bd1489 Change default block sync size from 200 to 20
With the new sync algorithm, the network overhead will be masked
as the thread adding blocks isn't interrupted by network calls
anymore. This should reduce memory usage a lot during sync.
2017-08-08 11:05:11 +01:00
moneromooo-monero
980e476c89 cryptonote_basic: fix silly CLANG warning about not emitting function 2017-08-08 00:33:52 +01:00
Riccardo Spagni
bfd2532ea5 Merge pull request #2247
a839a6fa Wallet API: add tx unlock time (Jaquee)
2017-08-07 23:34:06 +02:00
Riccardo Spagni
86226754a9 Merge pull request #2263
49ffb156 cmake: do not use GREATER_EQUAL, it's too new (moneromooo-monero)
2017-08-07 22:53:39 +02:00
Riccardo Spagni
bff9fb9c8b Merge pull request #2231
61770ec2 change mixin to ring size in user visible places (moneromooo-monero)
2017-08-07 22:53:15 +02:00
moneromooo-monero
49ffb156f0 cmake: do not use GREATER_EQUAL, it's too new 2017-08-07 21:37:13 +01:00
moneromooo-monero
61770ec2da change mixin to ring size in user visible places 2017-08-07 21:12:27 +01:00
Riccardo Spagni
14f479bb9c Merge pull request #2262
7f7d42f8 core: fix invalid memory access creating tx (moneromooo-monero)
2017-08-07 22:11:45 +02:00
Riccardo Spagni
62610a3a53 Merge pull request #2225
5d91b26c blockchain: skip checking tx semantics in embedded block hash range (moneromooo-monero)
2017-08-07 22:10:09 +02:00
Riccardo Spagni
f09156eb65 Merge pull request #2224
04bd1925 cmake: Update detection of external miniupnpc (Erik de Castro Lopo)
2017-08-07 22:09:42 +02:00
moneromooo-monero
7f7d42f890 core: fix invalid memory access creating tx 2017-08-07 21:09:19 +01:00
Riccardo Spagni
a796cb341e Merge pull request #2207
c93b7692 blockchain_import: much faster when verifying with cryptonote::core (moneromooo-monero)
38756d00 core: new API to disable DNS checkpoint lookups (moneromooo-monero)
2017-08-07 21:40:32 +02:00
Riccardo Spagni
3db039828e Merge pull request #2254
e31aac80 walletAPI: add getRefreshFromBlockHeight() (Jaquee)
48c0cb1b wallet api: pause refresh while commiting tx (Jaquee)
f233c01c CMakeLists.txt - ios/xcode fix (Jaquee)
2017-08-07 16:01:40 +02:00
Riccardo Spagni
9fc78023e2 Merge pull request #2259
569b9b2b updates: add "misc_log_ex.h" for logs (moneromooo-monero)
74628941 dns_utils: add <functional> for std::function (moneromooo-monero)
2017-08-07 16:01:22 +02:00
moneromooo-monero
569b9b2b50 updates: add "misc_log_ex.h" for logs 2017-08-07 14:42:08 +01:00
moneromooo-monero
74628941d5 dns_utils: add <functional> for std::function 2017-08-07 14:35:41 +01:00
moneromooo-monero
c93b7692b4 blockchain_import: much faster when verifying with cryptonote::core
Quick test with the first 56569 blocks from mainnet

version verify  batch   time
old     0       200     1:16
new     0       200     0:57
old     0       5000    0:53
new     0       5000    0:51
old     1       200     est > 1h
new     1       200     10:21
old     1       5000    est > 1h
new     1       5000    8:27
2017-08-07 14:32:49 +01:00
moneromooo-monero
38756d00ff core: new API to disable DNS checkpoint lookups 2017-08-07 14:31:06 +01:00
Riccardo Spagni
c63e9633b5 Merge pull request #2218
02f13d6c Fix handling of strings & simplify summation of spendkeys (JollyMort)
40fc9d7b Add option to join multisig wallet pieces together (JollyMort)
2017-08-07 15:28:17 +02:00
Riccardo Spagni
0bab692eee Merge pull request #2194
380009e5 README: give credit where credit is due (moneromooo-monero)
2017-08-07 15:26:26 +02:00
Riccardo Spagni
b76ba219d9 Merge pull request #2189
335fc8ab mlog: fix crash accessing stale data when rotating logs (moneromooo-monero)
2017-08-07 15:25:46 +02:00
Riccardo Spagni
6db8a60a18 Merge pull request #2149
158c3ecf core: thread most of handle_incoming_tx (moneromooo-monero)
f57ee382 cryptonote_protocol: retry stale spans early (moneromooo-monero)
90df52e1 cryptonote_protocol: light cleanup (moneromooo-monero)
84e23156 cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages (moneromooo-monero)
5be43fcd cryptonote_protocol_handler: sync speedup (moneromooo-monero)
2017-08-07 15:24:58 +02:00
Riccardo Spagni
a4151bed58 Merge pull request #2138
044c5b55 Readme: add android docker build instruction (MoroccanMalinois)
82836be4 Utils: Add dockerfile for android NDK build (MoroccanMalinois)
2017-08-07 15:21:01 +02:00
Riccardo Spagni
0dc892a538 Merge pull request #2126
98cb3fee italian translation (erciccione)
ff07cdc9 updates monero_fr.ts (erciccione)
f675fedc updates monero.ts (erciccione)
2017-08-07 15:18:04 +02:00
Riccardo Spagni
05c44db23b Merge pull request #2244
328bebbe daemon: some more include cleanup (moneromooo-monero)
2017-08-07 15:14:12 +02:00
Riccardo Spagni
dc2747439c Merge pull request #2243
4d873046 blockchain: add testnet v6 fork height at 971400 (moneromooo-monero)
2017-08-07 15:13:59 +02:00
Riccardo Spagni
b1af32b48d Merge pull request #2242
1c9196b0 cryptonote_protocol: fix days behind calc on testnet (moneromooo-monero)
2017-08-07 15:13:45 +02:00
Riccardo Spagni
15e895399c Merge pull request #2239
600353e2 fix wallet callback signatures (m2049r)
2017-08-07 15:13:30 +02:00
Riccardo Spagni
ea46a5527a Merge pull request #2234
214fd81e some include cleanup (moneromooo-monero)
2017-08-07 15:13:07 +02:00
Riccardo Spagni
9b3b7f050b Merge pull request #2230
5dd722be core: add a message when loading checkpoints at init time (moneromooo-monero)
2017-08-07 15:12:42 +02:00
Riccardo Spagni
5cc53c7e49 Merge pull request #2226
14ec6ed8 tx_pool: remove obsolete unused m_config_folder field (moneromooo-monero)
2017-08-07 15:12:29 +02:00
Riccardo Spagni
1ea75abd72 Merge pull request #2223
d37e8f88 daemon: add average seconds per block in bc_dyn_stats (moneromooo-monero)
2017-08-07 15:12:15 +02:00
Riccardo Spagni
a2dd125b1e Merge pull request #2222
878205f1 core: fix lock ordering bug at init time (moneromooo-monero)
2017-08-07 15:11:51 +02:00
Riccardo Spagni
9b0daf49db Merge pull request #2220
c6ba7d11 p2p: move m_in_timedsync from connection_context to p2p_connection_context (moneromooo-monero)
2017-08-07 15:11:37 +02:00
Riccardo Spagni
43c6e452fa Merge pull request #2219
04ebfbfe p2p: close connections when exiting (moneromooo-monero)
9a10148c p2p: fix thread leak (moneromooo-monero)
2017-08-07 15:11:20 +02:00
Riccardo Spagni
8048de268a Merge pull request #2216
d8becf2e blockchain: fix cryptonight buffer leak on exit (moneromooo-monero)
91aa90fc blockchain: ensure all blocks get their longhash precalculated (moneromooo-monero)
ff4bcaed blockchain: pass correct height to get_block_longhash (moneromooo-monero)
2017-08-07 15:11:04 +02:00
Riccardo Spagni
a6ea26e7fa Merge pull request #2215
06aea2cf move get_proof_of_trust_hash from util.h to p2p_protocol_defs.h (moneromooo-monero)
2017-08-07 15:10:42 +02:00
Riccardo Spagni
a963da9001 Merge pull request #2214
41f935dd network_throttle: remove unneeded heap allocations (moneromooo-monero)
2017-08-07 15:10:27 +02:00
Riccardo Spagni
1e2d6f898e Merge pull request #2211
525975ac wallet-cli: Minor improvement to help output (Erik de Castro Lopo)
2017-08-07 15:10:13 +02:00
Riccardo Spagni
f5be5b7e7b Merge pull request #2210
cb0b5594 Move OpenAlias console input back from libs (moneromooo-monero)
2017-08-07 15:09:45 +02:00
Riccardo Spagni
61ac6983f2 Merge pull request #2206
340feede core: randomly shuffle outputs (moneromooo-monero)
2017-08-07 15:09:31 +02:00
Riccardo Spagni
24dd5e87af Merge pull request #2203
0c57df97 wallet2: fix temporarily missing incoming tx when being mined (moneromooo-monero)
2017-08-07 15:09:17 +02:00
Riccardo Spagni
5a04301b32 Merge pull request #2201
dc0b312f wallet_rpc_server: optionally return tx blobs on transfer calls (moneromooo-monero)
5eb79983 epee: add a KV_SERIALIZE variant for optional parameters (moneromooo-monero)
2017-08-07 15:09:03 +02:00
Riccardo Spagni
58621e3f65 Merge pull request #2200
f1b76c84 cryptonote_protocol: Set send_idle_time in connection_info correctly (rbrunner7)
2017-08-07 15:08:49 +02:00
Riccardo Spagni
0f36efbded Merge pull request #2198
53af9768 blockchain: one off warning when seeing a block with unknown version (moneromooo-monero)
2017-08-07 15:08:31 +02:00
Riccardo Spagni
5ef8b76b32 Merge pull request #2197
d75cff1a Fix readline prompt when command does not output (Jethro Grassie)
2017-08-07 15:08:17 +02:00
Riccardo Spagni
52b33b5284 Merge pull request #2196
16a55347 simplewallet: show payment ids on sign_transfer (moneromooo-monero)
2017-08-07 15:08:00 +02:00
Riccardo Spagni
b6ae718456 Merge pull request #2195
599436a4 mlog: default to msgwriter logs only for log level 1 (moneromooo-monero)
58f3fc68 Make msgwriter logs go to file only (moneromooo-monero)
2017-08-07 15:07:46 +02:00
Riccardo Spagni
8494ffbc37 Merge pull request #2191
23909bb0 Make successful transfer log message more informative (JollyMort)
2017-08-07 15:07:33 +02:00
Riccardo Spagni
cf308cfb20 Merge pull request #2188
a5031a7d core: forbid duplicate ring members from v6 (moneromooo-monero)
2017-08-07 15:07:16 +02:00
Riccardo Spagni
64ebeb5aa5 Merge pull request #2182
2fac03e6 Update monerod systemd service file (Erik de Castro Lopo)
51efb217 daemon: Add ability to write a PID file (Erik de Castro Lopo)
2017-08-07 15:06:59 +02:00
Riccardo Spagni
6244c782de Merge pull request #2151
13a8d64f epee: don't send the body of the response to a HEAD HTTP request (Guillaume LE VAILLANT)
2017-08-07 15:06:45 +02:00
Riccardo Spagni
04591af7fd Merge pull request #2153
35d68b2c Fix spelling errors (Erik de Castro Lopo)
2017-08-07 14:49:15 +02:00
Riccardo Spagni
f6ee93e214 Merge pull request #2148
125f823b Add on_get_alt_blocks_hashes RPC call (moneroexamples)
2017-08-07 14:48:38 +02:00
Riccardo Spagni
ce52d94cb7 Merge pull request #2147
94717021 fix on_battery_power for linux (Ryan Mehta)
2017-08-07 14:47:43 +02:00
Riccardo Spagni
54b15447d4 Merge pull request #2141
94dd5cb4 Makefile: Add debug-static-all target (Erik de Castro Lopo)
2017-08-07 14:46:56 +02:00
Riccardo Spagni
159a6e9669 Merge pull request #2132
464afd4d Ensure DNSResolver destructor runs on exit (Howard Chu)
2017-08-07 14:46:26 +02:00
moneromooo-monero
4d87304683 blockchain: add testnet v6 fork height at 971400 2017-08-07 11:34:59 +01:00
moneromooo-monero
158c3ecff3 core: thread most of handle_incoming_tx 2017-08-07 09:33:20 +01:00
moneromooo-monero
f57ee382b8 cryptonote_protocol: retry stale spans early
Connections can be dropped by the net_node layer,
unbeknownst to cryptonote_protocol, which would then
not flush any spans scheduled to that connection,
which would cause it to be only downloaded again
once it becomes the next span (possibly after a small
delay if it had been requested less than 5 seconds
ago).
2017-08-07 09:33:17 +01:00
moneromooo-monero
90df52e12f cryptonote_protocol: light cleanup 2017-08-07 09:33:14 +01:00
moneromooo-monero
84e23156ac cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages 2017-08-07 09:33:09 +01:00
moneromooo-monero
5be43fcdba cryptonote_protocol_handler: sync speedup
A block queue is now placed between block download and
block processing. Blocks are now requested only from one
peer (unless starved).

Includes a new sync_info coommand.
2017-08-07 09:33:04 +01:00
moneromooo-monero
74597bd15a wallet2: improve refresh height determination
As reported by jaquee, the calculation could underflow for very
low heights.
Additionally, we now use the target height too.
2017-08-06 16:56:51 +01:00
moneromooo-monero
042b86c473 simplewallet: do not ask wallet filename twice when restoring
It's annoying and pointless (especially as it's the only thing
where the user is asked twice)
2017-08-06 12:28:00 +01:00
Erik de Castro Lopo
8bbed27573 simplewallet: Be explicit about secret keys
Previously, the wallet just asked for "Spend key" and "View key" but
now it specifies that these should be the secret versions of these
keys.
2017-08-06 08:37:18 +10:00
moneromooo-monero
51ebedb803 epee: remove a couple unused locals 2017-08-05 18:42:53 +01:00
Jaquee
e31aac80e5 walletAPI: add getRefreshFromBlockHeight() 2017-08-05 19:23:55 +02:00
Jaquee
48c0cb1ba6 wallet api: pause refresh while commiting tx 2017-08-05 19:21:23 +02:00
Jaquee
f233c01c8f CMakeLists.txt - ios/xcode fix 2017-08-05 19:21:10 +02:00
moneromooo-monero
9707998a08 wallet2: clear some missing containers in clear() 2017-08-05 18:09:31 +01:00
Jaquee
67ce4910bc wallet2: store testnet bool in keys file 2017-08-05 17:23:47 +02:00
moneromooo-monero
0c57df9770 wallet2: fix temporarily missing incoming tx when being mined
When scanning the txpool without having first updated the
blockchain, the tx would be seen as neither in the txpool
nor the chain, and removed, so it'd only reappear once the
chain is refreshed, and the tx seen in a block.
2017-08-05 12:36:03 +01:00
moneromooo-monero
f4f7eeba80 blockchain: log more info when we reject an orphan
We want to know what happened when a block is wrongly rejected
2017-08-04 23:26:55 +01:00
moneromooo-monero
16a5534704 simplewallet: show payment ids on sign_transfer
Integrated addresses are shown when an encrypted payment id is used
2017-08-04 19:36:02 +01:00
moneromooo-monero
71e2876033 debug_utilities: only build for debug builds 2017-08-04 14:45:43 +01:00
moneromooo-monero
55e150ff8a debug_utilities: new object-sizes debug tool
It prints the size of various interesting types, to make it
easier to match leaks to possible leaked object types
2017-08-04 14:45:38 +01:00
Jaquee
a839a6fa8a Wallet API: add tx unlock time 2017-08-03 21:37:45 +02:00
moneromooo-monero
fbaf5375c3 cn_deserialize: move to new debug_utilities subdirectory 2017-08-03 16:20:40 +01:00
moneromooo-monero
d732c73e71 blockchain: remove a few unused variables 2017-08-03 11:26:55 +01:00
m2049r
ad4649ac81 Enable verifying wallet password with having to load wallet. 2017-08-03 01:45:45 +02:00
Guillaume LE VAILLANT
c8640a3d74 difficulty: fix misleading comment 2017-08-02 23:59:48 +02:00
moneromooo-monero
328bebbe4b daemon: some more include cleanup 2017-08-02 22:43:38 +01:00
moneromooo-monero
1c9196b0c5 cryptonote_protocol: fix days behind calc on testnet 2017-08-02 22:34:02 +01:00
moneromooo-monero
b7d6ec8364 simplewallet: add (out of sync) or (no daemon) markers in the prompt
Should help people who don't realize why they haven't seen their
monero yet.
2017-08-02 14:44:42 +01:00
moneromooo-monero
fa23a5006d wallet2: add a is_synced function 2017-08-02 14:44:19 +01:00
moneromooo-monero
f1307bbd7b node_rpc_proxy: add a proxy for target height 2017-08-02 14:43:47 +01:00
moneromooo-monero
c97d1bd3d4 wallet: return unlock_time in get_transfers
also show it in simplewallet's show_transfer
2017-08-02 10:15:27 +01:00
m2049r
600353e2b2 fix wallet callback signatures 2017-08-02 01:23:53 +02:00
moneromooo-monero
41f935ddb2 network_throttle: remove unneeded heap allocations
This will keep leak traces less noisy, as those were one off
allocations that were technically leaking.
2017-08-01 18:47:05 +01:00
moneromooo-monero
c6ba7d110f p2p: move m_in_timedsync from connection_context to p2p_connection_context
It's got no place in the base class as it's P2P specific field
2017-08-01 18:41:57 +01:00
moneromooo-monero
5d4ef719b9 core: speed up output index unique set calculation
A sort+uniq step was done for every tx in a 200 block chunk,
causing a lot of repeated scanning as the size of the offset
map got larger with every added tx. We now do the step only
once at the end of the loop.
Doing it this way potentially uses more memory, but testing
shows that it's currently only about 2% more.
2017-08-01 14:06:12 +01:00
moneromooo-monero
19d7f568ce perf_timer: allow profiling more granular than millisecond 2017-08-01 14:05:20 +01:00
moneromooo-monero
bda8c5983b epee: add nanosecond timer and pause/restart profiling macros
Nanosecond timer precision won't work on Windows, but we don't
care since I'm using that just for profiling incremental code
paths, but a Windows coder is welcome to add it if there's a way.
2017-08-01 14:03:18 +01:00
moneromooo-monero
214fd81e93 some include cleanup 2017-07-31 16:36:52 +01:00
moneromooo-monero
87b5ede908 miner: fix ignoring battery from command line 2017-07-31 08:36:57 +01:00
moneromooo-monero
5dd722beaa core: add a message when loading checkpoints at init time
This uses DNS, which can take a while, so it's useful to know
this is the culprit when loading pauses
2017-07-31 06:43:13 +01:00
moneromooo-monero
14ec6ed80d tx_pool: remove obsolete unused m_config_folder field 2017-07-30 12:03:43 +01:00
moneromooo-monero
5d91b26c0f blockchain: skip checking tx semantics in embedded block hash range
If the txes are bad, this'll be picked up by the block hash mismatch
since the tx merkle root is part of the block hash.
2017-07-30 09:48:00 +01:00
Erik de Castro Lopo
04bd19257d cmake: Update detection of external miniupnpc
The version of miniupnpc in external/ uses API version 16, but the
code also seems to work for API version 10. Also remove detection
of older unsupported versions.
2017-07-30 16:28:30 +10:00
Erik de Castro Lopo
94dd5cb4a0 Makefile: Add debug-static-all target
Also make debug-all target statically link all internal libraries.
2017-07-30 09:19:39 +10:00
moneromooo-monero
d37e8f8868 daemon: add average seconds per block in bc_dyn_stats 2017-07-29 18:43:50 +01:00
moneromooo-monero
878205f143 core: fix lock ordering bug at init time 2017-07-29 12:54:02 +01:00
JollyMort
02f13d6cdf Fix handling of strings & simplify summation of spendkeys 2017-07-29 13:49:12 +02:00
moneromooo-monero
04ebfbfefa p2p: close connections when exiting
This ensures they don't leak if they were in the middle of an
async operation.
2017-07-29 10:04:36 +01:00
JollyMort
40fc9d7b68 Add option to join multisig wallet pieces together
Asks user for all the data required to merge secret keys from multisig wallets into one master wallet, which then gets full control of the multisig wallet. The resulting wallet will be the same as any other regular wallet.
2017-07-29 02:36:21 +02:00
moneromooo-monero
9a10148c01 p2p: fix thread leak 2017-07-28 22:23:05 +01:00
moneromooo-monero
d8becf2ee1 blockchain: fix cryptonight buffer leak on exit 2017-07-28 10:19:17 +01:00
moneromooo-monero
91aa90fc79 blockchain: ensure all blocks get their longhash precalculated
If the number of blocks to check was not a multiple of the
number of preparation threads, the last few blocks would
not be included in the threaded long hash calculation.
Those would still get calculated when the block gets added
to the chain, however, so this was only a tiny performance
hit, rather than a security bug.
2017-07-27 18:18:49 +01:00
moneromooo-monero
ff4bcaed81 blockchain: pass correct height to get_block_longhash 2017-07-27 18:18:20 +01:00
moneromooo-monero
06aea2cf0a move get_proof_of_trust_hash from util.h to p2p_protocol_defs.h
This avoids having to include p2p_protocol_defs.h in util.h,
as util.h is used a lot, and p2p_protocol_defs.h includes
a lot of other things that most users don't need.
2017-07-27 15:46:47 +01:00
Erik de Castro Lopo
525975acc4 wallet-cli: Minor improvement to help output 2017-07-27 20:36:28 +10:00
moneromooo-monero
cb0b559451 Move OpenAlias console input back from libs
Library code should definitely not ask for console input unless
it's clearly an input function. Delegating the user interaction
part to the caller means it can now be used by a GUI, or have a
decision algorithm better adapted to a particular caller.
2017-07-27 11:30:13 +01:00
moneromooo-monero
dc0b312f8a wallet_rpc_server: optionally return tx blobs on transfer calls
also add do_not_relay flag to them, so it now becomes possible
to create a tx without sending it yet
2017-07-26 10:33:04 +01:00
moneromooo-monero
340feedee2 core: randomly shuffle outputs
They used to be sorted by amount, which was fine before rct,
but is now suboptimal, since amounts are not known anymore.
In particular, it would give a recipient knowledge of whether
change was higher or lower than the amount received.
2017-07-25 18:57:57 +01:00
moneromooo-monero
5eb79983be epee: add a KV_SERIALIZE variant for optional parameters 2017-07-24 21:02:30 +01:00
rbrunner7
f1b76c8424 cryptonote_protocol: Set send_idle_time in connection_info correctly 2017-07-24 18:58:39 +02:00
moneromooo-monero
53af9768ce blockchain: one off warning when seeing a block with unknown version 2017-07-24 15:25:46 +01:00
Jethro Grassie
d75cff1a0e Fix readline prompt when command does not output 2017-07-24 09:54:27 -04:00
moneromooo-monero
599436a452 mlog: default to msgwriter logs only for log level 1
There might be privacy issues doing it by default
2017-07-24 10:34:52 +01:00
moneromooo-monero
58f3fc68e4 Make msgwriter logs go to file only
This was the case for monero-wallet-cli already, but not for
monerod, which was making it pretty spammy as it was duplicating
intended output. Since my original intent was to ensure logs
included command output for debugging, this achieves both.
2017-07-24 10:34:47 +01:00
moneromooo-monero
380009e541 README: give credit where credit is due 2017-07-24 09:30:56 +01:00
JollyMort
23909bb04d Make successful transfer log message more informative
"Payment successfully sent" can be misleading if the TX isn't confirmed and drops from TX-pool.
2017-07-22 23:35:53 +02:00
moneromooo-monero
335fc8ab23 mlog: fix crash accessing stale data when rotating logs 2017-07-22 19:15:44 +01:00
moneromooo-monero
a5031a7d02 core: forbid duplicate ring members from v6
This avoids someone adding what amounts to mixin 0 rings in
practice, as there is no other good reason to allow this.
2017-07-22 12:33:12 +01:00
Erik de Castro Lopo
2fac03e682 Update monerod systemd service file
Make monerod use a PID file and let systemd know where that file is.
2017-07-22 08:34:56 +10:00
Erik de Castro Lopo
51efb21713 daemon: Add ability to write a PID file
The PID file will only be written if the daemon is called with the
`--detach` command line argument and a `--pidfile /some/file/path`
argument.
2017-07-22 08:34:56 +10:00
erciccione
98cb3fee75 italian translation 2017-07-19 12:58:27 +01:00
erciccione
ff07cdc9c8 updates monero_fr.ts 2017-07-19 12:58:23 +01:00
erciccione
f675fedc49 updates monero.ts 2017-07-19 12:58:20 +01:00
Riccardo Spagni
ab594cfee9 Merge pull request #2159
6955976b Add various readline related fixes (Jethro Grassie)
2017-07-19 11:52:27 +02:00
Riccardo Spagni
e050853ed3 Merge pull request #2157
6a23cd07 Add notification on stop (Jethro Grassie)
2017-07-19 11:52:11 +02:00
Riccardo Spagni
4014f31a73 Merge pull request #2173
a02d7458 mlog: make MONERO_LOGS env var understand N,logs type spec (moneromooo-monero)
2017-07-19 11:51:50 +02:00
Riccardo Spagni
c0f155d3a0 Merge pull request #2170
c3bb6bec daemon: fix status in command line mode if using restricted rpc (moneromooo-monero)
2017-07-19 11:51:35 +02:00
Riccardo Spagni
630cc0f9ca Merge pull request #2169
f5f985c0 miner: fix background mining options parsing (moneromooo-monero)
2017-07-19 11:51:09 +02:00
Riccardo Spagni
fed3430b70 Merge pull request #2166
33d17c37 Don't hardcode /tmp (Howard Chu)
2017-07-19 11:50:38 +02:00
Riccardo Spagni
921ebdce45 Merge pull request #2165
8db68a57 Fix #2164 histogram output (Howard Chu)
2017-07-19 11:50:14 +02:00
Riccardo Spagni
27c0c742ca Merge pull request #2154
97069380 mlog: add msgwriter:INFO to log 0 and 1 defaults (moneromooo-monero)
2017-07-19 11:49:59 +02:00
Riccardo Spagni
42fc89b672 Merge pull request #2142
02d66db4 tx_pool: initialize padding in txpool meta structure (moneromooo-monero)
0722aea3 cryptonote_core: initialize checkpoint flag (moneromooo-monero)
2017-07-19 11:49:42 +02:00
Riccardo Spagni
bdc9cae3e3 Merge pull request #2140
d765cd91 epee: Remove unused variable (Erik de Castro Lopo)
2017-07-19 11:49:26 +02:00
Riccardo Spagni
999d4d83e9 Merge pull request #2135
5cea3552 simplewallet: lock idle scope when sweeping (moneromooo-monero)
2017-07-19 11:49:09 +02:00
Riccardo Spagni
f584a2de92 Merge pull request #2131
a04faf56 abstract_tcp_server2: guard against accessing lock on a destroyed object (moneromooo-monero)
2017-07-19 11:48:51 +02:00
anonimal
84d25d25d4 Docs: C4 development process addendum 2017-07-15 22:54:45 +00:00
anonimal
e022c4e932 Docs: add C4 to contributing guide 2017-07-15 22:49:48 +00:00
moneromooo-monero
a02d745844 mlog: make MONERO_LOGS env var understand N,logs type spec 2017-07-15 10:23:24 +01:00
MoroccanMalinois
044c5b5572 Readme: add android docker build instruction 2017-07-13 15:55:11 +00:00
MoroccanMalinois
82836be47e Utils: Add dockerfile for android NDK build 2017-07-13 15:54:56 +00:00
moneromooo-monero
c3bb6becd9 daemon: fix status in command line mode if using restricted rpc 2017-07-13 10:17:57 +01:00
moneromooo-monero
f5f985c018 miner: fix background mining options parsing
They were set as uint8_t, which boost was apparently treating
as a character type, rather than a numeric type
2017-07-12 11:22:50 +01:00
Howard Chu
33d17c37e8 Don't hardcode /tmp 2017-07-11 12:38:51 +01:00
Howard Chu
8db68a57f5 Fix #2164 histogram output
When there are more than 50txs, the timestamp for the last
bin was printed incorrectly. Subtracting "now" was omitted by mistake
in 3fc22e7b78
2017-07-10 15:51:03 +01:00
Jethro Grassie
6955976b2d Add various readline related fixes
- Add missing unbind key
- Fix colored messages
- Add command completion
- Preserve last command input
- Fix cursor position issues
- Fix trailing whitespace in commands
- Synchronize set_prompt
2017-07-09 09:50:04 -04:00
Jethro Grassie
6a23cd07aa Add notification on stop 2017-07-07 07:59:07 -04:00
Ryan Mehta
94717021ef fix on_battery_power for linux
fix ac/battery linux
2017-07-06 10:03:55 -07:00
moneromooo-monero
9706938016 mlog: add msgwriter:INFO to log 0 and 1 defaults
This ensures command output gets logged by default
2017-07-06 13:18:04 +01:00
Guillaume LE VAILLANT
13a8d64fe6 epee: don't send the body of the response to a HEAD HTTP request
According to the HTTP spec: "The HEAD method is identical to GET
except that the server MUST NOT return a message-body in the
response".
2017-07-05 15:39:50 +02:00
Erik de Castro Lopo
35d68b2c6d Fix spelling errors 2017-07-05 17:53:16 +10:00
moneroexamples
125f823bda Add on_get_alt_blocks_hashes RPC call 2017-07-04 12:32:44 +08:00
Riccardo Spagni
605ad09a3e Merge pull request #2130
a0d2c745 Fix issue #2119 SEGV (Howard Chu)
2017-07-03 12:51:00 +02:00
Riccardo Spagni
f9522fd0e2 Merge pull request #2127
44bfe604 enable monero build on ppc64le architecture (Roberto Oliveira)
2017-07-03 12:31:22 +02:00
Riccardo Spagni
218f1a1d69 Merge pull request #2125
f98bf48b Minor cleanup: tab vs. space + logs messages (binaryFate)
2017-07-03 12:30:46 +02:00
Riccardo Spagni
44e4bbd15c Merge pull request #2124
3b599d2b wallet2: get current height from the daemon on creation (moneromooo-monero)
d3bb72ff wallet2: fix infinite loop on future refresh height (moneromooo-monero)
32754784 wallet: fix refresh_from_height setting on new wallet (moneromooo-monero)
2017-07-03 12:30:16 +02:00
Riccardo Spagni
cde5103b7a Merge pull request #2123
eb71ebbe Formatting README.i18n.md as Markdown. (Jonathan Cross)
2017-07-03 12:29:45 +02:00
Riccardo Spagni
5689851f85 Merge pull request #2122
a282c575 Fix #2071: remove declaration of unused variable "it" in epee (binaryFate)
2017-07-03 12:29:26 +02:00
Riccardo Spagni
645c898e2d Merge pull request #2121
5a09d79c Fix #2120: return per-tx amount in transfer_split RPC call. (binaryFate)
2017-07-03 12:28:56 +02:00
Riccardo Spagni
8609ed86c4 Merge pull request #2116
841231e5 Add fuzz testing using american fuzzy lop (moneromooo-monero)
2017-07-03 12:28:33 +02:00
Riccardo Spagni
b66420e54d Merge pull request #2114
b592cb3f Fix on_transfer RPC incorrect logging info (Mike C)
2017-07-03 12:27:52 +02:00
Riccardo Spagni
7995dcff94 Merge pull request #2112
76043b17 monero-wallet-cli: hang on exit in readline code (#2117) (moneromooo-monero)
a73a42a6 monero-wallet-cli: hang on exit in readline code (#2117) (moneromooo-monero)
be9d4f04 Fix multiline wallet cli output with readline (Jethro Grassie)
2017-07-03 12:27:14 +02:00
Riccardo Spagni
bbdbccfba0 Merge pull request #2110
7d2c89b6 Add french translation (Guillaume LE VAILLANT)
3255887f simplewallet: typo fixes (Guillaume LE VAILLANT)
2017-07-03 12:26:02 +02:00
Riccardo Spagni
c577bc8762 Merge pull request #2107
bdab3436 Fix mismatch of parameter name between header file and implementation for set_user_options() (Julien Klepatch)
2017-07-03 12:24:16 +02:00
Riccardo Spagni
9e1ded69dd Merge pull request #2106
bb708ab8 electrum-words: fix seed mistakenly thought to be old style (moneromooo-monero)
2017-07-03 12:23:39 +02:00
Riccardo Spagni
40dc53c6e2 Merge pull request #2098
fdccf7e6 Add readline improvements (Jethro Grassie)
2017-07-03 12:22:03 +02:00
Riccardo Spagni
6426cc8f54 Merge pull request #2128
8f96cfc2 Remove typeid use in network_address (moneromooo-monero)
2017-07-03 12:20:58 +02:00
moneromooo-monero
02d66db4b4 tx_pool: initialize padding in txpool meta structure 2017-07-02 18:45:29 +01:00
moneromooo-monero
0722aea3df cryptonote_core: initialize checkpoint flag 2017-07-02 18:45:25 +01:00
Erik de Castro Lopo
d765cd91df epee: Remove unused variable 2017-07-02 17:47:02 +10:00
Howard Chu
a0d2c745c7 Fix issue #2119 SEGV
Due to bad refactoring in PR #2073.
timeout_handler() doesn't work as a virtual function.
2017-07-01 23:35:16 +01:00
moneromooo-monero
5cea355232 simplewallet: lock idle scope when sweeping
This ensures the chain and related structures can't change
while we're using them
2017-06-30 09:33:37 +01:00
Howard Chu
464afd4d2d Ensure DNSResolver destructor runs on exit
Plugs a noisy but benign memory leak
2017-06-28 22:21:06 +01:00
moneromooo-monero
76043b17fd monero-wallet-cli: hang on exit in readline code (#2117)
readline_buffer: move a local to local scope

Also limit the select fd limit to what we use

Signed-off-by: Jethro Grassie <jtg@xtrabass.com>
2017-06-28 07:54:29 -04:00
moneromooo-monero
a73a42a6b0 monero-wallet-cli: hang on exit in readline code (#2117)
readline_buffer: fix start/stop threads being starved by process

process could run for quite some time re-acquiring the process
lock, leaving start/stop starving. Yielding after unlock in
process is much better but doesn't seem to be enough to reliably
yield, so we sleep for a millisecond, which should be transparent
for user input anyway.

Signed-off-by: Jethro Grassie <jtg@xtrabass.com>
2017-06-28 07:54:20 -04:00
moneromooo-monero
a04faf56dc abstract_tcp_server2: guard against accessing lock on a destroyed object 2017-06-28 10:34:34 +01:00
moneromooo-monero
8f96cfc20a Remove typeid use in network_address
Since I had to add an ID to the derived classes anyway,
this can be used instead. This removes an apparently
pointless warning from CLANG too.
2017-06-28 09:11:24 +01:00
Roberto Oliveira
44bfe6048b enable monero build on ppc64le architecture
Fix wrong flags for ppc64le:
-maes - not avaiable
-march - changed by -mcpu that does the same for powerpc
2017-06-27 17:06:19 +00:00
binaryFate
a282c5756c Fix #2071: remove declaration of unused variable "it" in epee 2017-06-26 12:32:01 +02:00
binaryFate
f98bf48b1d Minor cleanup: tab vs. space + logs messages 2017-06-26 12:30:14 +02:00
binaryFate
5a09d79caf Fix #2120: return per-tx amount in transfer_split RPC call. 2017-06-26 12:22:12 +02:00
moneromooo-monero
3b599d2b7e wallet2: get current height from the daemon on creation
Use current time to estimate current height only if the daemon
cannot be queried.
2017-06-26 08:11:14 +01:00
moneromooo-monero
d3bb72fff1 wallet2: fix infinite loop on future refresh height
If the refresh height is in the future, the current code will
loop till the actual height reaches this. Fix it by bailing out
if we receive only three hashes, which is what we set in the
call parameters.
2017-06-26 06:58:37 +01:00
moneromooo-monero
32754784db wallet: fix refresh_from_height setting on new wallet
The previous patch was based on a wrong premise (that the
daemon height was 0 because the daemon calling code wasn't
yet initialized). In fact, current height approximation
was not setup for testnet. Fix this.
2017-06-26 06:58:31 +01:00
Jonathan Cross
eb71ebbecd Formatting README.i18n.md as Markdown. 2017-06-26 00:24:37 +02:00
Jethro Grassie
be9d4f0411 Fix multiline wallet cli output with readline
monero-wallet-cli commands which have multine output sometimes causes
issues with the readline support. This patch fixes show_transfers,
payments and incoming_transfers.
2017-06-25 10:48:02 -04:00
moneromooo-monero
841231e5bd Add fuzz testing using american fuzzy lop
Existing tests: block, transaction, signature, cold outputs,
cold transaction.

Data for these is in tests/data/fuzz.

A convenience shell script is in contrib/fuzz_testing/fuzz.sh, eg:

contrib/fuzz_testing/fuzz.sh signature

The fuzzer will run indefinitely, ^C to stop.

Fuzzing is currently supported for GCC only. I can't get CLANG
to build Monero here as it dies on some system headers, so if
someone wants to make it work on both, that'd be great.
In particular, the __AFL_LOOP construct should be made to work
so that a given run can fuzz multiple inputs, as the C++ load
time is substantial.
2017-06-24 16:46:18 +01:00
Jethro Grassie
fdccf7e6c3 Add readline improvements
Color prompt now working and no reprompting on exit command.
2017-06-24 07:34:56 -04:00
Riccardo Spagni
0c6ea4f8a6 Merge pull request #2111
8261ba69 readline_buffer: fix busy wait (moneromooo-monero)
2017-06-24 12:48:37 +02:00
Riccardo Spagni
a0b494aa71 Merge pull request #2103
21b939e1 readline: fix invalid memory access (moneromooo-monero)
5f8f2905 readline_buffer: add a couple const (moneromooo-monero)
2017-06-24 12:48:13 +02:00
Riccardo Spagni
57ea25017a Merge pull request #2095
f4e3dca1 unit_tests: fix build failures after network_address changes (moneromooo-monero)
2017-06-24 12:44:07 +02:00
Riccardo Spagni
50d8f73f06 Merge pull request #2091
e4da88a2 Fixed typo in rpc/core_rpc_server.cpp (Julien Klepatch)
2017-06-24 12:43:28 +02:00
Riccardo Spagni
389cd6c466 Merge pull request #2089
a85b5759 Upgrade unbound library (Erik de Castro Lopo)
2017-06-24 12:42:29 +02:00
Riccardo Spagni
f31b89012d Merge pull request #2073
07c4276c Don't issue a new timedsync while one is already in progress (Howard Chu)
cf3a376c Don't timeout a slow operation that's making progress (Howard Chu)
340830de Fix PR#2039 (Howard Chu)
2017-06-24 12:41:09 +02:00
Riccardo Spagni
f09f18fc64 Merge pull request #2069
11de4d59 Converting README.i18n to Markdown (Jonathan Cross)
2017-06-24 12:40:15 +02:00
Riccardo Spagni
05365e1726 Merge pull request #1992
d5f1cef7 simplewallet: removed unneeded LOCK_IDLE_SCOPE() from check_tx_key() (stoffu)
8df918f8 simplewallet: replace assert(m_wallet) with error out (stoffu)
8da82256 crypto: moved boost::lock_guard into a smaller scope (stoffu)
c9e0e944 Signature proving payment to destination by only revealing key derivation, not the actual tx secret key (stoffu)
2017-06-24 12:38:16 +02:00
Mike C
b592cb3f0a Fix on_transfer RPC incorrect logging info 2017-06-23 11:54:10 -04:00
moneromooo-monero
8261ba69e6 readline_buffer: fix busy wait
It'd eat up a core constantly, due to spending its time jumping
back and forth between userland and kernel. We now wait for up
to a millisecond in kernel, which will be transparent to the user
and drop to idle most of the time.
2017-06-23 13:21:50 +01:00
Guillaume LE VAILLANT
7d2c89b6c7 Add french translation 2017-06-23 14:04:56 +02:00
Guillaume LE VAILLANT
3255887f5e simplewallet: typo fixes 2017-06-23 14:04:44 +02:00
Julien Klepatch
bdab3436d3 Fix mismatch of parameter name between header file and implementation for set_user_options() 2017-06-23 05:16:11 +08:00
moneromooo-monero
bb708ab8c3 electrum-words: fix seed mistakenly thought to be old style
It'd see "empty" words due to extraneous spaces
2017-06-22 16:47:07 +01:00
stoffu
d5f1cef73c simplewallet: removed unneeded LOCK_IDLE_SCOPE() from check_tx_key() 2017-06-22 18:11:20 +09:00
stoffu
8df918f8c7 simplewallet: replace assert(m_wallet) with error out 2017-06-22 18:11:18 +09:00
stoffu
8da82256d4 crypto: moved boost::lock_guard into a smaller scope 2017-06-22 18:11:15 +09:00
stoffu
c9e0e944e9 Signature proving payment to destination by only revealing key derivation, not the actual tx secret key 2017-06-22 18:11:13 +09:00
Riccardo Spagni
038e6cd33e Merge pull request #2094
007937e2 net_utils_base: added missing template keyword (kenshi84)
2017-06-21 21:57:03 +02:00
moneromooo-monero
21b939e1e6 readline: fix invalid memory access
m_cout_buf was not initialized
2017-06-21 17:33:47 +01:00
moneromooo-monero
5f8f290505 readline_buffer: add a couple const 2017-06-21 17:33:30 +01:00
moneromooo-monero
f4e3dca113 unit_tests: fix build failures after network_address changes 2017-06-19 11:26:02 +01:00
kenshi84
007937e217 net_utils_base: added missing template keyword 2017-06-19 08:11:28 +09:00
Riccardo Spagni
ae8841f2ab Merge pull request #2087
4e13ab30 wallet_api: fix missing transaction parameter in callback (moneromooo-monero)
2017-06-18 17:36:55 +02:00
Riccardo Spagni
78f965a9e2 Merge pull request #2082
235df7f4 blockchain_db: add a txpool tx getter which returns existence (moneromooo-monero)
2017-06-18 17:36:12 +02:00
Riccardo Spagni
91e1a7e3e2 Merge pull request #2081
b2319a03 simplewallet: new command to generate a random payment id (moneromooo-monero)
2017-06-18 17:34:41 +02:00
Riccardo Spagni
973daf853b Merge pull request #2079
c3bec61d core_tests: fix tests failing due to new txpool code requitring batch transactions (moneromooo-monero)
2017-06-18 17:33:57 +02:00
Riccardo Spagni
f973a2f81a Merge pull request #2078
1dd52415 Fix #1991 asm multiply again (Howard Chu)
2017-06-18 17:32:03 +02:00
Riccardo Spagni
fb7d6db051 Merge pull request #2076
ac0714dc add simplewallet --generate-new-wallet arg checks (Michael Shick)
2017-06-18 17:27:52 +02:00
Riccardo Spagni
ae5f7c71d7 Merge pull request #2074
e1f3dfcc Add readline support to cli (jethro)
2017-06-18 17:26:08 +02:00
Riccardo Spagni
88b7cb9bda Merge pull request #2070
71f8249a Prevent crash if performing certain actions before wallet is initialized (Robby Weinberg)
2017-06-18 16:43:35 +02:00
Riccardo Spagni
ace1440b65 Merge pull request #2066
3fc22e7b Add histogram to poolstats (Howard Chu)
d09620b0 Fix PR#2039 (Howard Chu)
2017-06-18 16:41:42 +02:00
Riccardo Spagni
a0174ad534 Merge pull request #2064
6fc2dc39 cryptonote_protocol_handler: fix crash in debug log (moneromooo-monero)
2017-06-18 16:40:52 +02:00
jethro
e1f3dfccc8 Add readline support to cli
This PR adds readline support to the daemon and monero-wallet-cli. Only
GNU readline is supported (e.g. not libedit) and there are cmake checks
to ensure this.

There is a cmake variable, Readline_ROOT_DIR that can specify a
directory to find readline, otherwise some default paths are searched.

There is also a cmake option, USE_READLINE, that defaults to ON. If set
to ON, if readline is not found, the build continues but without
readline support.

One negative side effect of using readline is that the color prompt in
the wallet-cli now has no color and just uses terminal default. I know
how to fix this but it's quite a big change so will tackle another time.
2017-06-18 10:08:37 -04:00
Riccardo Spagni
421a6d0340 Merge pull request #2055
1b75ad91 Add OSX background mining (jethro)
2017-06-18 14:24:48 +02:00
Riccardo Spagni
a237f90c5b Merge pull request #2052
072102cf abstracted nework addresses (moneromooo-monero)
2017-06-18 14:23:59 +02:00
Julien Klepatch
e4da88a223 Fixed typo in rpc/core_rpc_server.cpp 2017-06-18 16:12:54 +08:00
Erik de Castro Lopo
a85b5759f3 Upgrade unbound library
These files were pulled from the 1.6.3 release tarball.

This new version builds against OpenSSL version 1.1 which will be
the default in the new Debian Stable which is due to be released
RealSoonNow (tm).
2017-06-17 23:04:00 +10:00
Howard Chu
07c4276cbe Don't issue a new timedsync while one is already in progress
A timedsync is issued every minute on a connection, but the input
tineout is 2 minutes. This means a new sync request could be issued
while a slow sync request was already in progress. The additional
request will further clog the network on a slow connection, and
cause a premature timeout.
2017-06-15 16:54:03 +01:00
Howard Chu
cf3a376cb5 Don't timeout a slow operation that's making progress
If we got at least MIN_BYTES_WANTED (default 512) during any network
poll, reset the timeout to allow more time for data to arrive.
2017-06-15 16:54:03 +01:00
Howard Chu
340830de5b Fix PR#2039
Missed a crypto -> cncrypto rename
2017-06-15 16:54:03 +01:00
moneromooo-monero
4e13ab306a wallet_api: fix missing transaction parameter in callback
It was unused, so harmless

Reported by erikd on IRC
2017-06-13 19:34:51 +01:00
moneromooo-monero
235df7f484 blockchain_db: add a txpool tx getter which returns existence
Avoids exception spam for the "nope, not found" case
2017-06-11 15:36:48 +01:00
moneromooo-monero
b2319a03a6 simplewallet: new command to generate a random payment id
This is trivial, but often requested, and possibly hard to do
in Windows. That makes it more user friendly.
2017-06-10 10:08:55 +01:00
moneromooo-monero
c3bec61da2 core_tests: fix tests failing due to new txpool code requitring batch transactions 2017-06-09 20:49:59 +01:00
Howard Chu
1dd524151d Fix #1991 asm multiply again
Tweak temp variables and constraints. Was working before if not inlined
but newer gcc tends to inline it.
2017-06-08 21:46:40 +01:00
jethro
1b75ad91aa Add OSX background mining
Implements miner::get_system_times, miner::get_process_time and
miner::on_battery_power for OSX so that background mining works on OSX.
2017-06-08 09:26:09 -04:00
Michael Shick
ac0714dcd7 add simplewallet --generate-new-wallet arg checks
Add fail-fast paths that reduce frustration around the misuse of
--wallet-file combined with --restore-deterministic-wallet.  Flow now
gives more descriptive errors and avoids having users type in their
whole seed before the failure condition is noticed.
2017-06-07 07:46:59 -07:00
Howard Chu
3fc22e7b78 Add histogram to poolstats 2017-06-04 22:48:14 +01:00
Howard Chu
d09620b0e2 Fix PR#2039
Missed a crypto -> cncrypto rename
2017-06-04 22:48:13 +01:00
Jonathan Cross
11de4d59ea Converting README.i18n to Markdown 2017-06-04 13:44:45 +02:00
Robby Weinberg
71f8249a08 Prevent crash if performing certain actions before wallet is initialized 2017-06-03 19:56:51 -05:00
moneromooo-monero
6fc2dc3927 cryptonote_protocol_handler: fix crash in debug log 2017-06-01 19:42:33 +01:00
Riccardo Spagni
e3da0ca828 Merge pull request #2059
fa489a26 Fix PR#2039 (Howard Chu)
2017-06-01 19:43:54 +02:00
Riccardo Spagni
ea286d1a14 Merge pull request #2058
6bcd3b2d fix get_upper_transaction rename (schnerchi)
2017-06-01 19:42:37 +02:00
Riccardo Spagni
3d397325bf Merge pull request #2063
d17c0fc2 Don't copy blockchain for coinbase_tx_sum (Howard Chu)
2017-06-01 19:33:43 +02:00
Riccardo Spagni
4a60e9e66e Merge pull request #2062
31417d57 tx_pool: add missing blockchain lock in add_tx (moneromooo-monero)
2017-06-01 19:33:17 +02:00
Riccardo Spagni
fbfad8ee1b Merge pull request #2061
5414970d Speedup print_pool_stats (Howard Chu)
2017-06-01 19:32:37 +02:00
Howard Chu
5414970dcd Speedup print_pool_stats
Since we're just counting txs, there's no reason to deserialize all the blobs.
2017-06-01 17:34:03 +01:00
Howard Chu
d17c0fc2d0 Don't copy blockchain for coinbase_tx_sum
Changed Blockchain::for_all_blocks() to for_blocks_range()
Operate on blockchain in-place instead of building a copy first.
2017-06-01 14:14:24 +01:00
moneromooo-monero
31417d57da tx_pool: add missing blockchain lock in add_tx 2017-05-31 22:55:13 +01:00
Howard Chu
fa489a26ef Fix PR#2039
Missed a crypto -> cncrypto rename
2017-05-31 15:34:31 +01:00
schnerchi
6bcd3b2df1 fix get_upper_transaction rename 2017-05-31 12:26:42 +02:00
Riccardo Spagni
8fbbefb8db Merge pull request #2053
05f3dcf7 simplewallet: fix refresh height for new wallets (moneromooo-monero)
2017-05-30 21:28:40 +02:00
Riccardo Spagni
2f724e5849 Merge pull request #2054
977c2186 easylogging++: log timestamps in GMT for privacy (moneromooo-monero)
2017-05-30 21:26:30 +02:00
Riccardo Spagni
f5e65452ce Merge pull request #2042
740bc24c Wallet API: Set seed lang when recovering form keys (Jaquee)
2017-05-30 21:24:45 +02:00
Riccardo Spagni
a4c13ea092 Merge pull request #2039
4b932ff3 changed crypto to cncrypto so it generated libcncrypto (Gentian)
2017-05-30 21:24:11 +02:00
Riccardo Spagni
4284f1777d Merge pull request #2038
89e20bb9 Fix typo (xmr-eric)
2017-05-30 21:23:25 +02:00
Riccardo Spagni
cd13bcb4d2 Merge pull request #2036
89b2f306 tests: fix invalid key image test (moneromooo-monero)
a374a522 wallet2: check key image validity domain in import_key_images (moneromooo-monero)
2017-05-30 21:23:05 +02:00
Riccardo Spagni
8b1c11c3c9 Merge pull request #2035
45e9838b unbound: update some EVP APIs to new names (Howard Chu)
2017-05-30 21:22:22 +02:00
Riccardo Spagni
9ea7fbed8a Merge pull request #2032
dd8e3266 shared libs build (i.e. make debug) (stoffu)
2017-05-30 21:21:36 +02:00
Riccardo Spagni
907ce14b18 Merge pull request #2026
a5739201 Update sync time copy (xmr-eric)
2017-05-30 21:20:39 +02:00
Riccardo Spagni
d621f9e558 Merge pull request #2022
e2529347 Correct spelling of 'get_upper_transaction_size_limit' (Nano Akron)
3029d0ef Remove the 1.25x multiplier in max transaction size in just the wallet (Nano Akron)
2017-05-30 21:19:00 +02:00
Riccardo Spagni
62cc3b6447 Merge pull request #2021
8ac2496c corrected typo in help regarding min-outputs-* (stoffu)
2017-05-30 21:15:33 +02:00
Riccardo Spagni
024860b49d Merge pull request #2020
6cb1ad1f wallet fix: ensure iterator to be valid (stoffu)
2017-05-30 21:14:24 +02:00
Riccardo Spagni
1555e7673d Merge pull request #2017
0a182576 node_rpc_proxy: fix earliest fork height query for unknown forks (moneromooo-monero)
391c918d wallet2: fix sweep_unmixable assuming wrong minimum mixin at v5 (moneromooo-monero)
2017-05-30 21:13:47 +02:00
Riccardo Spagni
40eb22aeb4 Merge pull request #2016
d1db3251 Fix overlooked renaming of Português in the unit tests (Nano Akron)
2017-05-30 21:13:22 +02:00
Riccardo Spagni
545e2b003c Merge pull request #1982
b52abd13 Move txpool to the database (moneromooo-monero)
2017-05-30 21:12:44 +02:00
moneromooo-monero
977c2186c9 easylogging++: log timestamps in GMT for privacy 2017-05-28 13:20:27 +01:00
moneromooo-monero
05f3dcf738 simplewallet: fix refresh height for new wallets
With the recent change to wallet creation code, the code was
calling to the daemon before the wallet's daemon address was
initialized, and thus failing. This was causing all new wallets
to refresh from 0 instead of just fetching early block hashes.
2017-05-28 13:17:32 +01:00
moneromooo-monero
072102cfd2 abstracted nework addresses
All code which was using ip and port now uses a new IPv4 object,
subclass of a new network_address class. This will allow easy
addition of I2P addresses later (and also IPv6, etc).
Both old style and new style peer lists are now sent in the P2P
protocol, which is inefficient but allows peers using both
codebases to talk to each other. This will be removed in the
future. No other subclasses than IPv4 exist yet.
2017-05-27 11:35:54 +01:00
moneromooo-monero
0a182576d0 node_rpc_proxy: fix earliest fork height query for unknown forks 2017-05-26 21:34:44 +01:00
moneromooo-monero
b52abd1370 Move txpool to the database
Integration could go further (ie, return_tx_to_pool calls should
not be needed anymore, possibly other things).

poolstate.bin is now obsolete.
2017-05-25 22:23:37 +01:00
Jaquee
740bc24c95 Wallet API: Set seed lang when recovering form keys 2017-05-23 14:01:23 +02:00
Gentian
4b932ff314 changed crypto to cncrypto so it generated libcncrypto
fix a cmakelist
2017-05-23 07:45:40 -04:00
xmr-eric
89e20bb9af Fix typo 2017-05-19 00:40:51 -04:00
moneromooo-monero
89b2f3061b tests: fix invalid key image test
It was using an invalid key image which wasn't in the key image
domain, so the transaction was rejected earlier than the test
was expecting
2017-05-18 09:19:55 +01:00
moneromooo-monero
a374a522df wallet2: check key image validity domain in import_key_images 2017-05-18 09:19:48 +01:00
Howard Chu
45e9838bb1 unbound: update some EVP APIs to new names
Replace EVP_VerifyInit with EVP_DigestInit, and EVP_VerifyUpdate
with EVP_DigestUpdate. Reported/requested by hyc, changed by mooo.
2017-05-17 22:33:16 +01:00
stoffu
dd8e3266b2 shared libs build (i.e. make debug) 2017-05-17 10:17:08 +09:00
xmr-eric
a57392016b Update sync time copy 2017-05-10 14:34:18 -04:00
Nano Akron
e2529347b6 Correct spelling of 'get_upper_transaction_size_limit' 2017-05-09 16:02:57 +01:00
Nano Akron
3029d0efb3 Remove the 1.25x multiplier in max transaction size in just the wallet 2017-05-09 16:01:11 +01:00
stoffu
8ac2496c5d corrected typo in help regarding min-outputs-* 2017-05-09 12:06:46 +09:00
stoffu
6cb1ad1fa2 wallet fix: ensure iterator to be valid 2017-05-09 11:54:21 +09:00
moneromooo-monero
391c918d87 wallet2: fix sweep_unmixable assuming wrong minimum mixin at v5
The bump to minimum mixin 4 was moved from v5 to v6
2017-05-07 18:27:25 +01:00
Nano Akron
d1db32511c Fix overlooked renaming of Português in the unit tests 2017-05-07 16:36:03 +01:00
Riccardo Spagni
694470fae7 Merge pull request #2015
b7ae0911 GUI: easylogging++ install target (Jaquee)
2017-05-06 19:41:25 +02:00
Jaquee
b7ae09111d GUI: easylogging++ install target 2017-05-06 17:07:36 +02:00
Riccardo Spagni
81b370d5a1 Merge pull request #2012
bbf4c210 Wallet API: add spend/view key getters (Jaquee)
2017-05-05 11:35:03 +02:00
Riccardo Spagni
cf3b108ef5 Merge pull request #2009
777684e0 Update README.md instructions for Boost 1.64 and a little bit of formatting (Nano Akron)
2017-05-05 11:34:02 +02:00
Riccardo Spagni
c9a2cf9d4c Merge pull request #2008
6f12b525 Note that this build is community contributed. (Martin Wimpress)
1ff5b5f1 Add snap install instructions (Martin Wimpress)
2017-05-05 11:33:15 +02:00
Riccardo Spagni
6c48494c5a Merge pull request #2006
7199fc83 Removed some unused epee functions (Lee Clagett)
2017-05-05 11:31:59 +02:00
Riccardo Spagni
b3dd7f9ab2 Merge pull request #2004
5f9353bd Linking i18n internationalization file (Jkat)
2017-05-05 11:30:37 +02:00
Riccardo Spagni
c17102c385 Merge pull request #2002
12fff108 Change Old_English to English_Old - 'Old English' is actually a language (Nano Akron)
533187f0 Change all wallet language names into native names (and scripts) (Nano Akron)
2017-05-05 11:29:51 +02:00
Riccardo Spagni
28ecac2671 Merge pull request #2000
710b2e80 Silence clang++ warnings (Howard Chu)
2017-05-05 11:26:38 +02:00
Riccardo Spagni
ed09652a17 Merge pull request #1701
8277e67f Add anchor connections (Miguel Herranz)
2017-05-05 11:26:11 +02:00
Riccardo Spagni
f76fd38baa Merge pull request #1997
5d86c9f4 easylogging++: default to creating categories by default (moneromooo-monero)
2017-05-05 11:24:04 +02:00
Riccardo Spagni
bef164f5ce Merge pull request #1995
66ecee09 Docs: add VRP link to README (anonimal)
1a66db8f Docs: add Vulnerability Response Process (anonimal)
2017-05-05 11:23:44 +02:00
Riccardo Spagni
5566951eba Merge pull request #1986
6df83b3e wallet: add sweep_below function (moneromooo-monero)
2017-05-05 11:22:46 +02:00
Jaquee
bbf4c21048 Wallet API: add spend/view key getters 2017-05-02 16:48:38 +02:00
Martin Wimpress
6f12b525e8 Note that this build is community contributed.
As requested this pull request add a note that this snap is community contributed. It also adds some more explanation of what  a snap is.
2017-04-28 15:12:21 +01:00
Nano Akron
777684e0c1 Update README.md instructions for Boost 1.64 and a little bit of formatting 2017-04-27 21:18:05 +01:00
Martin Wimpress
1ff5b5f10a Add snap install instructions
Monero is now published in the Snap store, this pull request add instructions for installing the snap.
2017-04-27 12:42:24 +01:00
Lee Clagett
7199fc8373 Removed some unused epee functions 2017-04-25 16:07:32 -04:00
Jkat
5f9353bde1 Linking i18n internationalization file 2017-04-25 08:54:42 -04:00
anonimal
66ecee0942 Docs: add VRP link to README 2017-04-24 20:11:10 +00:00
anonimal
1a66db8f33 Docs: add Vulnerability Response Process 2017-04-24 20:11:09 +00:00
Nano Akron
12fff108ea Change Old_English to English_Old - 'Old English' is actually a language 2017-04-24 20:27:12 +01:00
moneromooo-monero
6df83b3efb wallet: add sweep_below function
It sweeps all outputs below the given threshold

This is available via the existing sweep_all RPC, by setting
amount_threshold the desired amount (in atomic units)
2017-04-24 19:50:37 +01:00
Nano Akron
533187f0c3 Change all wallet language names into native names (and scripts) 2017-04-24 11:17:33 +01:00
Riccardo Spagni
9a9fb0483f Merge pull request #1996
a6d5bb75 wallet2: refer to triangular distribution for recent zone in comment (moneromooo-monero)
ac1aba90 wallet2: bias fake outs more towards recent outputs (moneromooo-monero)
2017-04-24 10:55:24 +02:00
Riccardo Spagni
999b0f399d Merge pull request #1989
7f4beaa4 wallet2: fix removal of wrong txes from unconfirmed_payments (moneromooo-monero)
2017-04-24 10:50:54 +02:00
Riccardo Spagni
0385999cda Merge pull request #1984
a255a540 simplewallet: allow multiline seed (moneromooo-monero)
5fce581c mnemonics: ignore multiple whitespace between words (moneromooo-monero)
2017-04-24 10:49:51 +02:00
Riccardo Spagni
e53dd76a49 Merge pull request #1983
72d113dd Amended software licenses for Portuguese and Spanish (Nano Akron)
54bcd260 Added Simplified Chinese electrum word list (Nano Akron)
2017-04-24 10:49:24 +02:00
Riccardo Spagni
ae1d816768 Merge pull request #1976
a7d78dda wallet2: fix --generate-from-json in RPC mode (moneromooo-monero)
2017-04-24 10:48:56 +02:00
Riccardo Spagni
ed082a747a Merge pull request #1973
e9fb44ed wallet cli: removed some inappropriate return-false (kenshi84)
2017-04-24 10:48:20 +02:00
Riccardo Spagni
e0b5a8349f Merge pull request #1972
934d8b57 changed kenshi84's GPG key (kenshi84)
2017-04-24 10:47:27 +02:00
Riccardo Spagni
865bb03ecf Merge pull request #1968
5e5b8512 Fix obsolete OpenSSL API usage (hyc)
6c72d6a0 Fix Android recognition (hyc)
e65d66fe Fix ARM64 identification (hyc)
a4673218 Clean up ARMv8-a aes_expand_key() (hyc)
a3d77901 Fix block_longhash_worker thread (hyc)
2017-04-24 10:46:23 +02:00
Riccardo Spagni
470ac0bfc7 Merge pull request #1967
6e985996 Easylogging: ELPP_STACKTRACE_ON_CRASH moved to ELPP_FEATURE_CRASH_LOG (MoroccanMalinois)
2017-04-24 10:46:01 +02:00
Riccardo Spagni
c1691ed58e Merge pull request #1966
7ff19f1e Easylogging: remove invalid static in function member definition (MoroccanMalinois)
2017-04-24 10:45:22 +02:00
Riccardo Spagni
042924b355 Merge pull request #1965
35755a91 Spelling mistake in About this project  paragraph (Andrei Muresan)
2017-04-24 10:44:49 +02:00
Riccardo Spagni
3d59ec7e68 Merge pull request #1962
aa02ff7f mv "Contributing" above install, compile, etc (Mike C)
a55bb375 Add link to CONTRIBUTING to README.md (Mike C)
09bbf96d Grouping CONTRIBUTING into digestable sections (Mike C)
dc35c736 Rename CONTRIBUTING to CONTRIBUTING.md (Mike C)
2017-04-24 10:44:10 +02:00
Riccardo Spagni
29a77c9b19 Merge pull request #1961
89d70756 wallet2: fix spurious output splitting when not merging destinations (moneromooo-monero)
2017-04-24 10:43:39 +02:00
Riccardo Spagni
0a6da8929d Merge pull request #1959
10e137be wallet2: mention escaping/quoting --password in help string (moneromooo-monero)
2017-04-24 10:43:13 +02:00
Riccardo Spagni
f65d739c41 Merge pull request #1954
110b6831 Resolve #92 add ability to create wallets thru RPC (Howard Chu)
2017-04-24 10:42:10 +02:00
Riccardo Spagni
acbe0b4849 Merge pull request #1938
bff90264 Add expected total reward to RPC "getblocktemplate". Only works from V5 fork onward - returns 0 before that block. (assylias)
2017-04-24 10:41:32 +02:00
Riccardo Spagni
a059e91d7f Merge pull request #1816
93e10f1c Simplified the implementation and features of span (Lee Clagett)
4a8f96f9 Improvements for epee binary to hex functions: (Lee Clagett)
2017-04-24 10:29:19 +02:00
Howard Chu
710b2e80c6 Silence clang++ warnings
Using defined(foo) in a macro expansion is undefined.
2017-04-23 23:44:19 +01:00
moneromooo-monero
5d86c9f4d5 easylogging++: default to creating categories by default
This avoids error spews from easylogging++ when we try to log
something before easylogging is initialized, which can happen
when errors happen at command line parsing time
2017-04-22 12:15:57 +01:00
moneromooo-monero
a6d5bb75fe wallet2: refer to triangular distribution for recent zone in comment
It was wrongly refering to equiprobable distribution, which I think
I'd originally done, but forgot to update the comment after changing
to triangular

Reported by smooth on IRC
2017-04-22 11:22:39 +01:00
moneromooo-monero
ac1aba90f8 wallet2: bias fake outs more towards recent outputs
Two recent papers quantified the real usage bias for the
real output in a ring being the true one, and shows that
the current biasing is much too weak.

While we wait for a better solution, we increase the ratio
of recent-to-total fake outputs, as well as decrease the
time window for recent outputs, so that half the fake outs
are selected within the last 1.8 day. Value plucked from
figure 10, page 11 of An Empirical Analysis of Linkability
in the Monero Blockchain, 2017, Miller et al.

This is also arbitrary, of course, but serves as a stopgap
till a better selection algorithm is chosen.
2017-04-22 10:29:03 +01:00
assylias
bff90264b8 Add expected total reward to RPC "getblocktemplate".
Only works from V5 fork onward - returns 0 before that block.
2017-04-19 18:28:16 +01:00
moneromooo-monero
7f4beaa44a wallet2: fix removal of wrong txes from unconfirmed_payments
unconfirmed_payments changed from having the txid as key to
the payment id, and this was not changed to match.
2017-04-17 19:37:13 +01:00
Nano Akron
72d113dd38 Amended software licenses for Portuguese and Spanish 2017-04-16 12:15:59 +01:00
Nano Akron
54bcd260ff Added Simplified Chinese electrum word list 2017-04-16 12:06:53 +01:00
moneromooo-monero
a255a5407f simplewallet: allow multiline seed
People are likely to enter it in three lines as it is how it
is displayed at creation time
2017-04-16 11:52:30 +01:00
moneromooo-monero
5fce581ce3 mnemonics: ignore multiple whitespace between words 2017-04-16 11:29:21 +01:00
moneromooo-monero
a7d78dda77 wallet2: fix --generate-from-json in RPC mode
The daemon address was initialized too late
2017-04-14 22:12:20 +01:00
MoroccanMalinois
7ff19f1ec4 Easylogging: remove invalid static in function member definition 2017-04-12 23:01:16 +00:00
hyc
5e5b8512d6 Fix obsolete OpenSSL API usage
EVP_dss1() was deprecated and EVP_sha1() is the direct replacement.
Upstream libunbound already has this patch. Note that I haven't
added a test for HAVE_EVP_DSS1 since that was deprecated quite a
long time ago in OpenSSL, there's really no reason to support it.
2017-04-12 23:56:23 +01:00
hyc
6c72d6a058 Fix Android recognition
The official macro is __ANDROID__; ANDROID may or may not be defined.
2017-04-12 23:55:29 +01:00
hyc
e65d66fe04 Fix ARM64 identification
The actual arch flag the compiler recognizes is "armv8-a".
This is true for both gcc and clang.
2017-04-12 23:54:33 +01:00
hyc
a467321800 Clean up ARMv8-a aes_expand_key()
The inline asm was lying about its parameters
2017-04-12 23:53:08 +01:00
hyc
a3d779013d Fix block_longhash_worker thread
Wasn't getting its stack size initialized; crashes on Android
with a default stack size of 1MB.
2017-04-12 23:51:18 +01:00
MoroccanMalinois
6e98599634 Easylogging: ELPP_STACKTRACE_ON_CRASH moved to ELPP_FEATURE_CRASH_LOG 2017-04-12 22:47:59 +00:00
kenshi84
934d8b57c0 changed kenshi84's GPG key 2017-04-12 21:37:22 +09:00
kenshi84
e9fb44ed3c wallet cli: removed some inappropriate return-false 2017-04-12 21:33:19 +09:00
Lee Clagett
93e10f1cc4 Simplified the implementation and features of span 2017-04-11 16:35:14 -04:00
Lee Clagett
4a8f96f95d Improvements for epee binary to hex functions:
- Performance improvements
  - Added `span` for zero-copy pointer+length arguments
  - Added `std::ostream` overload for direct writing to output buffers
  - Removal of unused `string_tools::buff_to_hex`
2017-04-11 16:35:00 -04:00
Andrei Muresan
35755a91a0 Spelling mistake in About this project paragraph
I corrected a spelling mistake in the About this project paragraph.
2017-04-11 22:09:37 +03:00
Howard Chu
110b683152 Resolve #92 add ability to create wallets thru RPC
Reviewed and squashed. Open/Create is only allowed if no walletfile
was specified at startup.
2017-04-11 01:22:44 +01:00
Riccardo Spagni
9ed496bbc5 Merge pull request #1956
eb20f720 daemon: print average fee per byte in print_pool_stats (moneromooo-monero)
37be70bb daemon: add fee/byte when print pool transaction info (moneromooo-monero)
893f5a30 tx_pool: add blob size and fee/byte when logging a new tx (moneromooo-monero)
2017-04-11 00:34:46 +02:00
Riccardo Spagni
c8dd4c58ce Merge pull request #1955
5b632468 core: fix blob size cache, and reenable hash and blob size caches (moneromooo-monero)
2017-04-11 00:34:03 +02:00
Riccardo Spagni
878c4ee913 Merge pull request #1952
548075b1 daemon: new relay_tx command and RPC (moneromooo-monero)
2017-04-11 00:32:30 +02:00
Riccardo Spagni
4be94be168 Merge pull request #1951
0a7885bf Wallet API: fix Cold signing split tx (Jaquee)
2017-04-11 00:26:47 +02:00
Riccardo Spagni
e9ca165b1a Merge pull request #1950
f5bd3465 IOS CMAKE build settings (Jaquee)
d8a88d05 add IOS CMAKE toolchain (Jaquee)
2017-04-11 00:26:15 +02:00
Riccardo Spagni
9c2bcabcdd Merge pull request #1949
0ee018b4 wallet2: do not go over the target tx size if many destinations (moneromooo-monero)
9ae566d0 simplewallet: fix cold signing of split transactions (moneromooo-monero)
aae14a10 simplewallet: allow setting confirm-missing-payment-id in watch wallets (moneromooo-monero)
2017-04-11 00:25:09 +02:00
Riccardo Spagni
de68b00596 Merge pull request #1948
62efe5f6 mlog: direct log category changes to file only (moneromooo-monero)
2017-04-11 00:24:08 +02:00
Riccardo Spagni
6353e5b0e5 Merge pull request #1946
a38343bf miner: add a debug log in pause and resume (moneromooo-monero)
2017-04-11 00:23:43 +02:00
Riccardo Spagni
6e9b659c07 Merge pull request #1944
933e08f2 Replace deprecated tmpnam function. (Randi Joseph)
2017-04-11 00:20:57 +02:00
Riccardo Spagni
17e8ce8c35 Merge pull request #1940
17c7c62d Add per transaction fee to transfer command (Antti Keränen)
2017-04-11 00:19:32 +02:00
Riccardo Spagni
2037083b5f Merge pull request #1937
64377c90 Add other possible paths of AC power status file on Linux (Guillaume LE VAILLANT)
2017-04-11 00:15:24 +02:00
Riccardo Spagni
fcaac0e9e6 Merge pull request #1932
e251a2d7 readme: update min and rec versions and ND date (Gingeropolous)
cc30639f changed version of recommended monero version (Gingeropolous)
2017-04-11 00:14:28 +02:00
Riccardo Spagni
bf665e5991 Merge pull request #1931
89e100bc wallet cli: remove redundant password confirm in donate command (kenshi84)
2017-04-11 00:14:02 +02:00
Riccardo Spagni
541e1ff474 Merge pull request #1929
89949706 simplewallet: factor the per-variable code in set_variable (moneromooo-monero)
2017-04-11 00:13:40 +02:00
Riccardo Spagni
4600d0a9bb Merge pull request #1928
a28950da setThreadName moved in new version of easylogging++ (moneromooo-monero)
ea359b50 Fixup choice of easylogging++ vs libunwind stack trace code (moneromooo-monero)
1e6d8757 easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG (moneromooo-monero)
7a56fd6c easylogging++: detect DragonFly BSD as a UNIX (moneromooo-monero)
2c8b23e3 easylogging++: fix logging with static const header only data members (moneromooo-monero)
72663f4b easylogging++: allow clipping a common filename prefix (moneromooo-monero)
5bab0449 easylogging++: add file-only logs (moneromooo-monero)
db9dc7c2 eayslogging++: Fix bad memory access before opening any files (moneromooo-monero)
14620ca0 easylogging++: avoid creating directory/filename for the builtin default log file (moneromooo-monero)
0c1ad0ff easylogging++: Print thread ID in a nicer way (moneromooo-monero)
e7fabbd4 easylogging++: add categories (moneromooo-monero)
a8ac4f0a update easylogging++ to latest upstream (moneromooo-monero)
2017-04-11 00:13:11 +02:00
moneromooo-monero
a28950da73 setThreadName moved in new version of easylogging++ 2017-04-10 21:05:56 +01:00
moneromooo-monero
ea359b50cb Fixup choice of easylogging++ vs libunwind stack trace code 2017-04-10 21:05:47 +01:00
moneromooo-monero
1e6d875783 easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG 2017-04-10 21:05:43 +01:00
moneromooo-monero
7a56fd6c93 easylogging++: detect DragonFly BSD as a UNIX 2017-04-10 21:05:39 +01:00
moneromooo-monero
2c8b23e331 easylogging++: fix logging with static const header only data members 2017-04-10 21:05:35 +01:00
moneromooo-monero
72663f4b83 easylogging++: allow clipping a common filename prefix 2017-04-10 21:05:28 +01:00
moneromooo-monero
5bab044984 easylogging++: add file-only logs 2017-04-10 21:05:22 +01:00
moneromooo-monero
db9dc7c2df eayslogging++: Fix bad memory access before opening any files 2017-04-10 21:05:18 +01:00
moneromooo-monero
14620ca0bd easylogging++: avoid creating directory/filename for the builtin default log file 2017-04-10 21:05:15 +01:00
moneromooo-monero
0c1ad0ff1a easylogging++: Print thread ID in a nicer way 2017-04-10 21:05:11 +01:00
moneromooo-monero
e7fabbd470 easylogging++: add categories 2017-04-10 21:05:07 +01:00
moneromooo-monero
a8ac4f0a70 update easylogging++ to latest upstream 2017-04-10 21:05:02 +01:00
Mike C
aa02ff7f35 mv "Contributing" above install, compile, etc
The section on contributing to the Monero project is buried deep below lots of other information in the main README. This PR moves that section (which is very small since it links to a different document) up to an easier to locate place just below License information.
2017-04-09 13:32:25 -06:00
Mike C
a55bb37508 Add link to CONTRIBUTING to README.md 2017-04-09 13:29:26 -06:00
Mike C
09bbf96d85 Grouping CONTRIBUTING into digestable sections
The current document is very much a wall of text. This commit begins to re-structure that information into logical groups.
2017-04-09 13:26:26 -06:00
Mike C
dc35c73642 Rename CONTRIBUTING to CONTRIBUTING.md
Renaming document allows a CONTRIBUTING guide to be better formatted and therefore more accessible.
2017-04-09 13:14:09 -06:00
moneromooo-monero
89d707566a wallet2: fix spurious output splitting when not merging destinations 2017-04-08 11:13:28 +01:00
moneromooo-monero
10e137be3a wallet2: mention escaping/quoting --password in help string 2017-04-06 21:24:55 +01:00
moneromooo-monero
eb20f7209e daemon: print average fee per byte in print_pool_stats 2017-04-04 19:00:57 +01:00
moneromooo-monero
37be70bbd7 daemon: add fee/byte when print pool transaction info 2017-04-04 09:04:39 +01:00
moneromooo-monero
893f5a301e tx_pool: add blob size and fee/byte when logging a new tx 2017-04-04 09:04:11 +01:00
moneromooo-monero
5b63246813 core: fix blob size cache, and reenable hash and blob size caches 2017-04-03 22:19:57 +01:00
Jaquee
f5bd346573 IOS CMAKE build settings 2017-04-03 18:38:50 +02:00
Jaquee
d8a88d058e add IOS CMAKE toolchain 2017-04-03 18:38:43 +02:00
Jaquee
0a7885bf19 Wallet API: fix Cold signing split tx 2017-04-02 14:19:21 +02:00
moneromooo-monero
548075b1f5 daemon: new relay_tx command and RPC 2017-04-02 12:17:35 +01:00
moneromooo-monero
0ee018b407 wallet2: do not go over the target tx size if many destinations
If using a large input and many destinations, the code would
generate as many outputs as it could using that input, even if
it would bring the resulting tx above the max tx size.
2017-04-02 11:13:15 +01:00
moneromooo-monero
9ae566d0dd simplewallet: fix cold signing of split transactions
They'd be rejected as suspicious as the change goes to more
than one destination. However, split transactions will most
likely include fake zero amount change to random addresses,
so we only consider change with non zero amount for this.
2017-04-02 11:11:18 +01:00
moneromooo-monero
aae14a107a simplewallet: allow setting confirm-missing-payment-id in watch wallets
These can create transactions, even though they cannot sign them.
2017-04-02 11:10:11 +01:00
moneromooo-monero
62efe5f656 mlog: direct log category changes to file only
Because some people just won't even try to read what is written
and freak out because the word FATAL is in here, despite the
context making it clear it's not an error.
2017-04-01 11:29:43 +01:00
Antti Keränen
17c7c62d55 Add per transaction fee to transfer command
Allows priority argument default/unimportant/normal/elevated/priority to
be used per transaction in CLI wallet's transfer command. Resolves #1913.
2017-04-01 09:59:15 +03:00
moneromooo-monero
a38343bf68 miner: add a debug log in pause and resume 2017-03-31 20:01:58 +01:00
Randi Joseph
933e08f2f3 Replace deprecated tmpnam function. 2017-03-29 22:32:00 -04:00
Guillaume LE VAILLANT
64377c90b5 Add other possible paths of AC power status file on Linux 2017-03-28 11:35:18 +02:00
Gingeropolous
e251a2d7d5 readme: update min and rec versions and ND date
update min version to 0.10.3 and rec version to 0.10.3.1 and changed the not determined as of date to todays date.
2017-03-27 11:05:10 -04:00
Gingeropolous
cc30639f97 changed version of recommended monero version
... to v0.10.3.1 ... and minimum Monero version to v0.10.3.0 because the hardfork code is only in v0.10.3.x , not v0.10.2.1
2017-03-27 10:54:51 -04:00
kenshi84
89e100bc8c wallet cli: remove redundant password confirm in donate command 2017-03-27 11:02:20 +09:00
Riccardo Spagni
c9063c0b8f Merge pull request #1930
d1530f06 update version to 0.10.3.1 tag (Riccardo Spagni)
2017-03-26 23:32:54 +02:00
Riccardo Spagni
d1530f06bb update version to 0.10.3.1 tag 2017-03-26 23:29:31 +02:00
Riccardo Spagni
5f17d79527 Merge pull request #1927
a96f9bae core: disable tx/block hash cache (moneromooo-monero)
2017-03-26 22:36:43 +02:00
moneromooo-monero
899497069b simplewallet: factor the per-variable code in set_variable 2017-03-26 17:52:36 +01:00
moneromooo-monero
a96f9baeb4 core: disable tx/block hash cache
Looks like it doesn't work on win64
2017-03-26 02:21:01 +01:00
Riccardo Spagni
b1313aefd8 Merge pull request #1925
93b32892 Silence warning about possibly uninitialized pointer (Guillaume LE VAILLANT)
2017-03-25 17:36:23 +02:00
Riccardo Spagni
f64a0f2243 Merge pull request #1917
6e679478 mnemonics: sanity checks for word lists (moneromooo-monero)
e98f1114 mnemonics: misc cleanup (moneromooo-monero)
2017-03-25 17:35:52 +02:00
Guillaume LE VAILLANT
93b32892f7 Silence warning about possibly uninitialized pointer 2017-03-25 13:53:14 +01:00
moneromooo-monero
6e6794786a mnemonics: sanity checks for word lists
and a test to go with it

Remember to run the test when changing word lists, or simplewallet
will throw uncaught if that word list is used.
2017-03-25 12:14:01 +00:00
moneromooo-monero
e98f1114a0 mnemonics: misc cleanup
Pass relevant information to the base class instead of overwriting
default values later, use objects instead of pointers to objects
to avoid having to new objects unnecessarily.
2017-03-25 11:51:04 +00:00
Riccardo Spagni
a0af28ceba Merge pull request #1920
a50c4a4f wallet: option to merge destinations (moneromooo-monero)
2017-03-25 13:48:28 +02:00
moneromooo-monero
a50c4a4fad wallet: option to merge destinations
With the change from the original transfer method to the new
algorithm, payments to the same destination were merged. It
seemed like a good idea, optimizing space. However, it is a
useful tool for people who want to split large outputs into
several smaller ones (ie, service providers making frequent
payments, and who do not like a large chunk of their balance
being locked for 10 blocks after each payment).

Default to off, which is a change from the previous behavior.
2017-03-25 11:44:04 +00:00
Riccardo Spagni
e3d2b135e7 Merge pull request #1924
6d315459 core: avoid possible reordering bugs wth tx/bloch hash cache (moneromooo-monero)
2017-03-25 13:29:36 +02:00
Riccardo Spagni
119803f26e Merge pull request #1921
2bee92db Fixed typo in v5 hard fork finalized date (Derek Zhang)
d17179d1 Fixed typo in CLI wallet help message (Derek Zhang)
2017-03-25 13:29:11 +02:00
Riccardo Spagni
4737f61c81 Merge pull request #1919
0ad87db0 wallet: try to save large outputs when using an unneeded second input (moneromooo-monero)
2017-03-25 13:28:19 +02:00
Riccardo Spagni
721d1ca5ef Merge pull request #1918
5a4827ae Add Dutch mnemonics wordlist (Roy Jacobs)
2017-03-25 13:27:57 +02:00
moneromooo-monero
6d315459b6 core: avoid possible reordering bugs wth tx/bloch hash cache 2017-03-25 09:18:53 +00:00
Derek Zhang
2bee92dbd0 Fixed typo in v5 hard fork finalized date 2017-03-24 18:06:55 -07:00
Derek Zhang
d17179d14b Fixed typo in CLI wallet help message 2017-03-24 18:05:05 -07:00
Roy Jacobs
5a4827ae21 Add Dutch mnemonics wordlist 2017-03-25 00:58:35 +01:00
moneromooo-monero
0ad87db01f wallet: try to save large outputs when using an unneeded second input
When a single input is enough to satisfy a transfer, the code would
previously try to add a second input, to match the "canonical" makeup
of a transaction with two inputs and two outputs. This would cause
wallets to slowly merge outputs till all the monero ends up in a
single output, which causes trouble when making two transactions
one after the other, since change is locked for 10 blocks, and an
increasing portion of the remaining balance would end up locked on
each transaction.

There are two new settings (min-output-count and min-output-value)
which can control when to stop adding such unneeded second outputs.
The idea is that small "dust" outputs will still get added, but
larger ones will not.

Enable with, eg:

set min-output-count 10
set min-output-value 30

to avoid using an unneeded second output of 30 monero or more, if
there would be less than 10 such outputs left.

This does not invalidate any other reason why such outputs would
be used (ie, when they're really needed to satisfy a transfer, or
when randomly picked in the normal course of selection). This may
be improved in the future.
2017-03-24 21:04:08 +00:00
Riccardo Spagni
11e24bb2ba Merge pull request #1916
5a798358 blockchain: offset v5 addition date on testnet (moneromooo-monero)
2017-03-24 14:36:44 +02:00
Riccardo Spagni
92c2d79d10 Merge pull request #1915
a8646b09 Wallet API: add hard fork info functions (Jaquee)
2017-03-24 14:34:55 +02:00
Riccardo Spagni
20387386b9 Merge pull request #1914
31616af3 Fixes #1850 - Add French mnemonics wordlist (assylias)
2017-03-24 14:34:07 +02:00
Riccardo Spagni
f543377789 Merge pull request #1894
8bbcbcfb wallet rpc: enable solo mining (stoffu)
2017-03-24 14:33:47 +02:00
moneromooo-monero
5a7983585e blockchain: offset v5 addition date on testnet
to silence the update warning, since v5 was done very early
on testnet
2017-03-24 10:01:15 +00:00
Jaquee
a8646b0957 Wallet API: add hard fork info functions 2017-03-24 09:59:26 +01:00
assylias
31616af33d Fixes #1850 - Add French mnemonics wordlist 2017-03-23 21:53:20 +00:00
Riccardo Spagni
16f12f0628 Merge pull request #1912
00cbf720 ringct: move ge_frombytes_vartime failure error to warning (moneromooo-monero)
2017-03-23 11:47:26 +02:00
Riccardo Spagni
a73a886cb1 Merge pull request #1911
91d41090 tx_pool: ensure txes loaded from poolstate.bin have their txid cached (moneromooo-monero)
aaeb164c tx_pool: remove transactions if they're in the blockchain (moneromooo-monero)
558cfc31 core, wallet: faster tx pool scanning (moneromooo-monero)
f065234b core: cache tx and block hashes in the respective classes (moneromooo-monero)
2017-03-23 11:46:57 +02:00
Riccardo Spagni
7432f13898 Merge pull request #1910
9bccf1b1 Transfer help (Akademik Prokhor Zakharov)
2017-03-23 11:46:29 +02:00
Riccardo Spagni
8188f6bfe8 Merge pull request #1908
c94f8fac daemon: better error reporting in commands (moneromooo-monero)
2017-03-23 11:45:49 +02:00
Riccardo Spagni
a65a64f8e0 Merge pull request #1907
287ef36e Fix freebsd build (Lee Clagett)
2017-03-23 11:45:21 +02:00
Riccardo Spagni
4ec8a4c2b6 Merge pull request #1905
2242d8eb tx_pool: silence use of uninitialized warning (moneromooo-monero)
2017-03-23 11:45:00 +02:00
Riccardo Spagni
bff1bf27d9 Merge pull request #1898
cc8a4788 Updated Readme.md for v5 hardfork (xmr-eric)
2017-03-23 11:44:29 +02:00
moneromooo-monero
91d4109023 tx_pool: ensure txes loaded from poolstate.bin have their txid cached
The txid is not saved, and we want to make sure the transactions
have their txid cached while in the pool, since get_transactions
copies the transaction object, so any txid calculation on those
copies would not benefit any later caller, since the original tx
would be left without a cached txid.
2017-03-23 09:25:33 +00:00
moneromooo-monero
aaeb164cf6 tx_pool: remove transactions if they're in the blockchain
When starting up, if the pool state was not saved, the pool
might contain transactions which made it into the blockchain,
so these need removing
2017-03-23 09:25:29 +00:00
moneromooo-monero
558cfc31ca core, wallet: faster tx pool scanning
Includes a new RPC to get tx pool hashes fast.
2017-03-23 09:25:22 +00:00
moneromooo-monero
f065234b71 core: cache tx and block hashes in the respective classes
An idea from smooth
2017-03-23 09:25:17 +00:00
moneromooo-monero
00cbf72064 ringct: move ge_frombytes_vartime failure error to warning
Avoids scaring people when seeing some invalid txes
2017-03-22 21:26:38 +00:00
Akademik Prokhor Zakharov
9bccf1b11e Transfer help
New pull request because I couldn't figure out how to change the previous one.
1. For clarity, I want to focus the help text for the 'transfer' command on the most typical use case (a single payment). 
2. New users will prefer to use 'transfer', so the older method 'transfer_original' should refer to 'transfer' rather than the other way around.
2017-03-22 14:10:34 +01:00
moneromooo-monero
c94f8facf5 daemon: better error reporting in commands 2017-03-21 19:21:00 +00:00
Lee Clagett
287ef36ed8 Fix freebsd build 2017-03-21 10:41:21 -04:00
moneromooo-monero
2242d8ebd6 tx_pool: silence use of uninitialized warning
The result is not actually used when uninitialized
2017-03-21 12:21:19 +00:00
Riccardo Spagni
72f38bcc91 Merge pull request #1901
33f3cfde set USE_LTO_DEFAULT to false (Christoph Schnerch)
2017-03-21 14:13:00 +02:00
Riccardo Spagni
4b34531307 Merge pull request #1897
44a5b038 create a foreground non-interactive mode (Noah Watkins)
2017-03-21 14:10:36 +02:00
Riccardo Spagni
70e71a1845 Merge pull request #1904
995969b1 wallet: fix set_log not handling 0,xxx style settings (moneromooo-monero)
2017-03-21 14:09:42 +02:00
Riccardo Spagni
7769a6e757 Merge pull request #1903
350e99ae wallet2: cache which pool txes were scanned already (moneromooo-monero)
2017-03-21 14:09:19 +02:00
Riccardo Spagni
9d157b519d Merge pull request #1899
c1e9ccc7 wallet2: speed up transactions using remote nodes (moneromooo-monero)
2017-03-21 14:08:36 +02:00
moneromooo-monero
995969b190 wallet: fix set_log not handling 0,xxx style settings 2017-03-21 11:17:05 +00:00
moneromooo-monero
350e99ae57 wallet2: cache which pool txes were scanned already
This massively speeds up the wallet updating the pool on mainnet,
where the tx backlog is more than 500 txes.
2017-03-21 10:30:25 +00:00
Riccardo Spagni
37eebd9dcf Merge pull request #1902
7c033498 blockchain: lower the relay fee by 2% (moneromooo-monero)
266492e9 tx_pool: use new filling algorithm from v5 only (moneromooo-monero)
5b7c6ced wallet2: start using new fee priorities at v5, not 14 days laer (moneromooo-monero)
2017-03-20 23:29:43 +02:00
moneromooo-monero
7c03349869 blockchain: lower the relay fee by 2%
This ensures we accept txes with a fee that's slightly too small,
to accomodate blockchain median jitter
2017-03-20 19:14:12 +00:00
moneromooo-monero
266492e919 tx_pool: use new filling algorithm from v5 only 2017-03-20 18:46:57 +00:00
moneromooo-monero
5b7c6ced80 wallet2: start using new fee priorities at v5, not 14 days laer
Waiting would mean the fee used is 1x base, but the base will
have suddenly dropped
2017-03-20 18:34:56 +00:00
Christoph Schnerch
33f3cfdec0 set USE_LTO_DEFAULT to false 2017-03-20 13:24:30 +01:00
moneromooo-monero
c1e9ccc794 wallet2: speed up transactions using remote nodes
Asking for a full histogram from a remote node (since it's
untrusted) is pretty slow, and spams the remote node, so
we replace it by only adding a second input if we have rct
ones, which are for all intents and purposes always mixable.
2017-03-20 08:44:28 +00:00
xmr-eric
cc8a478887 Updated Readme.md for v5 hardfork 2017-03-20 02:00:06 -04:00
stoffu
8bbcbcfb0d wallet rpc: enable solo mining 2017-03-20 09:47:16 +09:00
Riccardo Spagni
73e8510717 Merge pull request #1896
a6f1d8fc core: call {prepare|cleanup}_handle_incoming_blocks when adding a mined block (moneromooo-monero)
2017-03-19 23:03:18 +02:00
Riccardo Spagni
dbfbd3b698 Merge pull request #1895
d3aaf740 Partial fix #1876, check thread in block_txn_start() (Howard Chu)
2017-03-19 23:02:32 +02:00
Riccardo Spagni
a85f750ee8 Merge pull request #1893
0effe196 Revert "Increase the log level for the info about log levels" (moneromooo-monero)
2017-03-19 22:59:26 +02:00
Riccardo Spagni
45fa27b56a Merge pull request #1892
df810a82 wallet-rpc bugfix: get_transfer_by_txid previously checking against payment id (kenshi84)
2017-03-19 22:58:55 +02:00
Riccardo Spagni
c97005723c Merge pull request #1890
50cd179a Removed boost/asio.hpp include from epee/string_tools.h (Lee Clagett)
2017-03-19 22:55:39 +02:00
Riccardo Spagni
4a6fc007c6 Merge pull request #1889
24ae7140 wallet: increase node_rpc_proxy timeout to match wallet2 (moneromooo-monero)
2017-03-19 22:55:10 +02:00
moneromooo-monero
a6f1d8fc4c core: call {prepare|cleanup}_handle_incoming_blocks when adding a mined block
This ensures that a batch can't also be started/stopped out of
sync by another thread and us getting in the middle
2017-03-19 12:40:26 +00:00
Howard Chu
d3aaf74080 Partial fix #1876, check thread in block_txn_start()
Don't allow use of existing batch txn if it's from the wrong thread
2017-03-19 12:27:03 +00:00
moneromooo-monero
0effe196e4 Revert "Increase the log level for the info about log levels"
We want to know which log categories are active.

This reverts commit 4f7bce6d20.
2017-03-19 09:39:28 +00:00
kenshi84
df810a8250 wallet-rpc bugfix: get_transfer_by_txid previously checking against payment id 2017-03-19 17:45:39 +09:00
Lee Clagett
50cd179a60 Removed boost/asio.hpp include from epee/string_tools.h 2017-03-18 22:05:14 -04:00
moneromooo-monero
24ae71404f wallet: increase node_rpc_proxy timeout to match wallet2 2017-03-18 23:06:06 +00:00
Riccardo Spagni
df140d90ee Merge pull request #1887
c5316d29 update version to 0.10.3.0 (Riccardo Spagni)
2017-03-18 21:56:56 +02:00
Riccardo Spagni
af82836ac6 Merge pull request #1888
d5fbfd67 daemon: fix missing close parenthesis in alt_chain_info output (moneromooo-monero)
2017-03-18 21:56:17 +02:00
moneromooo-monero
d5fbfd677c daemon: fix missing close parenthesis in alt_chain_info output
Reported by assylias_ on IRC
2017-03-18 19:19:32 +00:00
Riccardo Spagni
c5316d2929 update version to 0.10.3.0 2017-03-18 20:34:52 +02:00
Riccardo Spagni
82411cdf3a Merge pull request #1886
f9a2b527 simplewallet: allow setting tx priority in watch wallets (moneromooo-monero)
2017-03-18 20:31:37 +02:00
Riccardo Spagni
a48e41787b Merge pull request #1885
63d7cd88 daemon: alt_chain_info now prints fork depth (moneromooo-monero)
2017-03-18 20:31:12 +02:00
Riccardo Spagni
a6f1959d1c Merge pull request #1884
e9175cec wallet_rpc_server: make a few RPCs unavailable in restricted mode (moneromooo-monero)
2017-03-18 20:30:50 +02:00
Riccardo Spagni
f33a696ec7 Merge pull request #1883
d0238313 use const references in catch blocks (moneromooo-monero)
2017-03-18 20:30:19 +02:00
Riccardo Spagni
9aac64c238 Merge pull request #1882
3fa59755 wallet2: call is_key_image_spent in blocks in rescan_spent (moneromooo-monero)
9d134e86 wallet_rpc_server: add a rescan_spent RPC (moneromooo-monero)
2017-03-18 20:29:22 +02:00
Riccardo Spagni
4fb39a9d20 Merge pull request #1881
1a666c30 simplewallet: catch case where no transactions are made (moneromooo-monero)
2017-03-18 20:28:45 +02:00
Riccardo Spagni
d628ed2c14 Merge pull request #1880
8d787e24 bump version number (Riccardo Spagni)
2017-03-18 20:27:44 +02:00
Riccardo Spagni
585445d0bc Merge pull request #1879
c1c9eeaa p2p: use the fallback seed IPs when not enough seeds are found (moneromooo-monero)
2017-03-18 20:27:00 +02:00
Riccardo Spagni
ae6c92c2a5 Merge pull request #1875
b46620b0 Added hint to adjust jail configuration to readme for FreeBSD (S)
2017-03-18 20:23:27 +02:00
Riccardo Spagni
50b8af5b45 Merge pull request #1874
250c4cb3 wallet-rpc: enable openalias (stoffu)
2017-03-18 20:22:31 +02:00
moneromooo-monero
f9a2b5279d simplewallet: allow setting tx priority in watch wallets
Those can create unsigned transactions
2017-03-18 18:07:54 +00:00
moneromooo-monero
63d7cd8882 daemon: alt_chain_info now prints fork depth 2017-03-18 16:59:57 +00:00
moneromooo-monero
e9175cec07 wallet_rpc_server: make a few RPCs unavailable in restricted mode
Address book modification, setting tx nodes, importing key images
2017-03-18 13:01:53 +00:00
moneromooo-monero
d023831327 use const references in catch blocks 2017-03-18 12:56:07 +00:00
moneromooo-monero
3fa5975520 wallet2: call is_key_image_spent in blocks in rescan_spent
This is a potentially long lasting daemon RPC call
2017-03-18 12:47:07 +00:00
moneromooo-monero
9d134e8647 wallet_rpc_server: add a rescan_spent RPC 2017-03-18 12:04:17 +00:00
moneromooo-monero
1a666c3016 simplewallet: catch case where no transactions are made
This would otherwise be a silent noop, which is confusing.
This can happen if the daemon is started, but not yet ready
to service all requests, and this is a safe catch all.
2017-03-18 11:44:31 +00:00
moneromooo-monero
c1c9eeaaf7 p2p: use the fallback seed IPs when not enough seeds are found
In case the DNS seed(s) is/are down, which would otherwise
cause the fallback seeds to never be used. Also if the seeds
resolve to too few IPs.
2017-03-18 11:40:28 +00:00
Riccardo Spagni
8d787e2414 bump version number 2017-03-17 23:42:06 +01:00
S
b46620b062 Added hint to adjust jail configuration to readme for FreeBSD 2017-03-17 14:29:34 +01:00
stoffu
250c4cb3e0 wallet-rpc: enable openalias 2017-03-17 10:42:10 +09:00
Riccardo Spagni
c642d3224c Merge pull request #1869
3396a9f2 Add intervening v5 fork for increased min block size (moneromooo-monero)
2017-03-15 18:23:51 +01:00
Riccardo Spagni
e5b5d041f5 Merge pull request #1868
585c9176 Specify "524,288" iterations instead of "500,000" (darentuzi)
2017-03-15 18:21:43 +01:00
Riccardo Spagni
2f8e0af7f9 Merge pull request #1867
b54e19d0 protocol: fix wrong tx being looked up from fluffy block (moneromooo-monero)
2017-03-15 18:21:19 +01:00
Riccardo Spagni
6de3a70347 Merge pull request #1861
badec326 Adds a config file option to the wallet (Arne Brutschy)
2017-03-15 18:20:53 +01:00
moneromooo-monero
3396a9f2af Add intervening v5 fork for increased min block size
Minimum mixin 4 and enforced ringct is moved from v5 to v6.
v5 is now used for an increased minimum block size (from 60000
to 300000) to cater for larger typical/minimum transaction size.

The fee algorithm is also changed to decrease the base per kB
fee, and add a cheap tier for those transactions which we do
not care if they get delayed (or even included in a block).
2017-03-15 08:32:51 +00:00
darentuzi
585c917691 Specify "524,288" iterations instead of "500,000"
CryptoNight does exactly 524,288 iterations over the scratchpad as defined in CNS008, saying 500,000 could be confusing. I know its meant to give a rough idea (around 500k) to the reader but if you are reading the code, might as well know the exact number.
2017-03-14 16:39:44 +02:00
moneromooo-monero
b54e19d00e protocol: fix wrong tx being looked up from fluffy block
Found by smooth
2017-03-13 19:16:25 +00:00
Riccardo Spagni
c6102d5c1b Merge pull request #1864
74b216a1 core: don't try to re-relay an empty set of pool transactions (moneromooo-monero)
2017-03-13 17:22:33 +01:00
Riccardo Spagni
22e51c5d29 Merge pull request #1863
09e060fe protocol: fix fluffy to normal block dropping txes (moneromooo-monero)
2017-03-13 17:22:10 +01:00
Arne Brutschy
badec326d8 Adds a config file option to the wallet 2017-03-12 21:45:59 +01:00
moneromooo-monero
74b216a17f core: don't try to re-relay an empty set of pool transactions 2017-03-12 14:57:58 +00:00
moneromooo-monero
09e060febb protocol: fix fluffy to normal block dropping txes 2017-03-12 14:14:51 +00:00
Riccardo Spagni
1dfed893e0 Merge pull request #1857
efc4c7b0 Separated dependency installation, git clone and build commands to reduce repeated work on failure (adot23)
2017-03-10 14:28:26 +00:00
Riccardo Spagni
a68496deec Merge pull request #1856
5d062e47 Improved wording in hard fork schedule section (Gingeropolous)
2017-03-10 14:27:55 +00:00
Riccardo Spagni
8fcede28df Merge pull request #1853
7d07c64f fix dependency: put HardFork back to cryptonote_basic, made some BlockchainDB functions virtual again to avoid missing symbols error (kenshi84)
2017-03-10 14:27:29 +00:00
kenshi84
7d07c64fe5 fix dependency: put HardFork back to cryptonote_basic, made some BlockchainDB functions virtual again to avoid missing symbols error 2017-03-10 11:22:39 +09:00
adot23
efc4c7b09f Separated dependency installation, git clone and build commands to reduce repeated work on failure 2017-03-09 16:03:28 +00:00
Gingeropolous
5d062e476e Improved wording in hard fork schedule section
changed hard forking to hard fork and fixed data format
2017-03-08 18:39:49 -05:00
Riccardo Spagni
b67877af6f Merge pull request #1852
088930fa Problem: misleading information about LMDB storage (Gareth)
2017-03-08 17:39:32 +00:00
Gareth
088930facc Problem: misleading information about LMDB storage
Solution: updated the comments to reflect the current situation in terms of LMDB implementation and no longer recommend 'memory' for blockchain storage in production use.
2017-03-08 21:29:08 +08:00
Riccardo Spagni
8b57e899d4 Merge pull request #1840
94c26b00 Update README.md (Gingeropolous)
4a76ec89 update Readme.md (Gingeropolous)
74bc86a2 updated reccommended Monero version in Readme (Gingeropolous)
2017-03-07 10:18:15 +00:00
Gingeropolous
94c26b00b7 Update README.md
There we go. Problem solved.
2017-03-06 15:05:13 -05:00
Gingeropolous
4a76ec899f update Readme.md
I think this does what was wanted... we still want a minimum version, right?
2017-03-06 14:58:54 -05:00
Riccardo Spagni
ba0767477d Merge pull request #1841
b553c282 rpc: fix BUILD_TAG mispelling (BUILDTAG) (moneromooo-monero)
02097c87 core: print the "new update found" message in cyan, for visibility (moneromooo-monero)
749ebace download: check available disk space before downloading (moneromooo-monero)
f36c5f1e download: give download threads distinct names (moneromooo-monero)
f6211322 core: make update download cancellable (moneromooo-monero)
63f0e074 download: async API (moneromooo-monero)
9bf017ed http_client: allow cancelling a download (moneromooo-monero)
0d90123c http_client: allow derived class to get headers at start (moneromooo-monero)
2017-03-06 15:17:08 +00:00
Riccardo Spagni
ea047307da Merge pull request #1848
cfa2564a blockchain: don't try to load an empty block hash set (moneromooo-monero)
38359036 blockchain_import: make --log-level understand categories (moneromooo-monero)
5fee8561 blockchain_export: make --log-level understand categories (moneromooo-monero)
50ebf661 blockchain_import: error out nicely on exceptions (moneromooo-monero)
87d57d9c blockchain_export: error out nicely on exceptions (moneromooo-monero)
2017-03-06 15:16:02 +00:00
Riccardo Spagni
5bcb25f3f8 Merge pull request #1846
4b48565c wallet: add password command (moneromooo-monero)
2017-03-06 15:14:59 +00:00
moneromooo-monero
cfa2564a40 blockchain: don't try to load an empty block hash set
If the blocks aren't being linked against a binary (such as
one of the blockchain utilities), the symbol will not be
NULL, but the size will be 0. This avoids a apurious warning
about the data hash.
2017-03-05 19:46:55 +00:00
moneromooo-monero
3835903650 blockchain_import: make --log-level understand categories 2017-03-05 19:45:22 +00:00
moneromooo-monero
5fee85616d blockchain_export: make --log-level understand categories 2017-03-05 19:45:00 +00:00
moneromooo-monero
50ebf66150 blockchain_import: error out nicely on exceptions 2017-03-05 19:25:01 +00:00
moneromooo-monero
87d57d9c59 blockchain_export: error out nicely on exceptions 2017-03-05 19:24:47 +00:00
moneromooo-monero
b553c282fb rpc: fix BUILD_TAG mispelling (BUILDTAG)
This ensures a manual or RPC update tries the right build tag,
rather than source, which is currently not setup
2017-03-05 16:59:39 +00:00
moneromooo-monero
02097c87eb core: print the "new update found" message in cyan, for visibility 2017-03-05 16:59:36 +00:00
moneromooo-monero
749ebacebd download: check available disk space before downloading
We don't check *while* the download happens, so it might
still be that we don't have enough space later
2017-03-05 16:59:32 +00:00
moneromooo-monero
f36c5f1e08 download: give download threads distinct names 2017-03-05 16:59:29 +00:00
moneromooo-monero
f6211322e5 core: make update download cancellable 2017-03-05 16:59:25 +00:00
moneromooo-monero
63f0e074eb download: async API 2017-03-05 16:58:48 +00:00
Riccardo Spagni
d423668954 Merge pull request #1845
f7547781 unit_tests: fix fee tests after quantization change (moneromooo-monero)
2017-03-05 18:23:38 +02:00
moneromooo-monero
9bf017edf2 http_client: allow cancelling a download 2017-03-05 16:23:34 +00:00
moneromooo-monero
0d90123cac http_client: allow derived class to get headers at start 2017-03-05 16:23:29 +00:00
Riccardo Spagni
e66866c1fc Merge pull request #1844
d18ff58a format_utils: fix typo in assert message (lethos3)
2017-03-05 18:13:49 +02:00
Riccardo Spagni
b375dde57f Merge pull request #1843
3964b30f Add dependency for blocksdat.o (Howard Chu)
2017-03-05 18:01:03 +02:00
Riccardo Spagni
8cb58dbb69 Merge pull request #1842
223fe5bb wallet: fix get_tranfers with multiple incoming txes with same pid (moneromooo-monero)
2017-03-05 17:52:42 +02:00
Riccardo Spagni
a861992359 Merge pull request #1839
c7dd0b15 Revert "wallet: fix insertion of pool transactions" (moneromooo-monero)
2017-03-05 17:47:18 +02:00
moneromooo-monero
4b48565c9e wallet: add password command
Also tweak wallet2 password code to verify password without
saying it's a new wallet, because it's assuming things.
2017-03-05 14:53:46 +00:00
moneromooo-monero
f75477819c unit_tests: fix fee tests after quantization change 2017-03-04 22:45:49 +00:00
lethos3
d18ff58a1c format_utils: fix typo in assert message
Fix two small typos as mentioned by reddit user nthterm.
2017-03-05 11:11:44 +13:00
Howard Chu
3964b30f2d Add dependency for blocksdat.o
To make sure it gets regenerated whenever checkpoints.dat changes
Likewise for blocks.o and testnet_blocks.o
2017-03-04 22:02:10 +00:00
moneromooo-monero
223fe5bbe2 wallet: fix get_tranfers with multiple incoming txes with same pid 2017-03-04 21:47:53 +00:00
Riccardo Spagni
4728ab977a Merge pull request #1837
31533493 core: quantize per kB fee to 8 decimals (moneromooo-monero)
2017-03-04 21:15:04 +02:00
Riccardo Spagni
f2d0f0174f Merge pull request #1836
cd71774d tx_pool: log separately "not ready" and "double spend" cases (moneromooo-monero)
2017-03-04 21:14:38 +02:00
Riccardo Spagni
734f7c26d5 Merge pull request #1834
e4437b25 Fix double-import (Howard Chu)
2017-03-04 21:14:19 +02:00
Gingeropolous
74bc86a272 updated reccommended Monero version in Readme 2017-03-04 08:02:19 -05:00
moneromooo-monero
c7dd0b1535 Revert "wallet: fix insertion of pool transactions"
This reverts commit d47dac9a88.

Callers actually expect the key to be payment id, so this
needs a lot more changes (like storing payment ids in the
structure, and possibly also to other existing structures
which do the same thing).
2017-03-04 12:41:19 +00:00
moneromooo-monero
3153349325 core: quantize per kB fee to 8 decimals 2017-03-03 23:31:56 +00:00
moneromooo-monero
cd71774d77 tx_pool: log separately "not ready" and "double spend" cases 2017-03-03 22:32:51 +00:00
Howard Chu
e4437b2551 Fix double-import
Incomplete ifdef cleanup in 9e82b694da
2017-03-03 21:45:14 +00:00
Riccardo Spagni
3e761c137d Merge pull request #1832
eb62dcc8 Remove redundant num_txs() method (Howard Chu)
296641e0 Fix #1824 don't end batch that we didn't start (Howard Chu)
2017-03-03 18:56:46 +02:00
Howard Chu
eb62dcc871 Remove redundant num_txs() method
Cleanup of bf1348b7e2
2017-03-03 16:52:45 +00:00
Howard Chu
296641e047 Fix #1824 don't end batch that we didn't start 2017-03-03 16:50:53 +00:00
Riccardo Spagni
4e92ef4aa4 Merge pull request #1831
9ae33b51 wallet api: fix parameters in wallet2callbackImpl (Jaquee)
1cf2f5a5 use txid in wallet2::process_new_transaction() (Jaquee)
2017-03-03 16:59:32 +02:00
Jaquee
9ae33b51fb wallet api: fix parameters in wallet2callbackImpl 2017-03-03 15:49:12 +01:00
Jaquee
1cf2f5a5c2 use txid in wallet2::process_new_transaction() 2017-03-03 15:48:32 +01:00
Riccardo Spagni
e24cd86c18 Merge pull request #1827
db1c7d80 wallet api: add missing mining options (Jaquee)
2017-03-03 14:31:28 +02:00
Riccardo Spagni
d35d626181 Merge pull request #1826
2c468dd4 allow user I/O in millinero, micronero, nanonero, piconero (moneromooo-monero)
2017-03-03 14:31:04 +02:00
Riccardo Spagni
2f9ecd4fba Merge pull request #1823
d47dac9a wallet: fix insertion of pool transactions (moneromooo-monero)
2017-03-03 14:30:24 +02:00
Riccardo Spagni
78a99fe7da Merge pull request #1820
7a44f38a Add support for the wallet to refresh pruned blocks (moneromooo-monero)
da18898f ringct: do not require range proof in decodeRct/decodeRctSimple (moneromooo-monero)
b49c6ab4 rpc: add a default category for daemon rpc (moneromooo-monero)
f113b92b core: add functions to serialize base tx info (moneromooo-monero)
6fd4b827 node_rpc_proxy: allow caching daemon RPC version (moneromooo-monero)
b5c74e40 wallet: invalidate node proxy cache when reconnecting (moneromooo-monero)
2017-03-03 14:30:02 +02:00
Riccardo Spagni
11f8e0d33f Merge pull request #1687
1a7e18bf Make gray peer selection uniform (Miguel Herranz)
f3be9991 Make get_random_gray_peer distribution uniform (Miguel Herranz)
2017-03-03 14:29:23 +02:00
Riccardo Spagni
9e10fac223 Merge pull request #1814
11a00df6 daemon: fix bc_dyn_stats via rpc (moneromooo-monero)
2017-03-03 14:14:51 +02:00
Riccardo Spagni
460836a2b7 Merge pull request #1813
b8a08f19 wallet: fix --log-file not working (moneromooo-monero)
2017-03-03 14:14:09 +02:00
Riccardo Spagni
1965c819f6 Merge pull request #1811
378d2bb1 Revert attempt to write to console on daemon shutdown (Nano Akron)
2017-03-03 14:13:52 +02:00
Riccardo Spagni
e10bf1d6c0 Merge pull request #1805
b7f85a30 mlog: default net.cn to FATAL (moneromooo-monero)
2017-03-03 14:12:21 +02:00
Riccardo Spagni
3787ffca80 Merge pull request #1804
12adb4a3 core: move hardfork back to cryptonote_core (moneromooo-monero)
2017-03-03 14:11:09 +02:00
Riccardo Spagni
14c6c910d7 Merge pull request #1803
53105743 Wallet API: Add support for daemon rpc login (Jaquee)
2017-03-03 14:10:44 +02:00
Riccardo Spagni
6aedd3d82b Merge pull request #1802
4f7bce6d Increase the log level for the info about log levels (Nano Akron)
2017-03-03 14:06:58 +02:00
Riccardo Spagni
27b7320fed Merge pull request #1801
96ce57d5 protocol: tone down a rate limit not implemented yet warning (moneromooo-monero)
2017-03-03 14:04:35 +02:00
Riccardo Spagni
321691a698 Merge pull request #1800
ea873ceb daemon/rpc: updates command and RPC (moneromooo-monero)
2017-03-03 14:04:06 +02:00
moneromooo-monero
2c468dd429 allow user I/O in millinero, micronero, nanonero, piconero 2017-03-02 19:02:41 +00:00
Jaquee
db1c7d80b1 wallet api: add missing mining options 2017-03-02 14:09:04 +01:00
moneromooo-monero
d47dac9a88 wallet: fix insertion of pool transactions
They were inserted using payment id as key, not txid
2017-02-28 21:19:24 +00:00
Miguel Herranz
1a7e18bfdf Make gray peer selection uniform
Prevents the system from always picking the gray peers with the most
recent last_seen.
2017-02-28 17:39:39 +01:00
moneromooo-monero
b8a08f199a wallet: fix --log-file not working 2017-02-28 09:07:56 +00:00
moneromooo-monero
7a44f38a7f Add support for the wallet to refresh pruned blocks 2017-02-27 22:29:00 +00:00
moneromooo-monero
da18898f0e ringct: do not require range proof in decodeRct/decodeRctSimple
These fields aren't used, and they'll actually be pruned in
some cases
2017-02-27 22:28:45 +00:00
moneromooo-monero
b49c6ab45d rpc: add a default category for daemon rpc 2017-02-27 20:25:35 +00:00
moneromooo-monero
f113b92b93 core: add functions to serialize base tx info
That is, information without signatures (for v1) nor range
proofs and MGs (for v2)
2017-02-27 20:24:39 +00:00
moneromooo-monero
6fd4b827fb node_rpc_proxy: allow caching daemon RPC version 2017-02-27 17:57:18 +00:00
moneromooo-monero
b5c74e4041 wallet: invalidate node proxy cache when reconnecting 2017-02-27 17:46:55 +00:00
Miguel Herranz
f3be9991d7 Make get_random_gray_peer distribution uniform
get_random_gray_peer is used to implement feeler connections, described
in: https://eprint.iacr.org/2015/263.pdf 2. Random selection
2017-02-27 18:29:50 +01:00
moneromooo-monero
11a00df699 daemon: fix bc_dyn_stats via rpc 2017-02-26 23:12:55 +00:00
Nano Akron
378d2bb1ff Revert attempt to write to console on daemon shutdown 2017-02-26 21:49:50 +00:00
moneromooo-monero
b7f85a30cd mlog: default net.cn to FATAL
Errors in this layer depend on how peers behave, and thus errors
are expected
2017-02-26 11:02:05 +00:00
Jaquee
5310574382 Wallet API: Add support for daemon rpc login 2017-02-25 22:17:35 +01:00
moneromooo-monero
12adb4a3f3 core: move hardfork back to cryptonote_core
should fix a cross dependency betewen cryptonote_basic and
blockchain_db
2017-02-25 16:41:35 +00:00
Nano Akron
4f7bce6d20 Increase the log level for the info about log levels 2017-02-25 14:58:18 +00:00
moneromooo-monero
96ce57d551 protocol: tone down a rate limit not implemented yet warning
it scares users
2017-02-25 12:10:29 +00:00
moneromooo-monero
ea873ceb2c daemon/rpc: updates command and RPC
subcommands "check", "download", and "update".
update is not yet implemented.
2017-02-24 23:18:27 +00:00
Riccardo Spagni
beee286c7b Merge pull request #1798
9a2157d7 update version (Riccardo Spagni)
2017-02-24 21:14:20 +02:00
Riccardo Spagni
44484acf2d Merge pull request #1799
2b188151 daemon: avoid pre-log-init spew on creating directories (moneromooo-monero)
cf2b1511 wallet: avoid pre-log-init spew on --version (moneromooo-monero)
2017-02-24 21:10:25 +02:00
moneromooo-monero
2b188151d4 daemon: avoid pre-log-init spew on creating directories 2017-02-24 19:08:20 +00:00
moneromooo-monero
cf2b151116 wallet: avoid pre-log-init spew on --version 2017-02-24 19:08:02 +00:00
Riccardo Spagni
9a2157d71a update version 2017-02-24 21:03:57 +02:00
Riccardo Spagni
57f15994a5 Merge pull request #1797
ada6a8a2 wallet_rpc_server: new --trusted-daemon flag (moneromooo-monero)
2017-02-24 20:33:04 +02:00
moneromooo-monero
ada6a8a2de wallet_rpc_server: new --trusted-daemon flag
and remove trusted_daemon fields from transfer RPCs,
it is much friendlier on users
2017-02-24 18:20:14 +00:00
Riccardo Spagni
6f9310bde8 Merge pull request #1795
3435038a add rpc timeouts to calls that might timeout (Riccardo Spagni)
2017-02-24 20:13:54 +02:00
Riccardo Spagni
1ef92074ad Merge pull request #1796
8c84d48c Updated default RPC timeout from 5 seconds to 15 seconds (Lee Clagett)
2017-02-24 20:13:28 +02:00
Lee Clagett
8c84d48caa Updated default RPC timeout from 5 seconds to 15 seconds 2017-02-24 12:55:17 -05:00
Riccardo Spagni
3435038a4d add rpc timeouts to calls that might timeout 2017-02-24 19:17:22 +02:00
Riccardo Spagni
1e7f783f69 Merge pull request #1776
e4dbea97 wallet2: fix wrong status on daemon shutdown/startup (Jaquee)
2017-02-24 14:22:55 +02:00
Riccardo Spagni
4cb6b265ee Merge pull request #1794
29b34ed1 blockchain_utilities: link against blockchain_db (moneromooo-monero)
2017-02-24 12:05:39 +02:00
Riccardo Spagni
0e7722ff40 Merge pull request #1793
eabe3bf2 simplewallet: updated help message for 'set ask-password' (kenshi84)
2017-02-24 12:04:28 +02:00
Riccardo Spagni
2f88c14f53 Merge pull request #1790
032fd354 Makefile add missing space for target android (MoroccanMalinois)
2017-02-24 12:03:46 +02:00
Riccardo Spagni
45c98e948b Merge pull request #1789
5db8df7b Unify dist files and prime (vdo)
38b9226f wrapper +x (vdo)
b4c90d56 Add meta icon for snap (vdo)
a2b90426 Add snap symlink (vdo)
2c51c4d1 Reorganize snap. Add daemon wrapper (vdo)
2017-02-24 12:02:45 +02:00
Riccardo Spagni
954cc459d2 Merge pull request #1786
4d05955d protocol: fix "sync done" message not appearing (moneromooo-monero)
2017-02-24 12:01:36 +02:00
Riccardo Spagni
ed6f2e8323 Merge pull request #1785
583a7b5c core: protect precomputed block hashes with SHA256 (moneromooo-monero)
2017-02-24 12:00:51 +02:00
Riccardo Spagni
b944949bb0 Merge pull request #1784
a1cd4db4 updated Dockerfile (Mine Coins)
2017-02-24 12:00:06 +02:00
Riccardo Spagni
6a66ecc079 Merge pull request #1783
a6f0abb7 README: libevent is replaced by minievent (Mine Coins)
2017-02-24 11:59:34 +02:00
Riccardo Spagni
b352330a3f Merge pull request #1781
520756c3 rpc: s/rcp/rpc/ (moneromooo-monero)
2017-02-24 11:58:38 +02:00
Riccardo Spagni
089df0a7a4 Merge pull request #1780
8262da81 rpc: make mining_status RPC work when syncing (moneromooo-monero)
2017-02-24 11:57:03 +02:00
Riccardo Spagni
2b38973b5c Merge pull request #1779
9effa553 core: bound the amount of entries in bad tx semantics cache (moneromooo-monero)
240054a7 core: remove a couple unused/obsolete bits (moneromooo-monero)
2017-02-24 11:55:54 +02:00
Riccardo Spagni
bc8d325216 Merge pull request #1777
3bdda60f Add print_pl_stats daemon command (Miguel Herranz)
2017-02-24 11:54:49 +02:00
moneromooo-monero
29b34ed156 blockchain_utilities: link against blockchain_db 2017-02-24 09:01:34 +00:00
kenshi84
eabe3bf20c simplewallet: updated help message for 'set ask-password' 2017-02-24 17:54:30 +09:00
MoroccanMalinois
032fd3543d Makefile add missing space for target android 2017-02-24 04:21:32 +00:00
vdo
5db8df7bb6 Unify dist files and prime 2017-02-24 03:28:22 +01:00
vdo
38b9226f44 wrapper +x 2017-02-24 02:53:59 +01:00
vdo
b4c90d5645 Add meta icon for snap 2017-02-24 02:52:15 +01:00
vdo
a2b90426bd Add snap symlink 2017-02-24 02:49:48 +01:00
moneromooo-monero
4d05955d53 protocol: fix "sync done" message not appearing 2017-02-24 01:28:56 +00:00
vdo
2c51c4d186 Reorganize snap. Add daemon wrapper 2017-02-24 02:20:02 +01:00
moneromooo-monero
583a7b5c74 core: protect precomputed block hashes with SHA256 2017-02-23 23:18:10 +00:00
Mine Coins
a1cd4db4e6 updated Dockerfile
- minified image: 75% smaller image
- statically-linked build
- add .dockerignore: no need to send repo to build context
2017-02-24 00:56:15 +02:00
Mine Coins
a6f0abb7c3 README: libevent is replaced by minievent 2017-02-24 00:36:36 +02:00
moneromooo-monero
520756c3c5 rpc: s/rcp/rpc/ 2017-02-23 21:02:15 +00:00
moneromooo-monero
8262da8137 rpc: make mining_status RPC work when syncing 2017-02-23 20:40:28 +00:00
moneromooo-monero
9effa55311 core: bound the amount of entries in bad tx semantics cache
This is to prevent unbounded memory use. Since I don't think there
is a container that has quick insert, quick lookup, and automatic
FIFO, I use two and swap every N, clearing the oldest one.
2017-02-23 20:34:11 +00:00
moneromooo-monero
240054a7f8 core: remove a couple unused/obsolete bits 2017-02-23 20:11:57 +00:00
Miguel Herranz
3bdda60f3e Add print_pl_stats daemon command 2017-02-23 18:20:17 +01:00
Jaquee
e4dbea976e wallet2: fix wrong status on daemon shutdown/startup 2017-02-23 12:41:21 +01:00
Riccardo Spagni
d666339853 Merge pull request #1775
700d218c fix broken test data (Riccardo Spagni)
0abddd64 fix broken checkpoints.dat (Riccardo Spagni)
2017-02-22 23:18:36 +02:00
Riccardo Spagni
700d218c5d fix broken test data 2017-02-22 23:12:21 +02:00
Riccardo Spagni
0abddd648d fix broken checkpoints.dat 2017-02-22 23:10:05 +02:00
Riccardo Spagni
f50704ec01 Merge pull request #1750
ada0e23a updates: fix user/auto url split (moneromooo-monero)
14d0e002 wallet2_api: add updates check api (moneromooo-monero)
2017-02-22 15:51:42 +02:00
moneromooo-monero
ada0e23a84 updates: fix user/auto url split 2017-02-22 13:04:07 +00:00
moneromooo-monero
14d0e00235 wallet2_api: add updates check api 2017-02-22 13:03:45 +00:00
Riccardo Spagni
7de43154d3 Merge pull request #1774
59013316 updates: remove testnet case (moneromooo-monero)
822577eb updates: we now have a user URL, and an automatic one (moneromooo-monero)
9f17b1a3 updates: s/monerod/monero/ for the main download (moneromooo-monero)
6a5dfb88 updates: add all update servers (moneromooo-monero)
72d40f13 updates: use HTTP, not HTTPS (moneromooo-monero)
2017-02-22 13:36:57 +02:00
moneromooo-monero
5901331669 updates: remove testnet case
It need not be any different
2017-02-22 11:20:44 +00:00
moneromooo-monero
822577eb42 updates: we now have a user URL, and an automatic one
So the user can use https, while the automatic does not have to
2017-02-22 11:20:40 +00:00
moneromooo-monero
9f17b1a30f updates: s/monerod/monero/ for the main download
Also print download success message as global log
2017-02-22 11:20:37 +00:00
moneromooo-monero
6a5dfb88d2 updates: add all update servers 2017-02-22 11:20:24 +00:00
moneromooo-monero
72d40f13a4 updates: use HTTP, not HTTPS
The files are hashed and the hashes signed
2017-02-22 09:08:35 +00:00
Riccardo Spagni
dc110a4391 Merge pull request #1773
27b477f6 update last few copyright year references (Riccardo Spagni)
2017-02-22 10:32:59 +02:00
Riccardo Spagni
27b477f68d update last few copyright year references 2017-02-22 09:55:06 +02:00
Riccardo Spagni
5aab25b60a Merge pull request #1765
5cfddd74 Add support for smart mining through wallet. (Dion Ahmetaj)
2017-02-22 09:37:31 +02:00
Riccardo Spagni
3ac5a785e0 Merge pull request #1762
dcf684c7 http_server_impl_base: set bind message to MGINFO (anonimal)
2017-02-22 09:37:05 +02:00
Riccardo Spagni
1a4298685a Merge pull request #1766
72deb484 updated fallback nodes (Riccardo Spagni)
33329f5b update version to 0.10.2 (Riccardo Spagni)
04a50a7e update checkpoints.dat (Riccardo Spagni)
c3599fa7 update copyright year, fix occasional lack of newline at line end (Riccardo Spagni)
2017-02-22 09:36:11 +02:00
Riccardo Spagni
80a088a4fe Merge pull request #1767
708758b7 core: do not download an update we already downloaded (moneromooo-monero)
45101550 updates: use updates host, not downloads, for HTTP (moneromooo-monero)
2017-02-22 09:35:35 +02:00
Riccardo Spagni
1b55769e26 Merge pull request #1771
ec217cd1 README: add DragonFly BSD to build status + update FreeBSD version (anonimal)
2017-02-22 09:35:07 +02:00
Riccardo Spagni
c758e031f6 Merge pull request #1772
40946a29 kenshi84's gpg key (kenshi84)
2017-02-22 09:32:54 +02:00
kenshi84
40946a2981 kenshi84's gpg key 2017-02-22 12:36:27 +09:00
anonimal
ec217cd163 README: add DragonFly BSD to build status + update FreeBSD version 2017-02-22 02:49:29 +00:00
Noah Watkins
44a5b03841 create a foreground non-interactive mode
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2017-02-21 16:44:22 -08:00
moneromooo-monero
708758b737 core: do not download an update we already downloaded 2017-02-21 22:23:59 +00:00
moneromooo-monero
45101550f2 updates: use updates host, not downloads, for HTTP 2017-02-21 22:21:59 +00:00
Riccardo Spagni
72deb4846d updated fallback nodes 2017-02-21 22:40:26 +02:00
Riccardo Spagni
33329f5bd1 update version to 0.10.2 2017-02-21 22:24:01 +02:00
anonimal
dcf684c704 http_server_impl_base: set bind message to MGINFO 2017-02-21 18:30:43 +00:00
Riccardo Spagni
04a50a7ea4 update checkpoints.dat 2017-02-21 19:52:27 +02:00
Riccardo Spagni
e960be55ed Merge pull request #1761
56586bde mlog: restrict net.p2p to FATAL by default (moneromooo-monero)
2017-02-21 19:48:39 +02:00
Riccardo Spagni
c3599fa7b9 update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
moneromooo-monero
56586bde9e mlog: restrict net.p2p to FATAL by default 2017-02-21 17:37:03 +00:00
Dion Ahmetaj
5cfddd74e9 Add support for smart mining through wallet. 2017-02-21 11:45:47 -05:00
Riccardo Spagni
2bdad8d695 Merge pull request #1760
efdd783c add openssl to readme (Riccardo Spagni)
058eed36 cmakify openssl (Riccardo Spagni)
2017-02-21 17:23:10 +02:00
Riccardo Spagni
5f48a1b000 Merge pull request #1759
417b126f Fix core_tests breaking on startup (moneromooo-monero)
2017-02-21 17:22:33 +02:00
Riccardo Spagni
ecbd3f0798 Merge pull request #1758
5664826a unit_tests: hardfork unit test now needs get_block_blob_from_height (moneromooo-monero)
2017-02-21 17:22:01 +02:00
Riccardo Spagni
41060f2090 Merge pull request #1757
5c3badb7 dns_utils: fix infinite recursion when distributing empty dns_urls (anonimal)
2017-02-21 17:18:03 +02:00
Riccardo Spagni
8ab127bda9 Merge pull request #1756
80749e59 More for PR #1724 (Howard Chu)
2017-02-21 17:17:25 +02:00
Riccardo Spagni
f0190bc45e Merge pull request #1755
86d8a33a BerkeleyDB code isn't usable any more, drop from dependencies (Howard Chu)
2017-02-21 17:17:02 +02:00
Riccardo Spagni
efdd783c20 add openssl to readme 2017-02-21 17:13:00 +02:00
Riccardo Spagni
058eed369b cmakify openssl 2017-02-21 17:11:12 +02:00
moneromooo-monero
417b126fc4 Fix core_tests breaking on startup
You're wondering how this fixes core tests, aren't you...

It prevents the miner (initialized by cryptonote::core) from
breaking trying to access arguments that were not added.
Since the tests don't use the miner directly, it makes more
sense to have cryptonote_core add those, since it also uses
the miner.
2017-02-21 15:06:07 +00:00
moneromooo-monero
5664826a84 unit_tests: hardfork unit test now needs get_block_blob_from_height 2017-02-21 14:48:34 +00:00
anonimal
5c3badb749 dns_utils: fix infinite recursion when distributing empty dns_urls
load_txt_records_from_dns attempts to distribute `a = 0, b = -1` where
(b = dns_urls.size() - 1) and IntType is signed integer. This results in
an infinite recursion which leads to SIGSEGV.
2017-02-21 14:38:22 +00:00
Howard Chu
80749e59a8 More for PR #1724
Fix unit_tests build (get_output_key API change)
2017-02-21 13:53:13 +00:00
Howard Chu
86d8a33a4b BerkeleyDB code isn't usable any more, drop from dependencies 2017-02-21 13:33:43 +00:00
Riccardo Spagni
95f59f8c1f Merge pull request #1754
13cd544d Makefile: fix copy/paste mistake in targets (s/freebsd/mac) (moneromooo-monero)
2017-02-21 12:27:42 +02:00
moneromooo-monero
13cd544de3 Makefile: fix copy/paste mistake in targets (s/freebsd/mac) 2017-02-21 10:25:58 +00:00
Riccardo Spagni
2b67346ded Merge pull request #1703
e74b3ab5 core: add p2p bind port options from net_node (moneromooo-monero)
2017-02-21 11:53:20 +02:00
moneromooo-monero
e74b3ab5f7 core: add p2p bind port options from net_node
They're now used by core to determine the data directory to use
for the txpool directory.

This fixes an assert in the core tests, which don't use the RPC
server, which normally initializes the P2P code.
2017-02-21 09:35:23 +00:00
Riccardo Spagni
50fadea8fa Merge pull request #1747
26bd7aac wallet_api: fix logging init via api (moneromooo-monero)
2017-02-21 11:28:58 +02:00
Riccardo Spagni
31a189b7dd Merge pull request #1728
67693415 Fix compiler error about nested externs in slow_hash.c by moving declarations (NanoAkron)
2017-02-21 11:28:31 +02:00
Riccardo Spagni
b252afb0b0 Merge pull request #1736
424b76a4 Fix spurious synchronization status msgs (Howard Chu)
2017-02-21 11:27:49 +02:00
Riccardo Spagni
49efd3add9 Merge pull request #1727
0288310e blockchain_db: add "raw" blobdata getters for block and transaction (moneromooo-monero)
2017-02-21 11:27:15 +02:00
Riccardo Spagni
b67d35a76a Merge pull request #1725
53f04044 cryptonote_protocol: tweaks to the syncing speedup (moneromooo-monero)
2017-02-21 11:26:47 +02:00
Riccardo Spagni
98e34ca157 Merge pull request #1723
d43fde8a network_throttle: demote spammy logs to TRACE (moneromooo-monero)
2017-02-21 11:26:32 +02:00
Riccardo Spagni
88c752b476 Merge pull request #1721
2cde2c02 switch to boost::thread for mingw build (Lee Clagett)
2017-02-21 11:26:09 +02:00
Riccardo Spagni
826f49485e Merge pull request #1716
b560ed4a daemon: silence spurious warning about uninitialized variable (moneromooo-monero)
2017-02-21 11:23:38 +02:00
Riccardo Spagni
59d96eedd8 Merge pull request #1724
cca95c1c blockchain_db: do not throw on expected partial results getting keys (moneromooo-monero)
2017-02-21 11:23:03 +02:00
Riccardo Spagni
7d9e085dcd Merge pull request #1730
72c6b811 README: add/update AUR packaging information (anonimal)
2017-02-21 11:22:36 +02:00
Riccardo Spagni
565c99f670 Merge pull request #1731
a427235e core: add a missing newline on a string to be logged (moneromooo-monero)
b6a2230e unit_tests: fix minor blockchain_db regression (moneromooo-monero)
c488eca5 hardfork: tone down some logs (moneromooo-monero)
2017-02-21 11:21:57 +02:00
Riccardo Spagni
6994c85201 Merge pull request #1733
a493c0b1 BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS was odr-used, so required a definition. (Dion Ahmetaj)
2017-02-21 11:21:14 +02:00
Riccardo Spagni
d11dbe7dc2 Merge pull request #1744
a5a0a3c8 core: updates can now be downloaded (and SHA256 hash checked) (moneromooo-monero)
216f062e util: add a SHA256 function (moneromooo-monero)
4bf78492 mlog: only silence errors for net by default, not net.* (moneromooo-monero)
d282cfcc core: test key images against validity domain (moneromooo-monero)
efb72e74 http_client: add a couple consts (moneromooo-monero)
f640512c Optionally query moneropulse DNS records to check for updates (moneromooo-monero)
e3cae4ae core: display any fork warning at startup too (moneromooo-monero)
969ad710 dns_utils: fix first checked DNS entry being ignored (moneromooo-monero)
08c3f380 util: add a vercmp function to compare version numbers (moneromooo-monero)
e8a7525c dns_utils: factor TXT record loading code from checkpoint code (moneromooo-monero)
2017-02-21 11:16:43 +02:00
Riccardo Spagni
d2059dfab2 Merge pull request #1737
69ab14d9 More robust battery status handling. (Dion Ahmetaj)
2017-02-21 11:16:08 +02:00
Riccardo Spagni
d596722dfa Merge pull request #1749
5a3b1e98 wallet2: fix failure to send (relatedness check in wrong case) (moneromooo-monero)
2017-02-21 11:15:40 +02:00
moneromooo-monero
a5a0a3c894 core: updates can now be downloaded (and SHA256 hash checked) 2017-02-20 22:58:37 +00:00
moneromooo-monero
216f062eb8 util: add a SHA256 function 2017-02-20 22:58:33 +00:00
moneromooo-monero
4bf7849297 mlog: only silence errors for net by default, not net.* 2017-02-20 22:58:29 +00:00
moneromooo-monero
d282cfcc46 core: test key images against validity domain 2017-02-20 22:58:25 +00:00
moneromooo-monero
efb72e74e2 http_client: add a couple consts 2017-02-20 22:58:21 +00:00
moneromooo-monero
f640512c53 Optionally query moneropulse DNS records to check for updates
It just checks and prints a message if there is a new version
for now.
2017-02-20 22:58:16 +00:00
moneromooo-monero
e3cae4ae2e core: display any fork warning at startup too
This is a good time for the operator to be around and see it
2017-02-20 22:58:12 +00:00
moneromooo-monero
969ad710ba dns_utils: fix first checked DNS entry being ignored 2017-02-20 22:58:08 +00:00
moneromooo-monero
08c3f38031 util: add a vercmp function to compare version numbers
It is simple, supports simple x.y.z type numeric versions,
and does not attempt any kind of validation
2017-02-20 22:58:04 +00:00
moneromooo-monero
e8a7525ceb dns_utils: factor TXT record loading code from checkpoint code 2017-02-20 22:57:57 +00:00
Riccardo Spagni
5892f653c7 Merge pull request #1729
9925edcb rpc: fix some RPC calls not returning OK status when needed (moneromooo-monero)
2017-02-21 00:52:12 +02:00
Riccardo Spagni
ba633d33a8 Merge pull request #1732
83ec209f simplewallet: validate hex input size (moneromooo-monero)
2017-02-21 00:51:46 +02:00
Riccardo Spagni
675434ffab Merge pull request #1748
bed2d9f2 Get rid of directory lock (Howard Chu)
2e913676 Handle map resizes from other processes (Howard Chu)
bf1348b7 Can't cache num_txs or num_outputs either (Howard Chu)
dc53e9ee Add a few read txns to streamline (Howard Chu)
2017-02-21 00:51:13 +02:00
Riccardo Spagni
fb9e4e15ed Merge pull request #1752
c3283093 tx_pool: revert template filling changes (moneromooo-monero)
2017-02-21 00:48:14 +02:00
moneromooo-monero
c32830937c tx_pool: revert template filling changes
They are not ready yet
2017-02-20 22:43:37 +00:00
moneromooo-monero
5a3b1e983c wallet2: fix failure to send (relatedness check in wrong case)
A relatedness check was meant to be done in the case of adding
an extra output if just one was enough. This was mistakenly
added to the "preferred output" case.
2017-02-19 09:31:54 +00:00
Howard Chu
bed2d9f231 Get rid of directory lock
We don't need it any more. Fixes issue #1633
2017-02-18 22:22:24 +00:00
Howard Chu
2e9136767e Handle map resizes from other processes 2017-02-18 22:22:24 +00:00
Howard Chu
bf1348b7e2 Can't cache num_txs or num_outputs either
Same reason as 3ff54bdd7a
2017-02-18 21:01:24 +00:00
Howard Chu
dc53e9eef2 Add a few read txns to streamline
Slight perf gain, but mainly to reduce spam at loglevel 3
2017-02-18 21:01:24 +00:00
moneromooo-monero
26bd7aac03 wallet_api: fix logging init via api 2017-02-18 20:44:23 +00:00
Lee Clagett
2cde2c02ca switch to boost::thread for mingw build 2017-02-16 20:10:23 -05:00
Dion Ahmetaj
69ab14d91e More robust battery status handling.
Added an extra path to check for linux power supply status.
Added ignore battery option. If set to true, then when we can't figure out
the power status, we'll assume the system is plugged in.
2017-02-16 14:35:01 -05:00
Dion Ahmetaj
a493c0b196 BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS was odr-used, so required a definition.
Instead of adding a declaration to cpp file, I changed it to non odr-used.
2017-02-15 11:15:12 -05:00
Howard Chu
424b76a4e5 Fix spurious synchronization status msgs
Only update target height if it's actually greater than the current target.
Only display "synchronized" when current height equals target.
2017-02-15 14:41:42 +00:00
moneromooo-monero
83ec209f42 simplewallet: validate hex input size 2017-02-14 19:45:46 +00:00
moneromooo-monero
a427235e30 core: add a missing newline on a string to be logged 2017-02-14 19:14:41 +00:00
moneromooo-monero
b6a2230e6f unit_tests: fix minor blockchain_db regression
Due to the change in ordering for adding block and tx data
to the database in f2986ccfc1,
adding a block twice now throws TX_EXISTS, not BLOCK_EXISTS.
2017-02-14 18:56:42 +00:00
moneromooo-monero
c488eca5e8 hardfork: tone down some logs 2017-02-14 18:56:39 +00:00
anonimal
72c6b81115 README: add/update AUR packaging information 2017-02-14 17:23:00 +00:00
moneromooo-monero
9925edcb1e rpc: fix some RPC calls not returning OK status when needed 2017-02-13 23:50:10 +00:00
moneromooo-monero
b560ed4ac6 daemon: silence spurious warning about uninitialized variable
Also fixes a leak
2017-02-13 22:39:25 +00:00
NanoAkron
67693415ff Fix compiler error about nested externs in slow_hash.c by moving declarations 2017-02-13 22:35:43 +00:00
moneromooo-monero
0288310e3b blockchain_db: add "raw" blobdata getters for block and transaction
This speeds up operations such as serving blocks to syncing peers
2017-02-13 21:11:37 +00:00
moneromooo-monero
53f040445f cryptonote_protocol: tweaks to the syncing speedup
- only pause mining once we've got the lock (in practice, it'll
  already be paused by another thread if we can't get the lock
  at once though)
- do not call prepare_handle_incoming_blocks when we dismissed
  all the blocks, it only causes cleanup_handle_incoming_blocks
  to complain afterwards
2017-02-13 19:36:31 +00:00
moneromooo-monero
cca95c1c7a blockchain_db: do not throw on expected partial results getting keys
When scanning for outputs used in a set of incoming blocks,
we expect that some of the inputs in their transactions will
not be found in the blockchain, as they could be in previous
blocks in that set. Those outputs will be scanned there at
a later point. In this case, we add a flag to control wehther
an output not being found is expected or not.
2017-02-13 19:05:30 +00:00
moneromooo-monero
d43fde8a9b network_throttle: demote spammy logs to TRACE 2017-02-13 16:54:45 +00:00
Riccardo Spagni
3f171b931f Merge pull request #1719
59c9d165 tests: fixup include paths after cryptonote_core split (moneromooo-monero)
2017-02-12 23:57:34 +02:00
moneromooo-monero
59c9d165f8 tests: fixup include paths after cryptonote_core split 2017-02-12 21:47:39 +00:00
Riccardo Spagni
6e78915061 Merge pull request #1718
882db8e9 tools: log to the correct file (moneromooo-monero)
142e5e1e tools: set requested log level (moneromooo-monero)
2017-02-12 23:28:56 +02:00
Riccardo Spagni
e246dd1443 Merge pull request #1717
8bdc86be protocol: speed up sync by minimizing duplicate work (moneromooo-monero)
61dfa310 epee: fix some log macros not printing context nicely (moneromooo-monero)
2017-02-12 23:28:38 +02:00
Riccardo Spagni
f4e2539a32 Merge pull request #1715
8ec2a8d2 net_node: fix spurious warning about using uninitialized data (moneromooo-monero)
2017-02-12 23:27:08 +02:00
Riccardo Spagni
92fe31fd44 Merge pull request #1714
5adcb5a4 tx_pool: add a debug message when adding a tx to the pool (moneromooo-monero)
9faef1f8 cryptonote_protocol: misc fluffy block fixes (moneromooo-monero)
2017-02-12 23:26:02 +02:00
Riccardo Spagni
4e7bcad58f Merge pull request #1713
422ecc98 Fixup choice of easylogging++ vs libunwind stack trace code (moneromooo-monero)
2017-02-12 23:25:42 +02:00
Riccardo Spagni
b0e992237e Merge pull request #1712
3b6839cc mlog: move log level changes to global level (moneromooo-monero)
38a1b9c9 rpc: fix daemon mixed style set_log 2,category:level (moneromooo-monero)
28d0b11f mlog: s/Mew/New/ in log (moneromooo-monero)
2017-02-12 23:25:07 +02:00
Riccardo Spagni
b1df7f114d Merge pull request #1711
cf2e75eb daemon: fix crash on exit when mining (moneromooo-monero)
2017-02-12 23:24:49 +02:00
Riccardo Spagni
47687399fb Merge pull request #1709
b2ac939e Fix GUI building after libcryptonote_core was split (#1626) (iDunk5400)
2017-02-12 23:24:19 +02:00
Riccardo Spagni
6a261fa1bc Merge pull request #1708
f2986ccf db_lmdb: fix bad height saved in tx data (moneromooo-monero)
2017-02-12 23:23:46 +02:00
Riccardo Spagni
e6c29eb5fc Merge pull request #1706
7403e56f performance_tests: report small time per call in microseconds (moneromooo-monero)
cadada2d performance_tests: add tests for sc_reduce32 and cn_fast_hash (moneromooo-monero)
962c72b6 performance_tests: initialize logging at startup (moneromooo-monero)
2017-02-12 23:23:17 +02:00
Riccardo Spagni
c64e10c2d7 Merge pull request #1700
73785263 backtrace_symbols() requires -lexecinfo on dragonflybsd (Dan Miller)
2017-02-12 23:20:27 +02:00
Riccardo Spagni
71770d1a78 Merge pull request #1699
dd348549 make previous change portable (Timothy D. Prime)
32d7d048 fixes #1688 protect make debug-test from gtest (Timothy D. Prime)
2017-02-12 23:19:33 +02:00
Riccardo Spagni
af48b6cf22 Merge pull request #1582
ad95e650 Added a note about smart mining to status command. Fixed up a bug where I was resetting bg mining enabled instead of started. Upped the miner threshold. Also moved setting of enabled on start above miner thread creation since starting with true, then stopping, then starting with false resulted in race condition. (Dion Ahmetaj)
e4dfd2fb Changed ac_line_status to on_battery_power. (Dion Ahmetaj)
23c73269 Use defined directive to silence pre-proc warnings. (Dion Ahmetaj)
d2c7d0f6 Cleaned up some logging. Thanks to moneromooo for help. (Dion Ahmetaj)
68652cd9 Added some //TODO comments pertaining to returning enums instead of bools in order to be better able to handle failure states. (Dion Ahmetaj)
0b1045ed Moved around checking of AC power in order to bail quicker to sleep if not plugged in. (Dion Ahmetaj)
2937fdbb Moved setting of previous process times to block where background mining is started, and added an explicit sleep in that block to wait for some mining to occur. (Dion Ahmetaj)
21a1e025 Set background mining started bool to false on bg thread start. If mining::stop then mining::start, idle logic is re-run instead of starting immediately (if it was running before stop). (Dion Ahmetaj)
345ed482 Background/smart mining. If a users' computer is plugged into a power source, and CPU has been idle for some time, then begin mining to some threshold (don't destroy the users' CPU). (Dion Ahmetaj)
2017-02-12 23:11:44 +02:00
moneromooo-monero
882db8e9d9 tools: log to the correct file 2017-02-12 19:39:59 +00:00
moneromooo-monero
142e5e1eb4 tools: set requested log level
also move a couple logs from INFO to DEBUG
2017-02-12 18:48:39 +00:00
moneromooo-monero
8bdc86beb4 protocol: speed up sync by minimizing duplicate work
In particular, the prepare_handle_incoming_blocks call
is pretty lengthy, and entirely pointless in the common
case where several different connections will prepare
the exact same blocks.
2017-02-12 17:17:30 +00:00
moneromooo-monero
61dfa310d7 epee: fix some log macros not printing context nicely 2017-02-12 17:16:11 +00:00
moneromooo-monero
8ec2a8d2b0 net_node: fix spurious warning about using uninitialized data
This is only used to load, not save
2017-02-12 14:06:36 +00:00
moneromooo-monero
422ecc98e4 Fixup choice of easylogging++ vs libunwind stack trace code 2017-02-12 13:59:21 +00:00
moneromooo-monero
5adcb5a48c tx_pool: add a debug message when adding a tx to the pool 2017-02-12 12:33:48 +00:00
moneromooo-monero
9faef1f83a cryptonote_protocol: misc fluffy block fixes
- fix wrong block being used when a new block is received between
  a node elaying a fluffy block and sending a new fluffy block
  with txes a peer did not have
- misc a neverending ping pong requesting the same missing txids
  when a new block is received in the meantime, causing the top
  block to not be the one we need
- send the original fluffy block message block height when sending
  a new fluffy block, not the current top height, which might
  have been updated since
- avoid sending back the whole block blob when asking for txes,
  send only the hash instead
- plus misc cleanup and additional debugging logs
2017-02-12 12:33:45 +00:00
moneromooo-monero
3b6839cc96 mlog: move log level changes to global level
Makes it more likely to show up
2017-02-12 11:45:22 +00:00
moneromooo-monero
38a1b9c956 rpc: fix daemon mixed style set_log 2,category:level 2017-02-12 11:37:09 +00:00
moneromooo-monero
28d0b11fde mlog: s/Mew/New/ in log 2017-02-12 11:35:04 +00:00
moneromooo-monero
cf2e75ebb3 daemon: fix crash on exit when mining
When exiting while the miner is running, finding a block after
the p2p layer has been shutdown will cause a crash as the now
uninitialized p2p layer is asked to relay the found block to
any peers.
2017-02-12 11:09:21 +00:00
iDunk5400
b2ac939eb3 Fix GUI building after libcryptonote_core was split (#1626) 2017-02-11 17:00:55 +01:00
moneromooo-monero
f2986ccfc1 db_lmdb: fix bad height saved in tx data
The recent change to not keep separate track of the blockchain
height caused the reported height to jump early in the lmdb
transaction (when the block data is added to the blocks table),
rather than at the end, after everything succeeded. Since the
block data is added before the transaction data, this caused
the transaction data to be saved with a height one more than
its expected value.

Fix this by saving the block data last. This should have no
side effects.
2017-02-11 10:16:18 +00:00
Dion Ahmetaj
ad95e65028 Added a note about smart mining to status command. Fixed up a bug where I was resetting bg mining enabled instead of started. Upped the miner threshold. Also moved setting of enabled on start above miner thread creation since starting with true, then stopping, then starting with false resulted in race condition. 2017-02-10 18:07:43 -05:00
Dion Ahmetaj
e4dfd2fb63 Changed ac_line_status to on_battery_power. 2017-02-10 18:07:42 -05:00
Dion Ahmetaj
23c73269ca Use defined directive to silence pre-proc warnings. 2017-02-10 18:07:41 -05:00
Dion Ahmetaj
d2c7d0f6b0 Cleaned up some logging. Thanks to moneromooo for help. 2017-02-10 18:07:41 -05:00
Dion Ahmetaj
68652cd94d Added some //TODO comments pertaining to returning enums instead of bools in order to be better able to handle failure states. 2017-02-10 18:07:41 -05:00
Dion Ahmetaj
0b1045ed7d Moved around checking of AC power in order to bail quicker to sleep if not plugged in. 2017-02-10 18:07:40 -05:00
Dion Ahmetaj
2937fdbbbf Moved setting of previous process times to block where background mining is started, and added an explicit sleep in that block to wait for some mining to occur. 2017-02-10 18:07:40 -05:00
Dion Ahmetaj
21a1e0252f Set background mining started bool to false on bg thread start. If mining::stop then mining::start, idle logic is re-run instead of starting immediately (if it was running before stop). 2017-02-10 18:07:39 -05:00
Dion Ahmetaj
345ed4823c Background/smart mining. If a users' computer is plugged into a power
source, and CPU has been idle for some time, then begin mining to some
threshold (don't destroy the users' CPU).

This patch only supports windows and linux (I've only tested on Win64 and
Ubuntu).

The variables currently default to pretty conservative values (i.e. 20%
CPU mining threshold).
2017-02-10 18:07:39 -05:00
moneromooo-monero
7403e56fb4 performance_tests: report small time per call in microseconds
This is to not report quick operations as 0 milliseconds
2017-02-10 22:56:34 +00:00
Riccardo Spagni
cb54eeaa31 Merge pull request #1698
9459f331 simplewallet: print error when address is wrong (kenshi84)
2017-02-11 00:54:30 +02:00
Riccardo Spagni
d1b7ad3f1a Merge pull request #1696
6ea3e3cc Fix race in setThreadName/getThreadName (Lee Clagett)
2017-02-11 00:53:31 +02:00
Riccardo Spagni
c7750b2570 Merge pull request #1694
27c3a0ea ITS#8582 keep mutex at end of struct (Howard Chu)
2017-02-11 00:47:37 +02:00
Riccardo Spagni
9ed3e1bb6a Merge pull request #1693
5d00659e disable ELPP_STACKTRACE_ON_CRASH for android (MoroccanMalinois)
2017-02-11 00:40:17 +02:00
Riccardo Spagni
eacf2124b6 Merge pull request #1689
ce7fcbb4 Add server auth to monerod, and client auth to wallet-cli and wallet-rpc (Lee Clagett)
2017-02-11 00:35:25 +02:00
Miguel Herranz
8277e67f11 Add anchor connections
Based on https://eprint.iacr.org/2015/263.pdf 4. Anchor connections.

Peer list serialisation version bumped to 5.
2017-02-10 23:28:54 +01:00
Riccardo Spagni
9296960081 Merge pull request #1686
bceaf4b7 wallet2: fix transactions not considering rct inputs (moneromooo-monero)
2017-02-11 00:22:17 +02:00
Riccardo Spagni
9781ecaa70 Merge pull request #1685
7549116e Wallet API: Easylogger wrapper for gui (Jaquee)
2017-02-11 00:21:51 +02:00
Riccardo Spagni
003a51d399 Merge pull request #1682
1c782a92 easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG (moneromooo-monero)
2017-02-11 00:21:31 +02:00
Riccardo Spagni
4feaa790e2 Merge pull request #1680
db0a5392 Clarify in/out connections for users (NanoAkron)
2017-02-11 00:21:12 +02:00
Riccardo Spagni
d1b31c0f45 Merge pull request #1626
8027ce0c extract some basic code from libcryptonote_core into libcryptonote_basic (kenshi84)
2017-02-11 00:20:41 +02:00
moneromooo-monero
cadada2d65 performance_tests: add tests for sc_reduce32 and cn_fast_hash 2017-02-10 18:45:18 +00:00
moneromooo-monero
962c72b624 performance_tests: initialize logging at startup 2017-02-10 18:44:47 +00:00
Dan Miller
7378526393 backtrace_symbols() requires -lexecinfo on dragonflybsd
freebsd also needs -lexecinfo for backtrace()
2017-02-09 11:22:12 -08:00
Timothy D. Prime
dd3485492d make previous change portable
Use cmake's _PREFIX and _SUFFIX to determine the library location.
2017-02-08 13:34:35 -08:00
Timothy D. Prime
32d7d04858 fixes #1688 protect make debug-test from gtest
In simple terms, add_subdirectory() is replaced with ExternalProject_Add().

This change is inspired by https://crascit.com/2015/07/25/cmake-gtest/
with one difference, no download, using the source we already have.

Before this change, make debug-test must be preceded by make clean.
Otherwise, a subsequent build would be polluted by cmake options made
by tests/gtest/.

Also removed the changed compiler flags.  My test build did not have
the affected warnings.
2017-02-08 12:38:41 -08:00
kenshi84
9459f33178 simplewallet: print error when address is wrong 2017-02-08 23:04:48 +09:00
kenshi84
8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Riccardo Spagni
99ee3fd17e Merge pull request #1679
4efc926d Wallet API: Catch error from tools::is_local_address (Jaquee)
2017-02-08 12:53:57 +02:00
Riccardo Spagni
8d1562077f Merge pull request #1678
c833a39a cmake set atomic for android (MoroccanMalinois)
2017-02-08 12:53:19 +02:00
Riccardo Spagni
d30b64f457 Merge pull request #1674
92978b2c common: fix link error on at least one platform (no clue which one) (moneromooo-monero)
2017-02-08 12:51:11 +02:00
Riccardo Spagni
30e38cd6a3 Merge pull request #1683
bab1e9a3  bugfix: infinite recursion in get_account_address_from_str_or_url (kenshi84)
2017-02-08 12:48:54 +02:00
Lee Clagett
6ea3e3ccc7 Fix race in setThreadName/getThreadName 2017-02-07 21:33:26 -05:00
Howard Chu
27c3a0ea9f ITS#8582 keep mutex at end of struct
since it's variable size on Linux/glibc
2017-02-07 15:12:05 +00:00
moneromooo-monero
bceaf4b788 wallet2: fix transactions not considering rct inputs
I broke this very recently in 2bf029be17
and didn't notice in time
2017-02-06 20:20:22 +00:00
Lee Clagett
ce7fcbb4ae Add server auth to monerod, and client auth to wallet-cli and wallet-rpc 2017-02-06 01:15:41 -05:00
MoroccanMalinois
5d00659e1d disable ELPP_STACKTRACE_ON_CRASH for android 2017-02-06 05:14:15 +00:00
Jaquee
7549116ec3 Wallet API: Easylogger wrapper for gui 2017-02-05 20:12:01 +01:00
kenshi84
bab1e9a397 bugfix: infinite recursion in get_account_address_from_str_or_url 2017-02-05 23:20:16 +09:00
moneromooo-monero
1c782a923d easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG 2017-02-05 12:47:53 +00:00
Riccardo Spagni
3473af00ad Merge pull request #1655
b14d109b update wallet api tests (Jaquee)
0cc50bdd GUI: Improved refresh performance (Jaquee)
805625b5 wallet api: Remove initAsync() and don't start refresh automatically on init (Jaquee)
031b060a wallet2::init() - disconnect before init if connected Makes it possible for GUI to reinit with new daemon without closing and reopening wallet. (Jaquee)
2017-02-05 13:42:41 +02:00
NanoAkron
db0a5392a5 Clarify in/out connections for users 2017-02-05 11:15:51 +00:00
moneromooo-monero
92978b2c0f common: fix link error on at least one platform (no clue which one)
Bug and fix reported by tdprime
2017-02-05 10:55:55 +00:00
Jaquee
4efc926d28 Wallet API: Catch error from tools::is_local_address 2017-02-05 11:08:05 +01:00
MoroccanMalinois
c833a39a4d cmake set atomic for android 2017-02-05 04:33:33 +01:00
Jaquee
b14d109bae update wallet api tests 2017-02-04 23:25:10 +01:00
Jaquee
0cc50bdd11 GUI: Improved refresh performance 2017-02-04 23:25:05 +01:00
Jaquee
805625b541 wallet api: Remove initAsync() and don't start refresh automatically on init 2017-02-04 23:25:03 +01:00
Jaquee
031b060af0 wallet2::init() - disconnect before init if connected
Makes it possible for GUI to reinit with new daemon without closing and reopening wallet.
2017-02-04 23:10:20 +01:00
Riccardo Spagni
e56bf442c3 Merge pull request #1669
4f5b130d wallet_rpc_server: add address book RPC calls (moneromooo-monero)
2017-02-04 17:28:53 +02:00
Riccardo Spagni
9547e79af5 Merge pull request #1670
c3d7a198 mlog: probable fix for gmtime_r not being available on windows (moneromooo-monero)
2017-02-04 17:28:23 +02:00
Riccardo Spagni
5da4650cba Merge pull request #1671
cd34fc65 Use easylogging++'s stack trace facility where possible (moneromooo-monero)
2017-02-04 17:27:54 +02:00
Riccardo Spagni
602f31d187 Merge pull request #1672
cbdfa757 mlog: fix default logging being not verbose enough (moneromooo-monero)
2017-02-04 17:27:19 +02:00
Riccardo Spagni
c3c281e699 Merge pull request #1666
03ff3639 Fix missing parentheses (Miguel Herranz)
2017-02-04 17:26:19 +02:00
Riccardo Spagni
bcb7b0a9af Merge pull request #1665
34719071 simplewallet: cleanup (moneromooo-monero)
a9a9b64b simplewallet: fix build (unqualified type not in current scope) (moneromooo-monero)
2017-02-04 17:21:11 +02:00
Riccardo Spagni
eb21389953 Merge pull request #1664
b5cb8861 core: fix integrated addresses breaking with auto zero change (moneromooo-monero)
2017-02-04 17:20:02 +02:00
Riccardo Spagni
31cf4e7362 Merge pull request #1640
f97526e6 simplewallet: option to always ask password for any crytical operations (kenshi84)
2017-02-04 17:18:38 +02:00
moneromooo-monero
cbdfa7576a mlog: fix default logging being not verbose enough 2017-02-04 12:43:19 +00:00
moneromooo-monero
cd34fc655d Use easylogging++'s stack trace facility where possible
This avoids using libunwind, which often causes trouble.
2017-02-04 12:33:03 +00:00
moneromooo-monero
c3d7a198bf mlog: probable fix for gmtime_r not being available on windows 2017-02-04 11:48:58 +00:00
moneromooo-monero
4f5b130de9 wallet_rpc_server: add address book RPC calls 2017-02-04 11:40:49 +00:00
kenshi84
f97526e641 simplewallet: option to always ask password for any crytical operations 2017-02-03 09:38:12 +09:00
Miguel Herranz
03ff363982 Fix missing parentheses 2017-02-02 22:05:31 +01:00
moneromooo-monero
3471907160 simplewallet: cleanup
Remove empty static function which was refactored, as well as
leftover exception testing code.
2017-02-02 20:56:53 +00:00
moneromooo-monero
a9a9b64b13 simplewallet: fix build (unqualified type not in current scope) 2017-02-02 20:56:31 +00:00
moneromooo-monero
b5cb8861c7 core: fix integrated addresses breaking with auto zero change
Zero change is sent to a random address, which confuses the code
which determines which key to use to encrypt the payment id.
Ignore zero amounts for this purpose, so the payment id gets
encrypted with the real destination's key.
2017-02-02 20:53:12 +00:00
Riccardo Spagni
b01990124e Merge pull request #1663
bbcc3a12 Add missing include (Miguel Herranz)
2017-02-02 22:41:58 +02:00
Riccardo Spagni
fcb299b4ae Merge pull request #1641
ca94d0a4 Separate data per P2P port (Miguel Herranz)
2017-02-02 22:41:28 +02:00
Riccardo Spagni
da9174c8ee Merge pull request #1656
edfd7f6e Workaround VL32 cursor refcounting miscount (Howard Chu)
2017-02-02 21:39:03 +02:00
Riccardo Spagni
f4fe39ca92 Merge pull request #1654
084aef70 Added days uptime to the status message (NanoAkron)
2017-02-02 21:38:15 +02:00
Riccardo Spagni
58c87786ae Merge pull request #1652
fba9332d Changed console output for transaction from L0 to L1 (NanoAkron)
2017-02-02 21:36:56 +02:00
Riccardo Spagni
345396e056 Merge pull request #1651
fc91e6a7 Fixed a deadlock issue with easylogger++ (NanoAkron)
2017-02-02 21:36:07 +02:00
Riccardo Spagni
011c5a8a7c Merge pull request #1647
2bf029be wallet2: fix corner case failing to send a second output (moneromooo-monero)
2017-02-02 21:35:31 +02:00
Riccardo Spagni
3aa008e4c6 Merge pull request #1646
95f3e193 Update and use blockchain data files defines (Miguel Herranz)
2017-02-02 21:34:31 +02:00
Riccardo Spagni
10b625079b Merge pull request #1645
9bd9906e Factor is_address_local code into a tools function (moneromooo-monero)
2017-02-02 21:27:45 +02:00
Riccardo Spagni
614400e5af Merge pull request #1643
69d2ad39 wallet_rpc_server: fix logs going to the wrong file (moneromooo-monero)
2017-02-02 21:26:56 +02:00
Riccardo Spagni
c3eff820be Merge pull request #1642
3ae79a59 core: set missing verifivation_failed flag when rejecting a tx (moneromooo-monero)
ea6549e9 core_tests: decrease trace level from trace to debug (moneromooo-monero)
2017-02-02 21:25:30 +02:00
Riccardo Spagni
ab2b3480b2 Merge pull request #1639
48aa9cf0 Add change_password for simplewallet (Ashley Perpetual)
2017-02-02 21:22:30 +02:00
Riccardo Spagni
72aa788a0e Merge pull request #1636
cc1462e0 Add concurrency check to rpc mining to ensure not too many threads. number of cores times 4 or 257. (Ashley Perpetual)
2017-02-02 21:12:13 +02:00
Miguel Herranz
bbcc3a125f Add missing include
Fails to build without it.
2017-02-02 19:54:17 +01:00
Riccardo Spagni
5bb95fc613 Merge pull request #1634
99f58437 Fix invalid + of std::string and int (Timothy D. Prime)
2017-02-02 19:43:05 +02:00
Riccardo Spagni
a6f61b8419 Merge pull request #1631
58e82506 Blockfill - Sort tx pool correctly (Alexis Enston)
5f7a8741 Blockfill - Take TX fees into account properly (Alexis Enston)
4ecab0d8 Consider empty block when filling with TXs (Alexis Enston)
2017-02-02 19:41:25 +02:00
Riccardo Spagni
5fb3f97a55 Merge pull request #1629
c02e1cb9 Updates to epee HTTP client code   - http_simple_client now uses std::chrono for timeouts   - http_simple_client accepts timeouts per connect / invoke call   - shortened names of epee http invoke functions   - invoke command functions only take relative path, connection     is not automatically performed (Lee Clagett)
2017-02-02 19:32:01 +02:00
Riccardo Spagni
10bf54bfc9 Merge pull request #1628
66665003 Clear feedback to user when daemon has stopped successfully (NanoAkron)
2017-02-02 18:44:41 +02:00
Riccardo Spagni
ca2e2c2453 Merge pull request #1627
55a8e982 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core (kenshi84)
2017-02-02 18:24:08 +02:00
Riccardo Spagni
cc03036e3e Merge pull request #1624
a39cd745 rpc: fix bc_dyn_stats not setting grace blocks (moneromooo-monero)
2017-02-02 18:20:07 +02:00
Riccardo Spagni
f9e60dcd55 Merge pull request #1617
0644eed7 Remove boost/foreach.cpp includes (Miguel Herranz)
36dd3e23 Replace BOOST_REVERSE_FOREACH with ranged for (Miguel Herranz)
629e3101 Replace BOOST_FOREACH with C++11 ranged for (Miguel Herranz)
2017-02-02 18:16:39 +02:00
Riccardo Spagni
05de1bc398 Merge pull request #1614
7b6a9e91 Added instructions for getting stack traces with gdb (NanoAkron)
2017-02-02 18:08:18 +02:00
NanoAkron
fc91e6a75a Fixed a deadlock issue with easylogger++
Ubuntu 16.04/GCC 5.4.0/ARMv8 fix to match previous recursive mutex fix for GCC
2017-02-01 10:16:57 +00:00
Howard Chu
edfd7f6e07 Workaround VL32 cursor refcounting miscount
Don't try to deref cursor page if txn's pagelist is empty
2017-01-31 10:38:12 +00:00
NanoAkron
084aef700b Added days uptime to the status message
Also broke down the time calculations for legibility
2017-01-31 09:49:32 +00:00
luigi1111
15eb2bcf6f Merge pull request #1649
aa95619 GUI: Add install target for epee (Jaqueeee)
2017-01-30 17:57:19 -06:00
luigi1111
1cb5905e71 Merge pull request #1637
6b14576 Fix clang build failure, caused by mixing C and C++ (tdprime)
2017-01-30 17:55:52 -06:00
luigi1111
3cef7fbbb6 Merge pull request 1635
774a213 Wallet API: Create wallet from keys (Jaqueeee)
2017-01-30 17:09:38 -06:00
luigi1111
ef987e5e49 Merge pull request 1648
8c8482a wallet_rpc_server: fix short payment id validation in transfer (moneromooo-monero)
2017-01-30 17:03:07 -06:00
Jaquee
aa9561909a GUI: Add install target for epee 2017-01-30 23:29:05 +01:00
Jaquee
774a21394a Wallet API: Create wallet from keys 2017-01-30 23:28:09 +01:00
NanoAkron
fba9332de8 Changed console output for transaction from L0 to L1 2017-01-30 03:24:51 +00:00
moneromooo-monero
8c8482ac98 wallet_rpc_server: fix short payment id validation in transfer 2017-01-29 16:10:20 +00:00
Ashley Perpetual
48aa9cf035 Add change_password for simplewallet 2017-01-29 03:04:17 +08:00
moneromooo-monero
2bf029be17 wallet2: fix corner case failing to send a second output
If a rct transaction can be made with just one input, a second
output will be added. This output will be the smallest amount
output available. However, if this output is a non rct output
with less available fake outs than requested, the transaction
will be rejected. We now check the histogram to only consider
outputs with enough available fake outs in the first place.
2017-01-28 15:07:15 +00:00
moneromooo-monero
9bd9906e8f Factor is_address_local code into a tools function 2017-01-28 14:57:47 +00:00
Miguel Herranz
95f3e193f0 Update and use blockchain data files defines 2017-01-28 15:55:14 +01:00
Miguel Herranz
ca94d0a43c Separate data per P2P port
poolstate.bin and p2pstate.bin are stored in .bitmonero/ if the default
P2P port is being used.

If another port is used both files are stored in
.bitmonero/PORTNUMBER/.
2017-01-28 14:16:06 +01:00
moneromooo-monero
69d2ad3967 wallet_rpc_server: fix logs going to the wrong file 2017-01-28 11:37:21 +00:00
moneromooo-monero
3ae79a59e4 core: set missing verifivation_failed flag when rejecting a tx
This fixes two core rct tests
2017-01-28 09:43:41 +00:00
moneromooo-monero
ea6549e9da core_tests: decrease trace level from trace to debug
It had become very, very spammy
2017-01-28 09:43:32 +00:00
Ashley Perpetual
cc1462e0b7 Add concurrency check to rpc mining to ensure not too many threads. number of cores times 4 or 257. 2017-01-28 05:59:56 +08:00
luigi1111
4629ead8c5 Merge pull request #1618 2017-01-27 11:33:26 -06:00
Timothy D. Prime
6b145763f7 Fix clang build failure, caused by mixing C and C++
Easily fixed by moving a C++ header out of 'extern "C" {...}'.

When building with CC=clang CXX=clang++ make,
[ 21%] Building CXX object src/ringct/CMakeFiles/obj_ringct.dir/rctTypes.cpp.o
In file included from /home/tdprime/bitmonero/src/ringct/rctTypes.cpp:31:
In file included from /home/tdprime/bitmonero/src/ringct/rctTypes.h:43:
In file included from /home/tdprime/bitmonero/src/crypto/generic-ops.h:34:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/cstring:100:3: error: conflicting types for 'memchr'
  memchr(void* __s, int __c, size_t __n)
    ^
	/usr/include/string.h:92:14: note: previous declaration is here
	extern void *memchr (const void *__s, int __c, size_t __n)
	             ^
... and 4 more similar errors
2017-01-26 17:30:00 -08:00
Timothy D. Prime
99f584376e Fix invalid + of std::string and int
These warnings were emitted by clang++, and they are real bugs.
src/rpc/core_rpc_server.cpp:208:58: warning: adding 'uint64_t'
      (aka 'unsigned long') to a string does not append to the string
      [-Wstring-plus-int]
        res.status = "Error retrieving block at height " + height;
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
The obvious intent is achieved by using std::to_string().
2017-01-26 10:11:37 -08:00
Lee Clagett
c02e1cb943 Updates to epee HTTP client code
- http_simple_client now uses std::chrono for timeouts
  - http_simple_client accepts timeouts per connect / invoke call
  - shortened names of epee http invoke functions
  - invoke command functions only take relative path, connection
    is not automatically performed
2017-01-25 15:39:32 -05:00
Alexis Enston
58e825060e Blockfill - Sort tx pool correctly 2017-01-25 12:06:19 +00:00
Alexis Enston
5f7a8741b9 Blockfill - Take TX fees into account properly 2017-01-25 11:59:25 +00:00
Alexis Enston
4ecab0d80c Consider empty block when filling with TXs 2017-01-25 11:59:15 +00:00
NanoAkron
66665003bd Clear feedback to user when daemon has stopped successfully 2017-01-25 00:37:23 +00:00
kenshi84
55a8e982c0 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core 2017-01-24 20:31:03 +09:00
NanoAkron
7b6a9e91eb Added instructions for getting stack traces with gdb 2017-01-23 23:34:15 +00:00
moneromooo-monero
a39cd745c9 rpc: fix bc_dyn_stats not setting grace blocks
This caused a random value to be used, and the resulting
incorrect fee when it wasn't 0.
2017-01-23 19:28:00 +00:00
Riccardo Spagni
ad91ffe7e5 Merge pull request #1622
8141973e Remove unreachable returns (Miguel Herranz)
2017-01-23 08:11:24 -05:00
Riccardo Spagni
6f39ba5909 Merge pull request #1621
feed6175 fixed typo: monero-wallet-cli,log (kenshi84)
2017-01-23 08:11:02 -05:00
Riccardo Spagni
72626a04d8 Merge pull request #1620
98357db4 Update log messages to reflect fact we no longer need to type `exit` to save database before quitting (NanoAkron)
2017-01-23 08:10:26 -05:00
Miguel Herranz
8141973e00 Remove unreachable returns
CATCH_ENTRY_L0 already returns the second value.
2017-01-23 11:29:34 +01:00
kenshi84
feed6175ea fixed typo: monero-wallet-cli,log 2017-01-23 11:44:06 +09:00
NanoAkron
98357db400 Update log messages to reflect fact we no longer need to type exit to save database before quitting 2017-01-23 01:21:26 +00:00
Miguel Herranz
0644eed772 Remove boost/foreach.cpp includes 2017-01-22 23:31:34 +01:00
=
e92c4fff1a Wallet api: testnet getter 2017-01-22 23:02:01 +01:00
Miguel Herranz
36dd3e238f Replace BOOST_REVERSE_FOREACH with ranged for 2017-01-22 21:47:39 +01:00
Miguel Herranz
629e3101ab Replace BOOST_FOREACH with C++11 ranged for 2017-01-22 21:38:10 +01:00
Riccardo Spagni
daf66621dc Merge pull request #1608
1e8cc676 mlog: allow using numerical level as default prefix (moneromooo-monero)
8028b532 protocol: log received messages in a separate category (moneromooo-monero)
2017-01-22 12:21:28 -05:00
moneromooo-monero
1e8cc6764e mlog: allow using numerical level as default prefix
eg, 2,foo:ERROR,bar:INFO
2017-01-22 16:54:17 +00:00
moneromooo-monero
8028b5324e protocol: log received messages in a separate category
Makes it easier to log just what's going on on P2P
2017-01-22 16:54:10 +00:00
Riccardo Spagni
9c06a7fd04 Merge pull request #1615
f0989893 core: cache tx hashes of failing semantics txes (moneromooo-monero)
2017-01-22 11:51:53 -05:00
Riccardo Spagni
cccf4b9889 Merge pull request #1613
13dd102e mlog: fix default level/category mapping (moneromooo-monero)
2017-01-22 11:50:04 -05:00
Riccardo Spagni
17247b23bf Merge pull request #1612
20f71527 wallet2: fix sending a rct tx with a single output available (moneromooo-monero)
2017-01-22 11:49:20 -05:00
Riccardo Spagni
a3de797e57 Merge pull request #1610
b70ab128 rpc: fix orphan_status when getting blocks (moneromooo-monero)
2017-01-22 11:48:39 -05:00
Riccardo Spagni
add98edfc3 Merge pull request #1609
4cdf0a35 p2p: always recreate a new peer id on startup (moneromooo-monero)
2017-01-22 11:47:43 -05:00
Riccardo Spagni
8e79271a19 Merge pull request #1607
f9293b69 unit_tests: fix missing return after batch_start prototype change (moneromooo-monero)
2017-01-22 11:47:02 -05:00
Riccardo Spagni
f798a2ab85 Merge pull request #1606
f8b97aef p2p: show ban/unban logs by default again (moneromooo-monero)
2017-01-22 11:43:11 -05:00
Riccardo Spagni
ee45b7a6db Merge pull request #1605
7c3f79cb core: early out in handle_incoming_tx if already in pool or blockchain (moneromooo-monero)
6cc7d261 ringct: reorder a bit to check quicker tests first (moneromooo-monero)
2017-01-22 11:42:15 -05:00
Riccardo Spagni
e12f073f65 Merge pull request #1604
a854cec3 Make stack trace show up in log file with default settings (moneromooo-monero)
2017-01-22 11:41:38 -05:00
Riccardo Spagni
036d0d8838 Merge pull request #1601
c3b8ddff streamline (vdo)
2017-01-22 11:40:23 -05:00
Riccardo Spagni
bd068afa44 Merge pull request #1600
1c4d65c0 Rename method to get_random_gray_peer (Miguel Herranz)
03a54ee0 Fix logging that broke after rebasing (Miguel Herranz)
6bdd3a59 Use set_peer_just_seen to keep last_seen updated (Miguel Herranz)
82dbeedd Add gray peer list housekeeping system (Miguel Herranz)
2017-01-22 11:39:00 -05:00
Riccardo Spagni
ab9c287d92 Merge pull request #1597
4d6976fb undelete epee tests.cpp (moneroexamples)
0fd2508b removing some unsed epee files (moneroexamples)
2017-01-22 11:37:46 -05:00
moneromooo-monero
f098989396 core: cache tx hashes of failing semantics txes 2017-01-22 16:13:31 +00:00
moneromooo-monero
13dd102e94 mlog: fix default level/category mapping
It was not matching the LOG_PRINT_Lx mapping for 2/3/4
2017-01-22 15:20:55 +00:00
moneromooo-monero
20f7152769 wallet2: fix sending a rct tx with a single output available
This would have tried to send a second output to make the tx
look like the 2/2 ideal, but it would not fail to find one
because picking an output from preferred_inputs priority list
did not remove it from the unused tranfer/dust outputs, so
it would try to send the same output twice.

While there, I also added a check to avoid sending a second
input if it's related to the first. Better 1/2 than linking
inputs, I think.
2017-01-22 15:16:45 +00:00
moneromooo-monero
b70ab128fc rpc: fix orphan_status when getting blocks
It was always set to false, even for orphan blocks
2017-01-22 12:20:55 +00:00
moneromooo-monero
4cdf0a35c9 p2p: always recreate a new peer id on startup
This prevents easy fingerprinting when you change IPs, and
will be a must when kovri gets used.
2017-01-22 11:37:55 +00:00
moneromooo-monero
f9293b69d8 unit_tests: fix missing return after batch_start prototype change 2017-01-21 21:51:07 +00:00
moneromooo-monero
f8b97aef34 p2p: show ban/unban logs by default again 2017-01-21 21:19:21 +00:00
moneromooo-monero
7c3f79cb9f core: early out in handle_incoming_tx if already in pool or blockchain 2017-01-21 20:30:10 +00:00
moneromooo-monero
6cc7d26140 ringct: reorder a bit to check quicker tests first 2017-01-21 20:29:22 +00:00
moneromooo-monero
a854cec3ba Make stack trace show up in log file with default settings 2017-01-21 20:28:18 +00:00
Miguel Herranz
1c4d65c011 Rename method to get_random_gray_peer 2017-01-21 13:04:49 +01:00
Miguel Herranz
03a54ee0c9 Fix logging that broke after rebasing 2017-01-21 11:22:04 +01:00
Miguel Herranz
6bdd3a59b5 Use set_peer_just_seen to keep last_seen updated 2017-01-21 10:11:32 +01:00
Miguel Herranz
82dbeedd1b Add gray peer list housekeeping system
A random peer from the gray peer list is selected and a connection is
made to check if the peer is alive.

If the connection and handshake are successful the peer is promoted to
the white peer list, in case of failure the peer is evicted from the
gray peer list.

The connection is closed after the check in either case.
2017-01-21 10:09:38 +01:00
vdo
c3b8ddff93 streamline 2017-01-21 04:21:00 +01:00
moneroexamples
4d6976fbce undelete epee tests.cpp 2017-01-21 10:00:32 +08:00
Riccardo Spagni
39aaea8e62 Merge pull request #1599
17246d05 wallet: print exception message on get_random_outs_error (moneromooo-monero)
2017-01-20 21:00:01 -05:00
Riccardo Spagni
96a35cd2f4 Merge pull request #1596
7c0c5c17 easylogging++: detect DragonFly BSD as a UNIX (moneromooo-monero)
2017-01-20 20:59:28 -05:00
Riccardo Spagni
3db3a6ee1a Merge pull request #1593
cbcdf8ad Honor depth in get_peerlist_head method (Miguel Herranz)
2017-01-20 20:59:09 -05:00
Riccardo Spagni
4bcd284c76 Merge pull request #1592
78d560a9 simplewallet: use MAKE_CORE_RPC_VERSION(1,4) instead of 0x10004 (kenshi84)
2017-01-20 20:58:55 -05:00
Riccardo Spagni
d5fbba45e8 Merge pull request #1589
87c658f8 wallet2_api: add API to set log categories (moneromooo-monero)
2017-01-20 20:58:39 -05:00
Riccardo Spagni
8698dd36f2 Merge pull request #1587
843769f8 Tweak some msg loglevels (Howard Chu)
2017-01-20 20:56:47 -05:00
Riccardo Spagni
6608531271 Merge pull request #1586
5e61687f mlog: allow overriding log format (moneromooo-monero)
5161f16f easylogging++: enforce recursive mutex (moneromooo-monero)
2017-01-20 20:55:35 -05:00
Riccardo Spagni
d10425025a Merge pull request #1572
0e0e6c5f Reduce to one connection per IP (Miguel Herranz)
3f269e98 Limit incoming connections from the same IP (Miguel Herranz)
2017-01-20 20:54:04 -05:00
moneromooo-monero
17246d051d wallet: print exception message on get_random_outs_error 2017-01-20 18:01:13 +00:00
moneroexamples
0fd2508b89 removing some unsed epee files 2017-01-20 01:05:14 +00:00
moneromooo-monero
7c0c5c1724 easylogging++: detect DragonFly BSD as a UNIX 2017-01-20 00:33:13 +00:00
Miguel Herranz
cbcdf8ad35 Honor depth in get_peerlist_head method
The method returned depth + 2 because:

- push_back was executed before the condition.
- > instead of >= causing one more iteration.
2017-01-18 21:41:52 +01:00
kenshi84
78d560a933 simplewallet: use MAKE_CORE_RPC_VERSION(1,4) instead of 0x10004 2017-01-18 16:11:18 +09:00
moneromooo-monero
87c658f83b wallet2_api: add API to set log categories 2017-01-16 21:14:44 +00:00
Howard Chu
843769f88f Tweak some msg loglevels 2017-01-16 20:42:59 +00:00
moneromooo-monero
5e61687fdf mlog: allow overriding log format
using the MONERO_LOG_FORMAT environment variable.

Default is:
%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg

Field list in easylogging++ documentation.

Don't forget to escape as needed.
2017-01-16 19:43:00 +00:00
moneromooo-monero
5161f16f4a easylogging++: enforce recursive mutex
This fixes a hang when logging something which causes some other
logging code to be called
2017-01-16 19:41:17 +00:00
Miguel Herranz
0e0e6c5f39 Reduce to one connection per IP 2017-01-16 18:16:32 +01:00
Riccardo Spagni
71ac698b78 Merge pull request #1585
a480bf6b fixups in logging init calls, and add missing net context in a log (moneromooo-monero)
2017-01-16 08:41:33 -05:00
Riccardo Spagni
deb6728bc3 Merge pull request #1584
990e08f0 Fix PR#1506, off by one in chain height (Howard Chu)
2017-01-16 08:41:15 -05:00
Riccardo Spagni
4b6be1529e Merge pull request #1583
e389bd9e Makefile: remove mistakenly added local custom target (moneromooo-monero)
2017-01-16 08:40:18 -05:00
Riccardo Spagni
f22dbef28b Merge pull request #1536
693c1908 wallet: add a node RPC cache layer for simple RPC calls (moneromooo-monero)
d86ae2be wallet2: reuse fake outs when adjusting fee on transfer (moneromooo-monero)
64da0983 core: don't try to deserialize an empty extra to remove a field (moneromooo-monero)
2017-01-16 08:35:42 -05:00
moneromooo-monero
a480bf6b14 fixups in logging init calls, and add missing net context in a log 2017-01-16 10:45:59 +00:00
Howard Chu
990e08f090 Fix PR#1506, off by one in chain height 2017-01-16 10:00:06 +00:00
moneromooo-monero
693c190881 wallet: add a node RPC cache layer for simple RPC calls
Mostly getinfo and get_hard_fork_info, which are called
pretty often. This speeds up transfers as a bonus.
2017-01-16 08:59:15 +00:00
moneromooo-monero
d86ae2bec6 wallet2: reuse fake outs when adjusting fee on transfer
This avoids indirectly leaking the real output to the daemon,
and is faster.

This will still happen for more complex cases, especially
when cancelling a tx and "re-rolling" it.
2017-01-16 08:59:08 +00:00
moneromooo-monero
64da0983d5 core: don't try to deserialize an empty extra to remove a field 2017-01-16 08:59:02 +00:00
moneromooo-monero
e389bd9e60 Makefile: remove mistakenly added local custom target 2017-01-16 08:49:28 +00:00
Riccardo Spagni
ab69d5b367 Merge pull request #1569
16b8b66a specify restore height by YYYY-MM-DD format (kenshi84)
2017-01-15 20:32:57 -05:00
Riccardo Spagni
ac7df193ca Merge pull request #1522
5833d66f Change logging to easylogging++ (moneromooo-monero)
dc98019b easylogging++: fix logging with static const header only data members (moneromooo-monero)
3b46617b easylogging++: add ELPP_DISABLE_CHECK_MACROS (moneromooo-monero)
6fe39d90 easylogging++: allow clipping a common filename prefix (moneromooo-monero)
43abf6ff easylogging++: add file-only logs (moneromooo-monero)
c313bea4 eayslogging++: Fix bad memory access before opening any files (moneromooo-monero)
0af5d168 easylogging++: avoid creating directory/filename for the builtin default log file (moneromooo-monero)
28362847 easylogging++: allow setting thread names (moneromooo-monero)
ec71ce8d easylogging++: Print thread ID in a nicer way (moneromooo-monero)
2a0bf783 easylogging++: Add logging categories (moneromooo-monero)
c50bbbfe easylogging++: import upstream (moneromooo-monero)
2017-01-15 20:31:16 -05:00
kenshi84
16b8b66adc specify restore height by YYYY-MM-DD format 2017-01-16 10:00:28 +09:00
moneromooo-monero
5833d66f65 Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
moneromooo-monero
dc98019b59 easylogging++: fix logging with static const header only data members 2017-01-16 00:18:21 +00:00
moneromooo-monero
3b46617bd9 easylogging++: add ELPP_DISABLE_CHECK_MACROS 2017-01-16 00:18:17 +00:00
moneromooo-monero
6fe39d9017 easylogging++: allow clipping a common filename prefix 2017-01-16 00:18:12 +00:00
moneromooo-monero
43abf6ff45 easylogging++: add file-only logs 2017-01-16 00:18:07 +00:00
moneromooo-monero
c313bea450 eayslogging++: Fix bad memory access before opening any files 2017-01-16 00:18:02 +00:00
moneromooo-monero
0af5d16872 easylogging++: avoid creating directory/filename for the builtin default log file 2017-01-16 00:17:59 +00:00
moneromooo-monero
2836284798 easylogging++: allow setting thread names 2017-01-16 00:17:55 +00:00
moneromooo-monero
ec71ce8d2d easylogging++: Print thread ID in a nicer way 2017-01-16 00:17:51 +00:00
moneromooo-monero
2a0bf7834c easylogging++: Add logging categories 2017-01-16 00:17:47 +00:00
moneromooo-monero
c50bbbfedd easylogging++: import upstream 2017-01-16 00:17:40 +00:00
Riccardo Spagni
e459d8604d Merge pull request #1578
ce866d1c macro to define core RPC version for avoiding future mistake (kenshi84)
2017-01-15 19:13:45 -05:00
Riccardo Spagni
422a36ca2a Merge pull request #1581
6da9335a blockchain_import: fix build after tx_pool::add_tx changes (moneromooo-monero)
2017-01-15 19:13:28 -05:00
Riccardo Spagni
ec323d8c3f Merge pull request #1561
d561f4ad enable clang checks that were disabled (Chris Vickio)
0aefb2f6 remove std::move from return statements (pessimizing-move warning) (Chris Vickio)
629d5b76 change counter from bool to int (deprecated-increment-bool warning) (Chris Vickio)
fb76d439 add extra braces around subobjects (missing-braces warning) (Chris Vickio)
3b6d5f25 make struct/class declarations consistent (mismatched-tags warning) (Chris Vickio)
fcf66925 remove unused fields from network_throttle (unused-private-field warning) (Chris Vickio)
296f8c16 inline unused function (for unused-function warning) (Chris Vickio)
2017-01-15 19:01:08 -05:00
kenshi84
ce866d1cc6 macro to define core RPC version for avoiding future mistake 2017-01-16 07:55:43 +09:00
moneromooo-monero
6da9335a9e blockchain_import: fix build after tx_pool::add_tx changes 2017-01-15 21:52:56 +00:00
Riccardo Spagni
b2e1568335 Merge pull request #1579
f5f4109f mnemonics: fix language detection with checksum word (moneromooo-monero)
2017-01-15 14:58:09 -05:00
Riccardo Spagni
99ffc49740 Merge pull request #1577
feb499aa core: check block version for alt chains too (moneromooo-monero)
2017-01-15 14:57:30 -05:00
Riccardo Spagni
1207d8ad0d Merge pull request #1576
ba3968f6 rct: split rct checks between semantics and other (moneromooo-monero)
2017-01-15 14:56:39 -05:00
Riccardo Spagni
c5be70eab4 Merge pull request #1575
b3ca0c62 unit_tests: fix portable serialization tests hardcoded data path (moneromooo-monero)
2017-01-15 14:56:10 -05:00
Riccardo Spagni
9cda94d0aa Merge pull request #1574
d276a165 wallet2: use at least two rct inputs if possible (moneromooo-monero)
2017-01-15 14:55:40 -05:00
Riccardo Spagni
f00797a1f2 Merge pull request #1573
dea53962 fix timeout in check_connection (Jaquee)
2017-01-15 14:55:12 -05:00
Riccardo Spagni
10c6afd316 Merge pull request #1571
81c384e4 fix do_not_relay not preventing relaying on a timer (moneromooo-monero)
2017-01-15 14:50:10 -05:00
Riccardo Spagni
91083a43be Merge pull request #1568
5b5017e2 rpc: add a command to get info about the current blockchain (moneromooo-monero)
2017-01-15 14:48:09 -05:00
Riccardo Spagni
31de98793f Merge pull request #1567
c9f13c5e wallet2: fix tx reroll not updating fee is going up a kB step (moneromooo-monero)
2017-01-15 14:47:44 -05:00
Riccardo Spagni
51baab2112 Merge pull request #1565
50b230d1 core: ensure block size limit is set from the start (moneromooo-monero)
2017-01-15 14:47:17 -05:00
Riccardo Spagni
865f5bef34 Merge pull request #1564
1d317981 Wallet API: add key image import/export functions (Jaquee)
2017-01-15 14:46:52 -05:00
Riccardo Spagni
8bd2c2e551 Merge pull request #1563
36ba311c Prioritize older transactions in the mempool (Miguel Herranz)
2017-01-15 14:46:33 -05:00
Riccardo Spagni
935f50471c Merge pull request #1560
46550c0b Wallet API: add rescanSpent() (Jaquee)
2017-01-15 14:44:49 -05:00
Riccardo Spagni
c23bd75df6 Merge pull request #1552
4a017674 Wallet API: support integrated addresses in address book. (Jaquee)
2017-01-15 14:44:28 -05:00
Riccardo Spagni
65e33b1bc5 Merge pull request #1506
3ff54bdd Check for correct thread before ending batch transaction (Howard Chu)
eaf8470b Must wait for previous batch to finish before starting new one (Howard Chu)
c903c554 Don't cache block height, always get from DB (Howard Chu)
eb1fb601 Tweak default db-sync-mode to fast:async:1 (Howard Chu)
0693cff9 Use batch transactions when syncing (Howard Chu)
2017-01-15 14:43:12 -05:00
Chris Vickio
d561f4ad92 enable clang checks that were disabled 2017-01-15 19:23:33 +03:00
Chris Vickio
0aefb2f60a remove std::move from return statements (pessimizing-move warning) 2017-01-15 19:23:33 +03:00
Chris Vickio
629d5b7689 change counter from bool to int (deprecated-increment-bool warning) 2017-01-15 19:23:33 +03:00
Howard Chu
3ff54bdd7a Check for correct thread before ending batch transaction 2017-01-15 15:51:57 +00:00
moneromooo-monero
f5f4109f9a mnemonics: fix language detection with checksum word
If a checksum word is present, language detection would use
just the word prefixes. However, a set of word prefixes may
be found in more than one language, and so the wrong language
may be found first, which could then fail the checksum, since
the check may be done with a different unique prefix length
from the one it was created from.

We now make a checksum test when we we detect a language from
prefixes only, to make sure we have the correct one.
2017-01-15 11:16:25 +00:00
Miguel Herranz
3f269e988c Limit incoming connections from the same IP 2017-01-15 12:11:27 +01:00
Howard Chu
eaf8470b29 Must wait for previous batch to finish before starting new one 2017-01-14 22:43:06 +00:00
Howard Chu
c903c5541e Don't cache block height, always get from DB 2017-01-14 22:43:06 +00:00
Howard Chu
eb1fb6011a Tweak default db-sync-mode to fast:async:1
fsync the DB asynchronously, to allow block download/verification
to proceed while syncing. Sync after every batch. Note that
"fastest" still defaults to fastest:async:1000.
2017-01-14 22:43:06 +00:00
Howard Chu
0693cff925 Use batch transactions when syncing
Faster throughput while avoiding corruption. I.e., makes
running with --db-sync-mode safe more tolerable.
2017-01-14 22:43:06 +00:00
moneromooo-monero
feb499aaae core: check block version for alt chains too
This is incompatible with block version voting
2017-01-14 22:41:14 +00:00
moneromooo-monero
d276a16526 wallet2: use at least two rct inputs if possible
If we'd make a rct tx with just one input, we try to add
a second one to match the 2/2 ideal. This means more txes
use that template (and are thus using a larger anonymity
set), and it coalesces outputs "for free". We use the
smallest amount outputs in priority for this, so we can
"clean" the wallet at the same time.
2017-01-14 21:43:01 +00:00
moneromooo-monero
b3ca0c627a unit_tests: fix portable serialization tests hardcoded data path 2017-01-14 21:19:33 +00:00
moneromooo-monero
ba3968f6ce rct: split rct checks between semantics and other
Semantics can be checked early
2017-01-14 21:17:32 +00:00
Riccardo Spagni
d98db4868d Merge pull request #1566
176b70a0 account: fix build error involving std::max and different types (moneromooo-monero)
2017-01-14 09:26:59 -05:00
Jaquee
dea53962a3 fix timeout in check_connection 2017-01-14 14:45:30 +01:00
moneromooo-monero
81c384e408 fix do_not_relay not preventing relaying on a timer
Also print its value when printing pool
2017-01-14 13:07:05 +00:00
Chris Vickio
fb76d43980 add extra braces around subobjects (missing-braces warning) 2017-01-14 15:06:07 +03:00
Chris Vickio
3b6d5f255d make struct/class declarations consistent (mismatched-tags warning) 2017-01-14 15:06:07 +03:00
Chris Vickio
fcf66925c1 remove unused fields from network_throttle (unused-private-field warning) 2017-01-14 15:06:07 +03:00
Chris Vickio
296f8c160f inline unused function (for unused-function warning) 2017-01-14 13:37:14 +03:00
moneromooo-monero
5b5017e267 rpc: add a command to get info about the current blockchain
About the tip of the main chain, and the last N blocks
2017-01-13 23:21:38 +00:00
moneromooo-monero
c9f13c5e54 wallet2: fix tx reroll not updating fee is going up a kB step 2017-01-13 22:28:19 +00:00
moneromooo-monero
176b70a0d4 account: fix build error involving std::max and different types 2017-01-13 22:12:27 +00:00
Jaquee
1d3179816b Wallet API: add key image import/export functions 2017-01-13 23:02:20 +01:00
Jaquee
4a0176740d Wallet API: support integrated addresses in address book. 2017-01-13 22:41:17 +01:00
moneromooo-monero
50b230d12c core: ensure block size limit is set from the start
It can now be queried by RPC, so it needs to be set before
it is otherwise needed for consensus, even if no blocks had
to be added (ie, exit and restart quickly).
2017-01-13 21:06:14 +00:00
Jaquee
46550c0b4f Wallet API: add rescanSpent() 2017-01-13 22:05:39 +01:00
Riccardo Spagni
2806842200 Merge pull request #1562
a081b39c Move key image export/import functions to wallet2 (Jaquee)
2017-01-13 14:38:29 -05:00
Riccardo Spagni
2a2f02e375 Merge pull request #1559
db56a03f Wallet2 + API: Callbacks for unconfirmed transfers (Jaquee)
2017-01-13 14:37:12 -05:00
Riccardo Spagni
cbb39b499b Merge pull request #1558
7961878e initialize timestamp to 0 and check for mktime() error (Chris Vickio)
2017-01-13 14:36:42 -05:00
Riccardo Spagni
e75fd059dd Merge pull request #1555
758c0eb7 fix time stats mixin (luigi1111)
2017-01-13 14:36:24 -05:00
Riccardo Spagni
56c44b78b4 Merge pull request #1548
e68ea86c Change logic of testing for libunwind on OSX and ARM (NanoAkron)
2017-01-13 14:35:52 -05:00
Riccardo Spagni
433adee594 Merge pull request #1545
5ae00f0f add msg for donate (luigi1111)
2017-01-13 14:35:34 -05:00
Riccardo Spagni
0b6031adbf Merge pull request #1543
19be7225 Add start_time to get_info methods and show uptime (Miguel Herranz)
2017-01-13 14:35:21 -05:00
Riccardo Spagni
faa33fc326 Merge pull request #1541
0d3918e1 Wallet api: Update trustedDaemon when daemon is changed (Jaquee)
dbb838f4 GUI cold signing (Jaquee)
afb85a02 Wallet API: functions for supporting/creating view only wallets (Jaquee)
2017-01-13 14:34:55 -05:00
Riccardo Spagni
e51afeb90f Merge pull request #1540
79b4e1f9 Cold signing: make sure short payment id isnt encrypted twice (Jaquee)
2017-01-13 14:34:26 -05:00
Riccardo Spagni
006bb0e957 Merge pull request #1538
aff28178 Remove db-auto-remove-logs (Miguel Herranz)
1229c685 Remove berkeley from db_type initialization (Miguel Herranz)
e3090558 Show available types for db-type command (Miguel Herranz)
046ab33d Remove berkeley from blockchain_db_types (Miguel Herranz)
2017-01-13 14:33:59 -05:00
Riccardo Spagni
36b84ded95 Merge pull request #1526
5eed5b05 Wallet API: functions for supporting/creating view only wallets (Jaquee)
2017-01-13 14:32:26 -05:00
Riccardo Spagni
aeeb24991a Merge pull request #1523
d81cb087 Added (not yet enabled) HTTP client authentication (Lee Clagett)
2017-01-13 14:32:08 -05:00
Riccardo Spagni
71c7577370 Merge pull request #1513
a813ab50 wallet2_api: add solo mining API (moneromooo-monero)
2017-01-13 13:24:45 -05:00
Riccardo Spagni
5738e07fba Merge pull request #1492
f1dde1a4 wallet cli: print originating block heights of mixin keys when making transfer (kenshi84)
2017-01-13 13:22:13 -05:00
Miguel Herranz
36ba311cf4 Prioritize older transactions in the mempool
The transactions are first prioritized by fee and in case the fees are
equal by receive_time.
2017-01-13 16:08:37 +01:00
Jaquee
a081b39c01 Move key image export/import functions to wallet2 2017-01-13 12:49:10 +01:00
Jaquee
db56a03ff2 Wallet2 + API: Callbacks for unconfirmed transfers 2017-01-12 18:25:34 +01:00
Chris Vickio
7961878e81 initialize timestamp to 0 and check for mktime() error 2017-01-12 10:13:58 +03:00
Miguel Herranz
19be7225cc Add start_time to get_info methods and show uptime 2017-01-12 00:15:21 +01:00
Lee Clagett
d81cb08704 Added (not yet enabled) HTTP client authentication 2017-01-11 03:21:17 -05:00
Jaquee
0d3918e15b Wallet api: Update trustedDaemon when daemon is changed 2017-01-10 22:49:30 +01:00
Jaquee
dbb838f4d0 GUI cold signing
fix conflict
2017-01-10 22:49:17 +01:00
Jaquee
afb85a028f Wallet API: functions for supporting/creating view only wallets 2017-01-10 22:49:11 +01:00
Jaquee
5eed5b056b Wallet API: functions for supporting/creating view only wallets 2017-01-10 22:34:46 +01:00
luigi1111
758c0eb79f fix time stats mixin
also add blobsize
2017-01-10 10:15:15 -06:00
Riccardo Spagni
4026e7b7de Merge pull request #1544
db44a909 Fix monero-wallet-cli compile (luigi1111)
2017-01-10 08:23:31 -05:00
Miguel Herranz
aff28178e6 Remove db-auto-remove-logs 2017-01-10 11:49:45 +01:00
Miguel Herranz
1229c68587 Remove berkeley from db_type initialization 2017-01-10 11:46:12 +01:00
Miguel Herranz
e309055819 Show available types for db-type command 2017-01-10 11:44:01 +01:00
Miguel Herranz
046ab33d1b Remove berkeley from blockchain_db_types 2017-01-10 11:17:48 +01:00
NanoAkron
e68ea86cc4 Change logic of testing for libunwind on OSX and ARM 2017-01-09 16:39:44 +00:00
moneromooo-monero
a813ab50fe wallet2_api: add solo mining API 2017-01-09 10:12:55 +00:00
kenshi84
f1dde1a429 wallet cli: print originating block heights of mixin keys when making transfer 2017-01-09 15:10:34 +09:00
luigi1111
5ae00f0ff5 add msg for donate
#1498
2017-01-08 21:05:00 -06:00
luigi1111
db44a909ba Fix monero-wallet-cli compile
Not 100$ sure this is the right fix, nor whether address book entries from URL should be stored as addresses or URLs (or both with a check for change on payment).
2017-01-08 20:26:57 -06:00
Riccardo Spagni
c6ec939626 Merge pull request #1542
60fe1b61 Add parse_uri to wallet2_api (MoroccanMalinois)
2017-01-08 16:47:42 -08:00
Riccardo Spagni
59021496d8 Merge pull request #1537
c2135082 simplewallet: add a show_transfer <txid> command (moneromooo-monero)
19c4041d wallet_rpc_server: new RPC call to get a transfer by txid (moneromooo-monero)
2017-01-08 16:44:29 -08:00
Riccardo Spagni
15dcc5afd3 Merge pull request #1534
1607cb7e tx_pool: better block template filling algorithm (moneromooo-monero)
9731b4e5 rpc: add block size to GET_BLOCK_HEADER RPC (moneromooo-monero)
9188b346 rpc: add current block size to the getinfo call (moneromooo-monero)
2017-01-08 16:43:54 -08:00
Riccardo Spagni
278562d2c2 Merge pull request #1531
9d1d3a45 portable serializer: use signed char for size (kenshi84)
2017-01-08 16:43:35 -08:00
Riccardo Spagni
6cbfe0f849 Merge pull request #1521
21c5af5a wallet2_api: add an address book payment id lookup API (moneromooo-monero)
2017-01-08 16:42:08 -08:00
Riccardo Spagni
ba9744d400 Merge pull request #1515
ada7c7da portable serializer: tests added (kenshi84)
f390a0e2 portable serializer: make signerd/unsigned tx portable, ignore archive version checking (kenshi84)
2017-01-08 16:41:44 -08:00
Riccardo Spagni
866463f37b Merge pull request #1514
fa0ee42c Workarounds for gcc 4.8 (Lee Clagett)
2017-01-08 16:41:03 -08:00
Riccardo Spagni
2a996f492f Merge pull request #1510
80abc3bc Build wallet with Android NDK (MoroccanMalinois)
2017-01-08 16:40:02 -08:00
Riccardo Spagni
da05900524 Merge pull request #1509
29333c41 wallet api: prevent setting refresh height too high (Jaquee)
2017-01-08 16:39:23 -08:00
Riccardo Spagni
13c5da2aa3 Merge pull request #1508
4585ada4 Wallet2: faster exit while refreshing (Jaquee)
2017-01-08 16:39:07 -08:00
Riccardo Spagni
0ce4618bea Merge pull request #1504
5f4ac6b9 wallet2 bugfix: store watch_only flag properly with rewrite() (kenshi84)
2017-01-08 16:38:19 -08:00
Riccardo Spagni
c284b0fff7 Merge pull request #1503
542571f5 simplewallet: remove unnecessary local_args.erase(...) in set_variable() (kenshi84)
2017-01-08 16:38:01 -08:00
Riccardo Spagni
fdb1cda965 Merge pull request #1502
591d8368 core: invalidate difficulty cache when resetting blockchain (moneromooo-monero)
2017-01-08 16:37:31 -08:00
Riccardo Spagni
06de09daf4 Merge pull request #1501
cebae0c5 wallet2: check the node returned the real output when requested (moneromooo-monero)
2017-01-08 16:37:11 -08:00
Riccardo Spagni
1736b7ef6b Merge pull request #1500
c0a0fcaf wallet2_api: some new APIs to access daemon state (moneromooo-monero)
2017-01-08 16:36:46 -08:00
Riccardo Spagni
d655e88b44 Merge pull request #1499
37ed96e6 tx_pool: fix uninitialized "last failed" fields (moneromooo-monero)
94b6feef rpc: fix mixup in tx_info serialization (moneromooo-monero)
2017-01-08 16:35:49 -08:00
Riccardo Spagni
03497f0268 Merge pull request #1497
50511677 wallet2: fix large reorgs failing (moneromooo-monero)
2017-01-08 16:35:14 -08:00
Riccardo Spagni
209a633a3c Merge pull request #1496
adee1644 wallet cli: print unspent outputs with histogram (kenshi84)
2017-01-08 16:34:51 -08:00
Riccardo Spagni
3082e71b5a Merge pull request #1495
f3fdefe0 Fix multiple definition clash on ARMv7 build (Howard Chu)
2017-01-08 16:34:23 -08:00
Riccardo Spagni
c594e578a9 Merge pull request #1494
0020ad7d cmake: link against liblzma when found, for libunwind (moneromooo-monero)
2017-01-08 16:34:08 -08:00
Riccardo Spagni
23cf963332 Merge pull request #1493
0478ac68 blockchain: allow marking "tx not found" without an exception (moneromooo-monero)
2017-01-08 16:33:41 -08:00
Riccardo Spagni
223055a861 Merge pull request #1491
52db01ea Silence CMake policy warning on macos. See: https://cmake.org/cmake/help/v3.0/policy/CMP0042.html (Randi Joseph)
2017-01-08 16:32:30 -08:00
Riccardo Spagni
fc0a2b837b Merge pull request #1490
474c249c cleaner log calc algorithm (fireice-uk)
2017-01-08 16:32:21 -08:00
Riccardo Spagni
f4b3989c61 Merge pull request #1482
38f00d07 wallet cli: viewing and editing address book (kenshi84)
2017-01-08 16:31:55 -08:00
Riccardo Spagni
ff1bb6bc68 Merge pull request #1460
99580adf make openalias also available for solo miner; introduce namespace tools::dns_utils; support integrated address with dns lookup (kenshi84)
2017-01-08 16:31:42 -08:00
MoroccanMalinois
60fe1b61e0 Add parse_uri to wallet2_api 2017-01-08 22:53:24 +00:00
Jaquee
79b4e1f997 Cold signing: make sure short payment id isnt encrypted twice 2017-01-08 21:04:53 +01:00
moneromooo-monero
c21350823f simplewallet: add a show_transfer <txid> command 2017-01-08 13:57:24 +00:00
moneromooo-monero
19c4041df5 wallet_rpc_server: new RPC call to get a transfer by txid 2017-01-08 13:16:22 +00:00
moneromooo-monero
0478ac6848 blockchain: allow marking "tx not found" without an exception
This is a normal occurence in many cases, and there is no need
to spam the log with those when it is.
2017-01-07 20:52:17 +00:00
moneromooo-monero
1607cb7e0c tx_pool: better block template filling algorithm
Continue filling until we reach the block size limit, or the
resulting coinbase decreases.

Also remove old sanity check on block size, which is now not
wanted anymore.
2017-01-07 12:36:22 +00:00
kenshi84
9d1d3a454e portable serializer: use signed char for size 2017-01-07 11:59:16 +09:00
moneromooo-monero
9731b4e54f rpc: add block size to GET_BLOCK_HEADER RPC
and print it in print_bc
2017-01-06 19:38:27 +00:00
moneromooo-monero
9188b3468c rpc: add current block size to the getinfo call 2017-01-06 19:30:10 +00:00
MoroccanMalinois
80abc3bc4a Build wallet with Android NDK 2017-01-05 01:11:05 +00:00
kenshi84
ada7c7da8f portable serializer: tests added 2017-01-03 09:14:48 +09:00
kenshi84
f390a0e2dc portable serializer: make signerd/unsigned tx portable, ignore archive version checking 2017-01-02 20:04:58 +09:00
moneromooo-monero
21c5af5a8a wallet2_api: add an address book payment id lookup API 2017-01-01 16:06:34 +00:00
Lee Clagett
fa0ee42cc9 Workarounds for gcc 4.8 2016-12-30 02:14:06 -05:00
Jaquee
29333c417e wallet api: prevent setting refresh height too high 2016-12-27 19:38:05 +01:00
Jaquee
4585ada453 Wallet2: faster exit while refreshing 2016-12-27 19:12:18 +01:00
moneromooo-monero
cebae0c510 wallet2: check the node returned the real output when requested 2016-12-27 09:38:10 +00:00
kenshi84
5f4ac6b909 wallet2 bugfix: store watch_only flag properly with rewrite() 2016-12-26 18:33:24 +09:00
kenshi84
adee16440a wallet cli: print unspent outputs with histogram 2016-12-26 16:03:16 +09:00
kenshi84
542571f5cb simplewallet: remove unnecessary local_args.erase(...) in set_variable() 2016-12-26 08:50:37 +09:00
moneromooo-monero
591d83686e core: invalidate difficulty cache when resetting blockchain 2016-12-25 20:38:11 +00:00
moneromooo-monero
c0a0fcaff0 wallet2_api: some new APIs to access daemon state 2016-12-25 12:31:50 +00:00
moneromooo-monero
37ed96e611 tx_pool: fix uninitialized "last failed" fields 2016-12-24 19:42:35 +00:00
moneromooo-monero
94b6feef24 rpc: fix mixup in tx_info serialization 2016-12-24 18:08:48 +00:00
moneromooo-monero
505116771e wallet2: fix large reorgs failing
If a reorg was large enough that a full 1000 block chunk
from the daemon was all known blocks, refresh would stop,
and no reorg would happen.
2016-12-24 16:04:37 +00:00
moneromooo-monero
0020ad7d99 cmake: link against liblzma when found, for libunwind
Some versions of libunwind need liblzma. If liblzma is found,
we link against it unconditionally. If the installed libunwind
didn't need it, this is a nop.

Tested and fine tuned by iDunk
2016-12-24 00:00:45 +00:00
Howard Chu
f3fdefe001 Fix multiple definition clash on ARMv7 build
Broken by d1d6e27ab6
2016-12-23 18:05:11 +00:00
Randi Joseph
52db01ea6d Silence CMake policy warning on macos.
See: https://cmake.org/cmake/help/v3.0/policy/CMP0042.html
2016-12-23 02:54:34 -05:00
fireice-uk
474c249c90 cleaner log calc algorithm 2016-12-22 20:29:41 +00:00
Riccardo Spagni
dd580d7bc7 Merge pull request #1487
37476265 add tx hash to time stats (luigi1111)
2016-12-22 10:59:02 +02:00
luigi1111
374762654e add tx hash to time stats
Also miner tx hash to log level 1 (have you ever tried to find a testnet miner tx hash?)
2016-12-21 19:20:49 -06:00
Riccardo Spagni
a5d0af95b5 Merge pull request #1486
522ab79e Fixed HTTP auth tests for gcc 4.9 (Lee Clagett)
2016-12-21 21:51:46 +02:00
Riccardo Spagni
6f539159e8 Merge pull request #1484
12abe86a core: fix recalculation of emission/fees (moneromooo-monero)
2016-12-21 20:43:31 +02:00
Lee Clagett
522ab79e9c Fixed HTTP auth tests for gcc 4.9 2016-12-21 13:23:15 -05:00
kenshi84
99580adf66 make openalias also available for solo miner; introduce namespace tools::dns_utils; support integrated address with dns lookup 2016-12-21 23:12:15 +09:00
moneromooo-monero
12abe86ac0 core: fix recalculation of emission/fees
It was counting things many, many times
2016-12-21 11:19:04 +00:00
kenshi84
38f00d07f7 wallet cli: viewing and editing address book 2016-12-21 19:27:18 +09:00
Riccardo Spagni
049b7e9a93 Merge pull request #1483
af9a7999 account for API difference between 1.58 & 1.59 (kenshi84)
2016-12-21 10:35:13 +02:00
kenshi84
af9a799925 account for API difference between 1.58 & 1.59 2016-12-21 16:05:31 +09:00
Riccardo Spagni
4fe5c351cd Merge pull request #1479
c31e42e2 simplewallet: bump output file format version (moneromooo-monero)
2016-12-20 23:01:39 +02:00
Riccardo Spagni
04bdce54b7 Merge pull request #1478
1976eddd common: add missing #include <system_error> for std::error_code (moneromooo-monero)
2016-12-20 23:01:12 +02:00
Riccardo Spagni
5a66365cdd Merge pull request #1477
d55e2266 Fixed uninitialized valgrind errors in serialization tests (Lee Clagett)
2016-12-20 23:00:54 +02:00
moneromooo-monero
c31e42e2bb simplewallet: bump output file format version
The serialization format changed, and while there is code
to load the older serialization format, an older monerod
will not be able to load a file saved by a new monerod,
even though both share the same version. This is not good,
and we prefer a version bump.
2016-12-20 19:02:51 +00:00
moneromooo-monero
1976eddd89 common: add missing #include <system_error> for std::error_code 2016-12-20 18:53:58 +00:00
Lee Clagett
d55e2266ca Fixed uninitialized valgrind errors in serialization tests 2016-12-20 12:51:27 -05:00
Riccardo Spagni
c7f9d0d971 Merge pull request #1475
81702b54 Fixes for google test < 1.8 (Lee Clagett)
2016-12-20 17:48:25 +02:00
Riccardo Spagni
9777de1890 Merge pull request #1474
fc40b3e7 Lower connection timeout in check_connection() (Jaquee)
2016-12-20 17:47:58 +02:00
Riccardo Spagni
e170cbe013 Merge pull request #1473
e3639f5c Removed unused functions (Lee Clagett)
2016-12-20 17:47:16 +02:00
Riccardo Spagni
6847999fb8 Merge pull request #1472
2bddb8eb Refactored password prompting for wallets (Lee Clagett)
2016-12-20 17:46:58 +02:00
Riccardo Spagni
dca146f823 Merge pull request #1469
9e4b3724 simplewallet: add pending/pool/failed in the show_transfers help (moneromooo-monero)
2016-12-20 17:45:47 +02:00
Riccardo Spagni
233ba51ad9 Merge pull request #1468
9a2cd722 wallet2_api: add an API to the OpenAlias resolver (moneromooo-monero)
2016-12-20 17:45:13 +02:00
Riccardo Spagni
f5176cb6e8 Merge pull request #1467
55fa0479 rpc: new function and RPC to get alternative chain info (moneromooo-monero)
2016-12-20 17:44:47 +02:00
Riccardo Spagni
1551ce98f2 Merge pull request #1466
c367d7df README: add note about the donate command (anonimal)
b9a28677 simplewallet: add return type for donate function (anonimal)
d36669fd simplewallet: hardcode Monero's donation address (anonimal)
2016-12-20 17:43:38 +02:00
Riccardo Spagni
b9b9028e50 Merge pull request #1462
07b9138c support importing unportable outputs (kenshi84)
2ac80075 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp (kenshi84)
d1d6e27a moved boost cpp into hpp since they're supposed to be header only (kenshi84)
66e6af89 added experimental boost::archive::portable_binary_{i|o}archive (kenshi84)
2016-12-20 17:40:11 +02:00
kenshi84
07b9138cad support importing unportable outputs 2016-12-20 13:26:39 +09:00
kenshi84
2ac8007544 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp 2016-12-20 13:04:19 +09:00
kenshi84
d1d6e27ab6 moved boost cpp into hpp since they're supposed to be header only 2016-12-20 12:27:23 +09:00
Lee Clagett
81702b5451 Fixes for google test < 1.8 2016-12-19 20:48:11 -05:00
Lee Clagett
2bddb8ebee Refactored password prompting for wallets 2016-12-19 20:00:43 -05:00
Jaquee
fc40b3e732 Lower connection timeout in check_connection() 2016-12-19 21:19:02 +01:00
Riccardo Spagni
5fcf7c1c18 Merge pull request #1464
427054c3 Enabled HTTP auth support for monero-wallet-rpc (Lee Clagett)
2016-12-19 22:16:22 +02:00
Lee Clagett
e3639f5cc3 Removed unused functions 2016-12-19 14:47:26 -05:00
moneromooo-monero
9e4b3724c7 simplewallet: add pending/pool/failed in the show_transfers help
reported by nioc
2016-12-17 19:51:09 +00:00
moneromooo-monero
9a2cd72257 wallet2_api: add an API to the OpenAlias resolver 2016-12-17 13:05:17 +00:00
moneromooo-monero
55fa0479a0 rpc: new function and RPC to get alternative chain info 2016-12-17 11:28:49 +00:00
Lee Clagett
427054c3d5 Enabled HTTP auth support for monero-wallet-rpc 2016-12-16 23:59:46 -05:00
anonimal
c367d7df31 README: add note about the donate command
References #1447
2016-12-17 03:49:52 +00:00
anonimal
b9a28677e2 simplewallet: add return type for donate function
Resolves -Wreturn-type

References #1447 #1451
2016-12-17 03:37:20 +00:00
anonimal
d36669fd75 simplewallet: hardcode Monero's donation address
Closes #1447
References #1451
2016-12-17 02:52:09 +00:00
kenshi84
66e6af89ce added experimental boost::archive::portable_binary_{i|o}archive 2016-12-16 23:46:24 +09:00
Riccardo Spagni
29735c8f8f Merge pull request #1459
b00da61e Preliminary support for DragonFly BSD (Antonio Huete Jimenez)
2016-12-15 14:36:35 +02:00
Riccardo Spagni
527aa3e604 Merge pull request #1458
f7e551d0 Dockerfile : use libssl1.0 (MoroccanMalinois)
2016-12-15 14:36:11 +02:00
Riccardo Spagni
73e50749e2 Merge pull request #1455
4bb0bff2 AddressBook: use unsigned type for row ID's (anonimal)
2016-12-15 14:35:47 +02:00
Riccardo Spagni
c6f26ecae2 Merge pull request #1449
374b58d1 fix MGs json (moneroexamples)
2016-12-15 14:29:40 +02:00
Riccardo Spagni
1e8920c225 Merge pull request #1454
515a2d9f Update info on libzlma and BerkeleyDB in README.md (NanoAkron)
2016-12-15 14:29:18 +02:00
Riccardo Spagni
18c36561f6 Merge pull request #1453
1a2284de Spelling error (Bitcoin Error Log)
2016-12-15 14:28:40 +02:00
Riccardo Spagni
00898fe750 Merge pull request #1452
944b6079 Wallet API: Do not refresh while daemon is syncing + fixed fast refresh when creating wallet offline + improved close wallet logic (make sure refresh thread is stopped) (Jaquee)
2016-12-15 14:28:15 +02:00
Riccardo Spagni
5f5cfdfa77 Merge pull request #1451
2506d51d wallet cli: donate command (Kenshi Takayama)
2016-12-15 14:27:02 +02:00
Riccardo Spagni
aa47ea41a7 Merge pull request #1444
bdc3d749 Adding HTTP Digest Auth (but not yet enabled) (Lee Clagett)
2016-12-15 14:25:49 +02:00
Jaquee
944b6079d9 Wallet API: Do not refresh while daemon is syncing
+ fixed fast refresh when creating wallet offline
+ improved close wallet logic (make sure refresh thread is stopped)
2016-12-15 12:31:09 +01:00
Antonio Huete Jimenez
b00da61eab Preliminary support for DragonFly BSD
- It builds but no further testing has been done.
2016-12-15 02:27:53 -08:00
Kenshi Takayama
2506d51d60 wallet cli: donate command 2016-12-15 19:01:36 +09:00
MoroccanMalinois
f7e551d0b8 Dockerfile : use libssl1.0 2016-12-15 05:50:03 +01:00
anonimal
4bb0bff233 AddressBook: use unsigned type for row ID's
Fixes build warnings and may also prevent future headaches.
2016-12-14 21:37:49 +00:00
NanoAkron
515a2d9fe8 Update info on libzlma and BerkeleyDB in README.md 2016-12-14 21:15:08 +00:00
Bitcoin Error Log
1a2284dea0 Spelling error
"compatibility" spelled incorrectly
2016-12-14 12:27:17 -05:00
moneroexamples
374b58d131 fix MGs json 2016-12-14 09:27:37 +08:00
Lee Clagett
bdc3d7496f Adding HTTP Digest Auth (but not yet enabled) 2016-12-13 00:19:54 -05:00
1185 changed files with 97693 additions and 251564 deletions

2
.gitignore vendored
View File

@@ -61,7 +61,7 @@ CMakeCache.txt
CMakeFiles
cmake_install.cmake
install_manifest.txt
*.cmake
cmake-build-debug/
### Linux ###
*~

11
.gitmodules vendored Normal file
View File

@@ -0,0 +1,11 @@
[submodule "external/unbound"]
path = external/unbound
url = https://github.com/monero-project/unbound
branch = monero
[submodule "external/miniupnp"]
path = external/miniupnp
url = https://github.com/monero-project/miniupnp
branch = monero
[submodule "external/rapidjson"]
path = external/rapidjson
url = https://github.com/Tencent/rapidjson

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
#
# All rights reserved.
#
@@ -27,6 +27,17 @@
# 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
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_SOURCE_DIR}/cmake")
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
include(CheckLibraryExists)
include(CheckFunctionExists)
if (IOS)
INCLUDE(CmakeLists_IOS.txt)
endif()
cmake_minimum_required(VERSION 2.8.7)
@@ -45,6 +56,47 @@ function (die msg)
message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}")
endfunction ()
function (add_c_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_c)
check_c_compiler_flag(${flag} ${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})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_linker_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_ld)
string(REPLACE "," "_" supported ${flag}_ld)
check_linker_flag(${flag} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_definition_if_function_found function var)
string(REPLACE "-" "_" supported ${function}_function)
check_function_exists(${function} ${supported})
if(${${supported}})
add_definitions("-D${var}")
endif()
endfunction()
function (add_definition_if_library_exists library function header var)
string(REPLACE "-" "_" supported ${function}_library)
check_library_exists(${library} ${function} ${header} ${supported})
if(${${supported}})
add_definitions("-D${var}")
endif()
endfunction()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
@@ -77,9 +129,14 @@ if (ARM_TEST STREQUAL "arm")
endif()
endif()
if (ARM_ID STREQUAL "aarch64")
if (ARM_ID STREQUAL "aarch64" OR ARM_ID STREQUAL "arm64" OR ARM_ID STREQUAL "armv8-a")
set(ARM 1)
set(ARM8 1)
set(ARCH "armv8-a")
endif()
if(ARCH_ID STREQUAL "ppc64le")
set(PPC64LE 1)
endif()
if(WIN32 OR ARM)
@@ -88,6 +145,14 @@ else()
set(OPT_FLAGS_RELEASE "-Ofast")
endif()
# BUILD_TAG is used to select the build type to check for a new version
if(BUILD_TAG)
message(STATUS "Building build tag ${BUILD_TAG}")
add_definitions("-DBUILD_TAG=${BUILD_TAG}")
else()
message(STATUS "Building without build tag")
endif()
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
@@ -131,6 +196,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
enable_testing()
option(BUILD_DOCUMENTATION "Build the Doxygen documentation." ON)
option(BUILD_TESTS "Build tests." OFF)
# Check whether we're on a 32-bit or 64-bit system
if(CMAKE_SIZEOF_VOID_P EQUAL "8")
@@ -149,12 +215,15 @@ message(STATUS "Building for a ${ARCH_WIDTH}-bit system")
# Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead)
# CMAKE_SYSTEM_NAME checks are commonly known, but specifically taken from libsdl's CMakeLists
if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(FREEBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*|FreeBSD")
set(FREEBSD TRUE)
endif()
# Check if we're on DragonFly BSD. See the README.md for build instructions.
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*")
set(DRAGONFLY TRUE)
endif()
# Check if we're on OpenBSD. See the README.md for build instructions.
if(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(OPENBSD TRUE)
@@ -167,10 +236,13 @@ endif()
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
# set(BSDI TRUE)
include_directories(src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")
include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external)
if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
endif()
if(MSVC OR MINGW)
@@ -187,10 +259,11 @@ endif()
if (BUILD_SHARED_LIBS)
message(STATUS "Building internal libraries with position independent code")
set(PIC_FLAG "-fPIC")
add_definitions("-DBUILD_SHARED_LIBS")
else()
message(STATUS "Building internal libraries as static")
endif()
set(PIC_FLAG "-fPIC")
if(MINGW)
string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}")
@@ -211,10 +284,21 @@ if(STATIC)
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DZMQ_STATIC")
endif()
# default database:
# should be lmdb for testing, memory for production still
if(SANITIZE)
if (MSVC)
message(FATAL_ERROR "Cannot sanitize with MSVC")
else()
message(STATUS "Using ASAN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
endif()
# Set default blockchain storage location:
# memory was the default in Cryptonote before Monero implemented LMDB, it still works but is unnecessary.
# set(DATABASE memory)
set(DATABASE lmdb)
@@ -267,20 +351,34 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
find_package(Libunwind)
# Can't install hook in static build on OSX, because OSX linker does not support --wrap
# On ARM, having libunwind package (with .so's only) installed breaks static link.
if(LIBUNWIND_FOUND AND NOT (STATIC AND (APPLE OR ARM)))
set(DEFAULT_STACK_TRACE ON)
else()
# When possible, avoid stack tracing using libunwind in favor of using easylogging++.
if (APPLE)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
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 AND STATIC)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
else()
find_package(Libunwind)
if(LIBUNWIND_FOUND)
set(DEFAULT_STACK_TRACE ON)
set(STACK_TRACE_LIB "libunwind") # for diag output only
else()
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
endif()
endif()
option(STACK_TRACE "Install a hook that dumps stack on exception" ${DEFAULT_STACK_TRACE})
if(STACK_TRACE)
message(STATUS "Stack trace on exception enabled")
message(STATUS "Stack trace on exception enabled (using ${STACK_TRACE_LIB})")
else()
message(STATUS "Stack trace on exception disabled")
endif()
@@ -291,22 +389,54 @@ if (UNIX AND NOT APPLE)
find_package(Threads)
endif()
add_subdirectory(external)
# Handle OpenSSL, used for sha256sum on binary updates and light wallet ssl http
if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthreads")
endif ()
# Final setup for miniupnpc
if(UPNP_STATIC)
add_definitions("-DUPNP_STATIC")
else()
add_definitions("-DUPNP_DYNAMIC")
include_directories(${UPNP_INCLUDE})
if (APPLE AND NOT IOS)
if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}")
endif()
endif()
find_package(OpenSSL REQUIRED)
message(STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}")
include_directories(${OPENSSL_INCLUDE_DIR})
if(STATIC AND NOT IOS)
if(UNIX)
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS};${CMAKE_THREAD_LIBS_INIT}")
endif()
endif()
find_package(PCSC)
add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S)
add_definition_if_library_exists(c explicit_bzero "strings.h" HAVE_EXPLICIT_BZERO)
add_definition_if_function_found(strptime HAVE_STRPTIME)
add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP)
# Generate header for embedded translations
include(ExternalProject)
ExternalProject_Add(generate_translations_header
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/translations"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/translations"
INSTALL_COMMAND cmake -E echo "")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/translations")
add_subdirectory(external)
# Final setup for libunbound
include_directories(${UNBOUND_INCLUDE})
link_directories(${UNBOUND_LIBRARY_DIRS})
# Final setup for rapidjson
include_directories(external/rapidjson)
# Final setup for easylogging++
include_directories(${EASYLOGGING_INCLUDE})
link_directories(${EASYLOGGING_LIBRARY_DIRS})
# Final setup for liblmdb
include_directories(${LMDB_INCLUDE})
@@ -320,6 +450,16 @@ endif()
include_directories(${LIBUNWIND_INCLUDE})
link_directories(${LIBUNWIND_LIBRARY_DIRS})
# Final setup for libpcsc
if (PCSC_FOUND)
message(STATUS "Using PCSC include dir at ${PCSC_INCLUDE_DIR}")
add_definitions(-DHAVE_PCSC)
include_directories(${PCSC_INCLUDE_DIR})
link_directories(${LIBPCSC_LIBRARY_DIRS})
else (PCSC_FOUND)
message(STATUS "Could not find PCSC")
endif()
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")
@@ -336,6 +476,11 @@ else()
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default")
set(ARCH_FLAG "")
elseif(PPC64LE)
set(ARCH_FLAG "-mcpu=${ARCH}")
elseif(IOS AND ARCH STREQUAL "arm64")
message(STATUS "IOS: Changing arch from arm64 to armv8")
set(ARCH_FLAG "-march=armv8")
else()
set(ARCH_FLAG "-march=${ARCH}")
endif()
@@ -344,12 +489,11 @@ else()
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-deprecated-register -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
if(ARM)
set(WARNINGS "${WARNINGS} -Wno-error=inline-asm")
endif()
else()
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized")
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp")
endif()
if(MINGW)
set(WARNINGS "${WARNINGS} -Wno-error=unused-value -Wno-error=unused-but-set-variable")
@@ -372,6 +516,13 @@ else()
set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert")
endif()
try_compile(STATIC_ASSERT_CPP_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.cpp" COMPILE_DEFINITIONS "-std=c++11")
if(STATIC_ASSERT_CPP_RES)
set(STATIC_ASSERT_CPP_FLAG "")
else()
set(STATIC_ASSERT_CPP_FLAG "-Dstatic_assert=_Static_assert")
endif()
option(COVERAGE "Enable profiling for test coverage report" 0)
if(COVERAGE)
@@ -384,12 +535,64 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
# if those don't work for your compiler, single it out where appropriate
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(C_SECURITY_FLAGS "${C_SECURITY_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
set(CXX_SECURITY_FLAGS "${CXX_SECURITY_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
endif()
# warnings
add_c_flag_if_supported(-Wformat C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-Wformat CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-Wformat-security C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
# -fstack-protector
add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-fstack-protector-strong CXX_SECURITY_FLAGS)
# linker
if (NOT WIN32)
# Windows binaries die on startup with PIE
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
endif()
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED)
if (noexecstack_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecstack")
set(LD_RAW_FLAGS ${LD_RAW_FLAGS} -z noexecstack)
endif()
add_linker_flag_if_supported(-Wl,-z,noexecheap noexecheap_SUPPORTED)
if (noexecheap_SUPPORTED)
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
set(LD_RAW_FLAGS ${LD_RAW_FLAGS} -z noexecheap)
endif()
# some windows linker bits
if (WIN32)
add_linker_flag_if_supported(-Wl,--dynamicbase LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,--nxcompat LD_SECURITY_FLAGS)
endif()
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
option(NO_AES "Explicitly disable AES support" ${NO_AES})
if(NOT NO_AES AND NOT ARM)
if(NO_AES)
message(STATUS "AES support explicitly disabled")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_AES")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_AES")
elseif(NOT ARM AND NOT PPC64LE)
message(STATUS "AES support enabled")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
elseif(PPC64LE)
message(STATUS "AES support not available on ppc64le")
elseif(ARM6)
message(STATUS "AES support not available on ARMv6")
elseif(ARM7)
@@ -406,8 +609,9 @@ else()
message(STATUS "AES support disabled")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
# is fixed in the code (Issue #847), force compiler to be conservative.
@@ -491,6 +695,15 @@ else()
endif(ARM)
if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS)
#From Android 5: "only position independent executables (PIE) are supported"
message(STATUS "Enabling PIE executable")
set(PIC_FLAG "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0")
endif()
@@ -503,7 +716,7 @@ else()
endif()
if(NOT DEFINED USE_LTO_DEFAULT)
set(USE_LTO_DEFAULT true)
set(USE_LTO_DEFAULT false)
endif()
set(USE_LTO ${USE_LTO_DEFAULT} CACHE BOOL "Use Link-Time Optimization (Release mode only)")
@@ -519,7 +732,7 @@ else()
set(RELEASE_FLAGS "${RELEASE_FLAGS} -ffat-lto-objects")
endif()
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD AND NOT DRAGONFLY)
# When invoking cmake on distributions on which gcc's binaries are prefixed
# with an arch-specific triplet, the user must specify -DCHOST=<prefix>
if (DEFINED CHOST)
@@ -544,7 +757,7 @@ else()
# On Windows, this is as close to fully-static as we get:
# this leaves only deps on /c/Windows/system32/*.dll
set(STATIC_FLAGS "-static")
elseif (NOT (APPLE OR FREEBSD OR OPENBSD))
elseif (NOT (APPLE OR FREEBSD OR OPENBSD OR DRAGONFLY))
# On Linux, we don't support fully static build, but these can be static
set(STATIC_FLAGS "-static-libgcc -static-libstdc++")
endif()
@@ -565,20 +778,33 @@ if(STATIC)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
if(NOT Boost_FOUND)
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.58) or the equivalent")
elseif(Boost_FOUND)
message(STATUS "Found Boost Version: ${Boost_VERSION}")
if (Boost_VERSION VERSION_LESS 106200 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
message(FATAL_ERROR "Boost older than 1.62 is too old to link with OpenSSL 1.1 or newer. "
"Update Boost or install OpenSSL 1.0 and set path to it when running cmake: "
"cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0;/usr/lib/openssl-1.0'")
endif()
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi)
elseif(APPLE OR FREEBSD OR OPENBSD)
set(ICU_LIBRARIES ${Boost_LOCALE_LIBRARY} icuio icuin icuuc icudt icutu iconv)
elseif(APPLE OR OPENBSD OR ANDROID)
set(EXTRA_LIBRARIES "")
elseif(FREEBSD)
set(EXTRA_LIBRARIES execinfo)
elseif(DRAGONFLY)
find_library(COMPAT compat)
set(EXTRA_LIBRARIES execinfo ${COMPAT})
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(EXTRA_LIBRARIES socket nsl resolv)
elseif(NOT MSVC)
find_library(RT rt)
set(EXTRA_LIBRARIES ${RT})
@@ -586,33 +812,56 @@ endif()
list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32")
option(USE_READLINE "Build with GNU readline support." ON)
if(USE_READLINE)
find_package(Readline)
if(READLINE_FOUND AND GNU_READLINE_FOUND)
add_definitions(-DHAVE_READLINE)
include_directories(${Readline_INCLUDE_DIR})
message(STATUS "Found readline library at: ${Readline_ROOT_DIR}")
set(EPEE_READLINE epee_readline)
else()
message(STATUS "Could not find GNU readline library so building without readline support")
endif()
endif()
if(ANDROID)
set(ATOMIC libatomic.a)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD)
find_library(ATOMIC atomic)
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
endif()
include(version.cmake)
find_path(ZMQ_INCLUDE_PATH zmq.hpp)
find_library(ZMQ_LIB zmq)
find_library(PGM_LIBRARY pgm)
find_library(NORM_LIBRARY norm)
find_library(SODIUM_LIBRARY sodium)
function (treat_warnings_as_errors dirs)
foreach(dir ${ARGV})
set_property(DIRECTORY ${dir}
APPEND PROPERTY COMPILE_FLAGS "-Werror")
endforeach()
endfunction()
if(NOT ZMQ_INCLUDE_PATH)
message(FATAL_ERROR "Could not find required header zmq.hpp")
endif()
if(NOT ZMQ_LIB)
message(FATAL_ERROR "Could not find required libzmq")
endif()
if(PGM_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}")
endif()
if(NORM_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}")
endif()
if(SODIUM_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}")
endif()
add_subdirectory(contrib)
add_subdirectory(src)
treat_warnings_as_errors(contrib src)
option(BUILD_TESTS "Build tests." OFF)
if(BUILD_TESTS)
add_subdirectory(tests)
endif()
if(BUILD_DOCUMENTATION)
set(DOC_GRAPHS "YES" CACHE STRING "Create dependency graphs (needs graphviz)")
set(DOC_FULLGRAPHS "NO" CACHE STRING "Create call/callee graphs (large)")
@@ -643,3 +892,4 @@ option(BUILD_GUI_DEPS "Build GUI dependencies." OFF)
option(INSTALL_VENDORED_LIBUNBOUND "Install libunbound binary built from source vendored with this repo." OFF)
CHECK_C_COMPILER_FLAG(-std=c11 HAVE_C11)

164
CMakeLists_IOS.txt Normal file
View File

@@ -0,0 +1,164 @@
# Portions Copyright (c) 2017-2018, The Monero Project
# This file is based off of the https://code.google.com/archive/p/ios-cmake/
# It has been altered for Monero iOS development
#
#
# Options:
#
# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
#
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
# Standard settings
set (CMAKE_SYSTEM_NAME Darwin)
set (CMAKE_SYSTEM_VERSION 1)
set (UNIX True)
set (APPLE True)
set (IOS True)
# Required as of cmake 2.8.10
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
# Determine the cmake host system version so we know where to find the iOS SDKs
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
if (CMAKE_UNAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
endif (CMAKE_UNAME)
# Force the compilers to gcc for iOS
include (CMakeForceCompiler)
# set (MAKE_C_COMPILER "/usr/bin/gcc Apple")
# set (CMAKE_CXX_COMPILER "/usr/bin/g++ Apple")
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
# Skip the platform compiler checks for cross compiling
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
# All iOS/Darwin specific settings - some may be redundant
set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
set (CMAKE_SHARED_MODULE_PREFIX "lib")
set (CMAKE_SHARED_MODULE_SUFFIX ".so")
set (CMAKE_MODULE_EXISTS 1)
set (CMAKE_DL_LIBS "")
set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
# Hidden visibilty is required for cxx on iOS
set (CMAKE_C_FLAGS_INIT "")
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden")
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
# Setup iOS platform unless specified manually with IOS_PLATFORM
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
# Setup building for arm64 or not
if (NOT DEFINED BUILD_ARM64)
set (BUILD_ARM64 true)
endif (NOT DEFINED BUILD_ARM64)
set (BUILD_ARM64 ${BUILD_ARM64} CACHE STRING "Build arm64 arch or not")
# Check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
set (SIMULATOR true)
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64")
set (SIMULATOR true)
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
else (${IOS_PLATFORM} STREQUAL "OS")
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
set (XCODE_POST_43_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
if (EXISTS ${XCODE_POST_43_ROOT})
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT})
elseif(EXISTS ${XCODE_PRE_43_ROOT})
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT})
endif (EXISTS ${XCODE_POST_43_ROOT})
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT
if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
if (_CMAKE_IOS_SDKS)
list (SORT _CMAKE_IOS_SDKS)
list (REVERSE _CMAKE_IOS_SDKS)
list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
else (_CMAKE_IOS_SDKS)
message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
endif (_CMAKE_IOS_SDKS)
message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
# Set the sysroot default to the most recent SDK
set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
# set the architecture for iOS
if (NOT DEFINED ARCH)
set (ARCH armv7)
endif()
set (IOS_ARCH ${ARCH})
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS")
message(STATUS "ios arch: ${IOS_ARCH}")
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
message(STATUS "IOS CMAKE conf finished")

View File

@@ -1,36 +0,0 @@
A good way to help is to test, and report bugs.
See http://www.chiark.greenend.org.uk/~sgtatham/bugs.html if you
want to help that way. Testing is invaluable in making a piece
of software solid and usable.
Patches are preferably to be sent via a github pull request. If that
can't be done, patches in "git format-patch" format can be sent
(eg, posted to fpaste.org with a long enough timeout and a link
posted to #monero-dev on irc.freenode.net).
Patches should be self contained. A good rule of thumb is to have
one patch per separate issue, feature, or logical change. Also, no
other changes, such as random whitespace changes or reindentation.
Following the code style of the particular chunk of code you're
modifying is encourgaged. Proper squashing should be done (eg, if
you're making a buggy patch, then a later patch to fix the bug,
both patches should be merged).
Commit messages should be sensible. That means a subject line that
describes the patch, with an optional longer body that gives details,
documentation, etc.
Comments are encouraged.
If modifying code for which Doxygen headers exist, that header must
be modified to match.
When submitting a pull request on github, make sure your branch is
rebased. No merge commits nor stray commits from other people in
your submitted branch, please. You may be asked to rebase if there
are conflicts (even trivially resolvable ones).
PGP signing commits is strongly encouraged. That should explain why
the previous paragraph is here.
Tests would be nice to have if you're adding functionality.

171
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,171 @@
# Contributing to Monero
A good way to help is to test, and report bugs. See
[How to Report Bugs Effectively (by Simon Tatham)](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html)
if you want to help that way. Testing is invaluable in making a piece
of software solid and usable.
## General guidelines
* Comments are encouraged.
* If modifying code for which Doxygen headers exist, that header must be modified to match.
* Tests would be nice to have if you're adding functionality.
Patches are preferably to be sent via a Github pull request. If that
can't be done, patches in "git format-patch" format can be sent
(eg, posted to fpaste.org with a long enough timeout and a link
posted to #monero-dev on irc.freenode.net).
Patches should be self contained. A good rule of thumb is to have
one patch per separate issue, feature, or logical change. Also, no
other changes, such as random whitespace changes or reindentation.
Following the code style of the particular chunk of code you're
modifying is encouraged. Proper squashing should be done (eg, if
you're making a buggy patch, then a later patch to fix the bug,
both patches should be merged).
If you've made random unrelated changes (either because your editor
is annoying or you made them for other reasons), you can select
what changes go into the coming commit using git add -p, which
walks you through all the changes and asks whether or not to
include this particular change. This helps create clean patches
without any irrelevant changes. git diff will show you the changes
in your tree. git diff --cached will show what is currently staged
for commit. As you add hunks with git add -p, those hunks will
"move" from the git diff output to the git diff --cached output,
so you can see clearly what your commit is going to look like.
## Commits and pull requests
Commit messages should be sensible. That means a subject line that
describes the patch, with an optional longer body that gives details,
documentation, etc.
When submitting a pull request on Github, make sure your branch is
rebased. No merge commits nor stray commits from other people in
your submitted branch, please. You may be asked to rebase if there
are conflicts (even trivially resolvable ones).
PGP signing commits is strongly encouraged. That should explain why
the previous paragraph is here.
# [Code of Conduct (22/C4.1)](http://rfc.zeromq.org/spec:22)
## License
Copyright (c) 2009-2015 Pieter Hintjens.
Copyright (c) 2017-2018 The Monero Project.
This Specification is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This Specification is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>.
## Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
The "Monero Maintainer Team" is defined in this document as the following users:
- fluffypony
- moneromooo
- hyc
## Goals
C4 is meant to provide a reusable optimal collaboration model for open source software projects. It has these specific goals:
- To maximize the scale and diversity of the community around a project, by reducing the friction for new Contributors and creating a scaled participation model with strong positive feedbacks;
- To relieve dependencies on key individuals by separating different skill sets so that there is a larger pool of competence in any required domain;
- To allow the project to develop faster and more accurately, by increasing the diversity of the decision making process;
- To support the natural life cycle of project versions from experimental through to stable, by allowing safe experimentation, rapid failure, and isolation of stable code;
- To reduce the internal complexity of project repositories, thus making it easier for Contributors to participate and reducing the scope for error;
- To enforce collective ownership of the project, which increases economic incentive to Contributors and reduces the risk of hijack by hostile entities.
## Design
### Preliminaries
- The project SHALL use the git distributed revision control system.
- The project SHALL be hosted on github.com or equivalent, herein called the "Platform".
- The project SHALL use the Platform issue tracker.
- Non-GitHub example:
- "Platform" could be a vanilla git repo and Trac hosted on the same machine/network.
- The Platform issue tracker would be Trac.
- The project SHOULD have clearly documented guidelines for code style.
- A "Contributor" is a person who wishes to provide a patch, being a set of commits that solve some clearly identified problem.
- A "Maintainer" is a person who merges patches to the project. Maintainers are not developers; their job is to enforce process.
- Contributors SHALL NOT have commit access to the repository unless they are also Maintainers.
- Maintainers SHALL have commit access to the repository.
- Everyone, without distinction or discrimination, SHALL have an equal right to become a Contributor under the terms of this contract.
### Licensing and ownership
- The project SHALL use a share-alike license, such as BSD-3, the GPLv3 or a variant thereof (LGPL, AGPL), or the MPLv2.
- All contributions to the project source code ("patches") SHALL use the same license as the project.
- All patches are owned by their authors. There SHALL NOT be any copyright assignment process.
- The copyrights in the project SHALL be owned collectively by all its Contributors.
- Each Contributor SHALL be responsible for identifying themselves in the project Contributor list.
### Patch requirements
- Maintainers MUST have a Platform account and SHOULD use their real names or a well-known alias.
- Contributors SHOULD have a Platform account and MAY use their real names or a well-known alias.
- A patch SHOULD be a minimal and accurate answer to exactly one identified and agreed problem.
- A patch MUST adhere to the code style guidelines of the project if these are defined.
- A patch MUST adhere to the "Evolution of Public Contracts" guidelines defined below.
- A patch SHALL NOT include non-trivial code from other projects unless the Contributor is the original author of that code.
- A patch MUST compile cleanly and pass project self-tests on at least the principle target platform.
- A patch commit message SHOULD consist of a single short (less than 50 character) line summarizing the change, optionally followed by a blank line and then a more thorough description.
- A "Correct Patch" is one that satisfies the above requirements.
### Development process
- Change on the project SHALL be governed by the pattern of accurately identifying problems and applying minimal, accurate solutions to these problems.
- To request changes, a user SHOULD log an issue on the project Platform issue tracker.
- The user or Contributor SHOULD write the issue by describing the problem they face or observe.
- The user or Contributor SHOULD seek consensus on the accuracy of their observation, and the value of solving the problem.
- Users SHALL NOT log feature requests, ideas, or suggestions unrelated to Monero code or Monero's dependency code or Monero's potential/future dependency code or research which successfully implements Monero.
- Users SHALL NOT log any solutions to problems (verifiable or hypothetical) of which are not explicitly documented and/or not provable and/or cannot be reasonably proven.
- Thus, the release history of the project SHALL be a list of meaningful issues logged and solved.
- To work on an issue, a Contributor SHALL fork the project repository and then work on their forked repository.
- To submit a patch, a Contributor SHALL create a Platform pull request back to the project.
- A Contributor SHALL NOT commit changes directly to the project.
- To discuss a patch, people MAY comment on the Platform pull request, on the commit, or elsewhere.
- To accept or reject a patch, a Maintainer SHALL use the Platform interface.
- Maintainers SHOULD NOT merge their own patches except in exceptional cases, such as non-responsiveness from other Maintainers for an extended period (more than 30 days) or unless urgent as defined by the Monero Maintainers Team.
- Maintainers SHALL NOT make value judgments on correct patches unless the Maintainer (as may happen in rare circumstances) is a core code developer.
- Maintainers MUST NOT merge pull requests in less than 168 hours (1 week) unless deemed urgent by at least 2 people from the Monero Maintainer Team.
- The Contributor MAY tag an issue as "Ready" after making a pull request for the issue.
- The user who created an issue SHOULD close the issue after checking the patch is successful.
- Maintainers SHOULD ask for improvements to incorrect patches and SHOULD reject incorrect patches if the Contributor does not respond constructively.
- Any Contributor who has value judgments on a correct patch SHOULD express these via their own patches.
- Maintainers MAY commit changes to non-source documentation directly to the project.
### Creating stable releases
- The project SHALL have one branch ("master") that always holds the latest in-progress version and SHOULD always build.
- The project SHALL NOT use topic branches for any reason. Personal forks MAY use topic branches.
- To make a stable release someone SHALL fork the repository by copying it and thus become maintainer of this repository.
- Forking a project for stabilization MAY be done unilaterally and without agreement of project maintainers.
- A patch to a stabilization project declared "stable" SHALL be accompanied by a reproducible test case.
### Evolution of public contracts
- All Public Contracts (APIs or protocols) SHALL be documented.
- All Public Contracts SHOULD have space for extensibility and experimentation.
- A patch that modifies a stable Public Contract SHOULD not break existing applications unless there is overriding consensus on the value of doing this.
- A patch that introduces new features to a Public Contract SHOULD do so using new names.
- Old names SHOULD be deprecated in a systematic fashion by marking new names as "experimental" until they are stable, then marking the old names as "deprecated".
- When sufficient time has passed, old deprecated names SHOULD be marked "legacy" and eventually removed.
- Old names SHALL NOT be reused by new features.
- When old names are removed, their implementations MUST provoke an exception (assertion) if used by applications.
### Project administration
- The project founders SHALL act as Administrators to manage the set of project Maintainers.
- The Administrators SHALL ensure their own succession over time by promoting the most effective Maintainers.
- A new Contributor who makes a correct patch SHALL be invited to become a Maintainer.
- Administrators MAY remove Maintainers who are inactive for an extended period of time, or who repeatedly fail to apply this process accurately.
- Administrators SHOULD block or ban "bad actors" who cause stress and pain to others in the project. This should be done after public discussion, with a chance for all parties to speak. A bad actor is someone who repeatedly ignores the rules and culture of the project, who is needlessly argumentative or hostile, or who is offensive, and who is unable to self-correct their behavior when asked to do so by others.

View File

@@ -1,49 +1,146 @@
FROM debian:testing
MAINTAINER eiabea <developer@eiabea.com>
# Multistage docker build, requires docker 17.05
# Install clone dependencies
RUN set -e && \
apt-get update -q && \
apt-get install -q -y --no-install-recommends ca-certificates git && \
git clone https://github.com/monero-project/monero.git src && \
apt-get purge -y git && \
apt-get clean -q -y && \
apt-get autoclean -q -y && \
apt-get autoremove -q -y
# builder stage
FROM ubuntu:16.04 as builder
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 \
autoconf \
automake \
bzip2
WORKDIR /usr/local
#Cmake
ARG CMAKE_VERSION=3.11.4
ARG CMAKE_VERSION_DOT=v3.11
ARG CMAKE_HASH=8f864e9f78917de3e1483e256270daabc4a321741592c5b36af028e72bff87f5
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_67_0
ARG BOOST_VERSION_DOT=1.67.0
ARG BOOST_HASH=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba
RUN 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 \
&& 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="-fPIC" cxxflags="-fPIC" stage
ENV BOOST_ROOT /usr/local/boost_${BOOST_VERSION}
# OpenSSL
ARG OPENSSL_VERSION=1.1.0h
ARG OPENSSL_HASH=5835626cde9e99656585fc7aaa2302a73a7e1340bf8c14fd635a62c66802a517
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 -fPIC \
&& make build_generated \
&& make libcrypto.a \
&& make install
ENV OPENSSL_ROOT_DIR=/usr/local/openssl-${OPENSSL_VERSION}
# ZMQ
ARG ZMQ_VERSION=v4.2.5
ARG ZMQ_HASH=d062edd8c142384792955796329baf1e5a3377cd
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 \
&& CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure --enable-static --disable-shared \
&& make \
&& make install \
&& ldconfig
# zmq.hpp
ARG CPPZMQ_VERSION=v4.2.3
ARG CPPZMQ_HASH=6aa3ab686e916cb0e62df7fa7d12e0b13ae9fae6
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=7.0
ARG READLINE_HASH=750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334
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} \
&& CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure \
&& make \
&& make install
# Sodium
ARG SODIUM_VERSION=1.0.16
ARG SODIUM_HASH=675149b9b8b66ff44152553fb3ebf9858128363d
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 \
&& CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure \
&& make \
&& make check \
&& make install
WORKDIR /src
COPY . .
# Install make dependencies
RUN set -e && \
apt-get update -q && \
apt-get install -q -y --no-install-recommends build-essential ca-certificates g++ gcc cmake \
pkg-config libunbound2 libevent-2.0-5 libgtest-dev libboost-all-dev libdb5.3++-dev libdb5.3-dev libssl-dev && \
make -j 4 && \
apt-get purge -y g++ gcc cmake pkg-config && \
apt-get clean -q -y && \
apt-get autoclean -q -y && \
apt-get autoremove -q -y && \
mkdir /monero && \
mv /src/build/release/bin/* /monero && \
rm -rf /src
ARG NPROC
RUN set -ex && \
rm -rf build && \
if [ -z "$NPROC" ] ; \
then make -j$(nproc) release-static ; \
else make -j$NPROC release-static ; \
fi
WORKDIR /monero
# 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/
# Contains the blockchain
VOLUME /root/.bitmonero
# Generate your wallet via accessing the container and run:
# cd /wallet
# /./bitmonero/monero-wallet-cli
# monero-wallet-cli
VOLUME /wallet
ENV LOG_LEVEL 0
ENV P2P_BIND_IP 0.0.0.0
ENV P2P_BIND_PORT 18080
ENV RPC_BIND_IP 127.0.0.1
ENV RPC_BIND_PORT 18081
EXPOSE 18080
EXPOSE 18081
CMD ./monerod --log-level=$LOG_LEVEL --p2p-bind-ip=$P2P_BIND_IP --p2p-bind-port=$P2P_BIND_PORT --rpc-bind-ip=$RPC_BIND_IP --rpc-bind-port=$RPC_BIND_PORT
ENTRYPOINT ["monerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=18080", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=18081", "--non-interactive", "--confirm-external-bind"]

View File

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

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
#
# All rights reserved.
#
@@ -35,13 +35,19 @@ cmake-debug:
debug: cmake-debug
cd build/debug && $(MAKE)
# Temporarily disable some tests:
# * libwallet_api_tests fail (Issue #895)
debug-test:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE) && $(MAKE) test
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE) && $(MAKE) ARGS="-E libwallet_api_tests" test
debug-all:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
cd build/debug && cmake -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
debug-static-all:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D STATIC=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
cmake-release:
mkdir -p build/release
@@ -58,39 +64,59 @@ release-all:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
release-static:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
coverage:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -D COVERAGE=ON ../.. && $(MAKE) && $(MAKE) test
release-static-armv6:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
# Targets for specific prebuilt builds which will be advertised for updates by their build tag
release-static-armv7:
release-static-linux-armv6:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv6" ../.. && $(MAKE)
release-static-armv8:
release-static-linux-armv7:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv7" ../.. && $(MAKE)
release-static: release-static-64
release-static-64:
release-static-android:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG="android" ../.. && $(MAKE)
release-static-32:
release-static-linux-armv8:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv8" ../.. && $(MAKE)
release-static-linux-x86_64:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x64" ../.. && $(MAKE)
release-static-freebsd-x86_64:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="freebsd-x64" ../.. && $(MAKE)
release-static-mac-x86_64:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" ../.. && $(MAKE)
release-static-linux-i686:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x86" ../.. && $(MAKE)
release-static-win64:
mkdir -p build/release
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../.. && $(MAKE)
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../.. && $(MAKE)
release-static-win32:
mkdir -p build/release
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../.. && $(MAKE)
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../.. && $(MAKE)
fuzz:
mkdir -p build/fuzz
cd build/fuzz && cmake -D STATIC=ON -D SANITIZE=ON -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" ../.. && $(MAKE)
clean:
@echo "WARNING: Back-up your wallet if it exists within ./build!" ; \

View File

@@ -1,45 +0,0 @@
The Monero command line tools can be translated in various languages.
In order to use the same translation workflow as the future GUI, they
use Qt Linguist translation files. However, to avoid the dependencies
on Qt this normally implies, they use a custom loader to read those
files at runtime. In order to update, or build translations files, you
do need to have Qt tools installed, however. For translating, you need
either the Qt Linguist GUI, or another tool that supports Qt ts files,
such as Transifex. To run, you do not need anything Qt.
To update ts files after changing source code:
./utils/translations/update-translations.sh
To add a new language, eg Spanish (ISO code es):
cp translations/monero.ts translations/monero_es.ts
To edit translations for Spanish:
linguist translations/monero_es.ts
To build translations after modifying them:
./utils/translations/build-translations.sh
To test a translation:
LANG=es ./build/release/bin/monero-wallet-cli
To add new translatable sources in the source:
Use the tr(string) function if possible. If the code is in a class,
and this class doesn't already have a tr() static function, add one,
which uses a context named after what lupdate uses for the context,
usually the fully qualified class name (eg, cryptonote::simple_wallet).
If you need to use tr in code that's not in a class, you can use the
fully qualified version (eg, simple_wallet::tr) of the one matching
the context you want.
Use QT_TRANSLATE_NOOP(string) if you want to specify a context manually.
If you're getting messages of the form:
Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro
all is fine, we don't actually need that here.

44
README.i18n.md Normal file
View File

@@ -0,0 +1,44 @@
Monero daemon internationalization
==================================
The Monero command line tools can be translated in various languages. If you wish to contribute and need help/support, contact the [Monero Localization Workgroup on Taiga](https://taiga.getmonero.org/project/erciccione-monero-localization/) or come chat on `#monero-translations` (Freenode/IRC, riot/matrix, MatterMost)
In order to use the same translation workflow as the [Monero Core GUI](https://github.com/monero-project/monero-core), they use Qt Linguist translation files. However, to avoid the dependencies on Qt this normally implies, they use a custom loader to read those files at runtime.
### Tools for translators
In order to create, update or build translations files, you need to have Qt tools installed. For translating, you need either the **Qt Linguist GUI** ([part of QT Creator](https://www.qt.io/download-open-source/#allDownloadsDiv-9) or a [3rd-party standalone version](https://github.com/lelegard/qtlinguist-installers/releases)), or another tool that supports Qt ts files, such as Transifex. The files are XML, so they can be edited in any plain text editor if needed.
### Creating / modifying translations
You do not need anything from Qt in order to use the final translations.
To update ts files after changing source code:
./utils/translations/update-translations.sh
To add a new language, eg Spanish (ISO code es):
cp translations/monero.ts translations/monero_es.ts
To edit translations for Spanish:
linguist translations/monero_es.ts
To build translations after modifying them:
./utils/translations/build-translations.sh
To test a translation:
LANG=es ./build/release/bin/monero-wallet-cli
To add new translatable strings in the source code:
Use the `tr(string)` function if possible. If the code is in a class, and this class doesn't already have a `tr()` static function, add one, which uses a context named after what `lupdate` uses for the context, usually the fully qualified class name (eg, `cryptonote::simple_wallet`). If you need to use `tr()` in code that's not in a class, you can use the fully qualified version (eg, `simple_wallet::tr`) of the one matching the context you want. Use `QT_TRANSLATE_NOOP(string)` if you want to specify a context manually.
If you're getting messages of the form:
Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro
all is fine, we don't actually need that here.

445
README.md
View File

@@ -1,8 +1,9 @@
# Monero
Copyright (c) 2014-2016, The Monero Project
Copyright (c) 2014-2018 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Development Resources
## Development resources
- Web: [getmonero.org](https://getmonero.org)
- Forum: [forum.getmonero.org](https://forum.getmonero.org)
@@ -10,6 +11,16 @@ Copyright (c) 2014-2016, The Monero Project
- GitHub: [https://github.com/monero-project/monero](https://github.com/monero-project/monero)
- IRC: [#monero-dev on Freenode](http://webchat.freenode.net/?randomnick=1&channels=%23monero-dev&prompt=1&uio=d4)
## Vulnerability response
- Our [Vulnerability Response Process](https://github.com/monero-project/meta/blob/master/VULNERABILITY_RESPONSE_PROCESS.md) encourages responsible disclosure
- We are also available via [HackerOne](https://hackerone.com/monero)
## Announcements
You can subscribe to an [announcement listserv](https://lists.getmonero.org) to get critical announcements from the Monero core team. The announcement list can be very helpful for knowing when software updates are needed.
## Build
| Operating System | Processor | Status |
@@ -21,7 +32,8 @@ Copyright (c) 2014-2016, The Monero Project
| OSX 10.10 | amd64 | [![OSX 10.10 amd64](https://build.getmonero.org/png?builder=monero-static-osx-10.10)](https://build.getmonero.org/builders/monero-static-osx-10.10)
| OSX 10.11 | amd64 | [![OSX 10.11 amd64](https://build.getmonero.org/png?builder=monero-static-osx-10.11)](https://build.getmonero.org/builders/monero-static-osx-10.11)
| OSX 10.12 | amd64 | [![OSX 10.12 amd64](https://build.getmonero.org/png?builder=monero-static-osx-10.12)](https://build.getmonero.org/builders/monero-static-osx-10.12)
| FreeBSD 10.3 | amd64 | [![FreeBSD 10.3 amd64](https://build.getmonero.org/png?builder=monero-static-freebsd64)](https://build.getmonero.org/builders/monero-static-freebsd64)
| FreeBSD 11 | amd64 | [![FreeBSD 11 amd64](https://build.getmonero.org/png?builder=monero-static-freebsd64)](https://build.getmonero.org/builders/monero-static-freebsd64)
| DragonFly BSD 4.6 | amd64 | [![DragonFly BSD amd64](https://build.getmonero.org/png?builder=monero-static-dragonflybsd-amd64)](https://build.getmonero.org/builders/monero-static-dragonflybsd-amd64)
| Windows (MSYS2/MinGW) | i686 | [![Windows (MSYS2/MinGW) i686](https://build.getmonero.org/png?builder=monero-static-win32)](https://build.getmonero.org/builders/monero-static-win32)
| Windows (MSYS2/MinGW) | amd64 | [![Windows (MSYS2/MinGW) amd64](https://build.getmonero.org/png?builder=monero-static-win64)](https://build.getmonero.org/builders/monero-static-win64)
@@ -43,19 +55,17 @@ Monero is a private, secure, untraceable, decentralised digital currency. You ar
**Untraceability:** By taking advantage of ring signatures, a special property of a certain type of cryptography, Monero is able to ensure that transactions are not only untraceable, but have an optional measure of ambiguity that ensures that transactions cannot easily be tied back to an individual user or computer.
## About this Project
## About this project
This is the core implementation of Monero. It is open source and completely free to use without restrictions, except for those specified in the license agreement below. There are no restrictions on anyone creating an alternative implementation of Monero that uses the protocol and network in a compatible manner.
As with many development projects, the repository on Github is considered to be the "staging" area for the latest changes. Before changes are merged into that branch on the main repository, they are tested by individual developers in their own branches, submitted as a pull request, and then subsequently tested by contributors who focus on testing and code reviews. That having been said, the repository should be carefully considered before using it in a production environment, unless there is a patch in the repository for a particular show-stopping issue you are experiencing. It is generally a better idea to use a tagged release for stability.
**Anyone is welcome to contribute to Monero's codebase!** If you have a fix or code change, feel free to submit is as a pull request directly to the "master" branch. In cases where the change is relatively small or does not affect other parts of the codebase it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request.
**Anyone is welcome to contribute to Monero's codebase!** If you have a fix or code change, feel free to submit it as a pull request directly to the "master" branch. In cases where the change is relatively small or does not affect other parts of the codebase it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request.
## Supporting the Project
## Supporting the project
Monero development can be supported directly through donations.
Both Monero and Bitcoin donations can be made to donate.getmonero.org if using a client that supports the [OpenAlias](https://openalias.org) standard
Monero is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. Both Monero and Bitcoin donations can be made to **donate.getmonero.org** if using a client that supports the [OpenAlias](https://openalias.org) standard. Alternatively you can send XMR to the Monero donation address via the `donate` command (type `help` in the command-line wallet for details).
The Monero donation address is: `44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`)
@@ -77,48 +87,37 @@ There are also several mining pools that kindly donate a portion of their fees,
See [LICENSE](LICENSE).
## Monero software updates and consensus protocol changes (hard forking)
## Contributing
Monero uses a hardforking mechanism to implement new features which requires that
users of Monero software run current versions and update their software on a
regular schedule. Here is the current schedule, versions, and compatability.
Dates are provided in the format YYYYMMDD.
If you want to help out, see [CONTRIBUTING](CONTRIBUTING.md) for a set of guidelines.
## Scheduled software upgrades
Monero uses a fixed-schedule software upgrade (hard fork) mechanism to implement new features. This means that users of Monero (end users and service providers) should run current versions and upgrade their software on a regular schedule. Software upgrades occur during the months of April and October. 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 Monero software version. Below is the historical schedule and the projected schedule for the next upgrade.
Dates are provided in the format YYYY-MM-DD.
| Date | Consensus version | Minimum Monero Version | Recommended Monero Version | Details |
| ----------------- | ----------------- | ---------------------- | -------------------------- | ------------------ |
| 2016-09-21 | v3 | v0.9.4 | v0.10.0 | Splits coinbase into denominations |
| 2017-01-05 | v4 | v0.10.1 | v0.10.1 | Allow normal and RingCT transactions |
| 2017-09-21 | v5 | v0.10.1 | v0.10.1 | Allow only RingCT transactions |
| Software upgrade block height | Date | Fork version | Minimum Monero version | Recommended Monero version | Details |
| ------------------------------ | -----------| ----------------- | ---------------------- | -------------------------- | ---------------------------------------------------------------------------------- |
| 1009827 | 2016-03-22 | v2 | v0.9.4 | v0.9.4 | Allow only >= ringsize 3, blocktime = 120 seconds, fee-free blocksize 60 kb |
| 1141317 | 2016-09-21 | v3 | v0.9.4 | v0.10.0 | Splits coinbase into denominations |
| 1220516 | 2017-01-05 | v4 | v0.10.1 | v0.10.2.1 | Allow normal and RingCT transactions |
| 1288616 | 2017-04-15 | v5 | v0.10.3.0 | v0.10.3.1 | Adjusted minimum blocksize and fee algorithm |
| 1400000 | 2017-09-16 | v6 | v0.11.0.0 | v0.11.0.0 | Allow only RingCT transactions, allow only >= ringsize 5 |
| 1546000 | 2018-04-06 | v7 | v0.12.0.0 | v0.12.2.0 | Cryptonight variant 1, ringsize >= 7, sorted inputs
| XXXXXXX | 2018-10-XX | XX | XXXXXXXXX | XXXXXXXXX | X
## Installing Monero from a Package
X's indicate that these details have not been determined as of commit date.
Packages are available for
## Release staging schedule and protocol
* Arch Linux via AUR: [`bitmonero-git`](https://aur.archlinux.org/packages/bitmonero-git)
Approximately three months prior to a scheduled software upgrade, a branch from Master will be created with the new release version tag. Pull requests that address bugs should then be made to both Master and the new release branch. Pull requests that require extensive review and testing (generally, optimizations and new features) should *not* be made to the release branch.
* OS X via [Homebrew](http://brew.sh)
brew tap sammy007/cryptonight
brew install monero --build-from-source
* Docker
docker build -t monero .
# either run in foreground
docker run -it -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
# or in background
docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
Packaging for your favorite distribution would be a welcome contribution!
## Compiling Monero from Source
## Compiling Monero from source
### Dependencies
The following table summarizes the tools and libraries required to build. A
The following table summarizes the tools and libraries required to build. A
few of the libraries are also included in this repository (marked as
"Vendored"). By default, the build uses the library installed on the system,
and ignores the vendored sources. However, if no library is found installed on
@@ -127,26 +126,41 @@ sources are also used for statically-linked builds because distribution
packages often include only shared library binaries (`.so`) but not static
library archives (`.a`).
| Dep | Min. Version | Vendored | Debian/Ubuntu Pkg | Arch Pkg | Optional | Purpose |
| -------------- | ------------- | ---------| ------------------ | -------------- | -------- | -------------- |
| GCC | 4.7.3 | NO | `build-essential` | `base-devel` | NO | |
| CMake | 3.0.0 | NO | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | NO | |
| BerkeleyDB | 4.8 | NO | `libdb{,++}-dev` | `db` | NO | |
| libevent | 2.0 | NO | `libevent-dev` | `libevent` | NO | |
| libunbound | 1.4.16 | YES | `libunbound-dev` | `unbound` | NO | |
| libminiupnpc | 2.0 | YES | `libminiupnpc-dev` | `miniupnpc` | YES | NAT punching |
| libunwind | any | NO | `libunwind8-dev` | `libunwind` | YES | stack traces |
| ldns | 1.6.17 | NO | `libldns-dev` | `ldns` | YES | ? |
| expat | 1.1 | NO | `libexpat1-dev` | `expat` | YES | ? |
| GTest | 1.5 | YES | `libgtest-dev`^ | `gtest` | YES | test suite |
| Doxygen | any | NO | `doxygen` | `doxygen` | YES | documentation |
| Graphviz | any | NO | `graphviz` | `graphviz` | YES | documentation |
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Fedora | Optional | Purpose |
| ------------ | ------------- | -------- | ------------------ | ------------ | ----------------- | -------- | -------------- |
| GCC | 4.7.3 | NO | `build-essential` | `base-devel` | `gcc` | NO | |
| CMake | 3.0.0 | NO | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | NO | C++ libraries |
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | NO | sha256 sum |
| libzmq | 3.0.0 | NO | `libzmq3-dev` | `zeromq` | `cppzmq-devel` | NO | ZeroMQ library |
| libunbound | 1.4.16 | YES | `libunbound-dev` | `unbound` | `unbound-devel` | NO | DNS resolver |
| libsodium | ? | NO | `libsodium-dev` | ? | `libsodium-devel` | NO | libsodium |
| libminiupnpc | 2.0 | YES | `libminiupnpc-dev` | `miniupnpc` | `miniupnpc-devel` | YES | NAT punching |
| libunwind | any | NO | `libunwind8-dev` | `libunwind` | `libunwind-devel` | YES | Stack traces |
| liblzma | any | NO | `liblzma-dev` | `xz` | `xz-devel` | YES | For libunwind |
| libreadline | 6.3.0 | NO | `libreadline6-dev` | `readline` | `readline-devel` | YES | Input editing |
| ldns | 1.6.17 | NO | `libldns-dev` | `ldns` | `ldns-devel` | YES | SSL toolkit |
| expat | 1.1 | NO | `libexpat1-dev` | `expat` | `expat-devel` | YES | XML parsing |
| GTest | 1.5 | YES | `libgtest-dev`^ | `gtest` | `gtest-devel` | YES | Test suite |
| Doxygen | any | NO | `doxygen` | `doxygen` | `doxygen` | YES | Documentation |
| Graphviz | any | NO | `graphviz` | `graphviz` | `graphviz` | YES | Documentation |
| pcsclite | ? | NO | `libpcsclite-dev` | ? | `pcsc-lite pcsc-lite-devel` | NO | Ledger |
[^] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must
build the library binary manually. This can be done with the following command ```sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ ```
### Cloning the repository
Clone recursively to pull-in needed submodule(s):
`$ git clone --recursive https://github.com/monero-project/monero`
If you already have a repo cloned, initialize and update:
`$ cd monero && git submodule init && git submodule update`
### Build instructions
Monero uses the CMake build system and a top-level [Makefile](Makefile) that
@@ -165,6 +179,9 @@ invokes cmake commands as needed.
this to be worthwhile, the machine should have one core and about 2GB of RAM
available per thread.
*Note*: If cmake can not find zmq.hpp file on OS X, installing `zmq.hpp` from
https://github.com/zeromq/cppzmq to `/usr/local/include` should fix that error.
* The resulting executables can be found in `build/release/bin`
* Add `PATH="$PATH:$HOME/monero/build/release/bin"` to `.profile`
@@ -175,7 +192,7 @@ invokes cmake commands as needed.
make release-test
*NOTE*: `coretests` test may take a few hours to complete.
*NOTE*: `core_tests` test may take a few hours to complete.
* **Optional**: to build binaries suitable for debugging:
@@ -185,17 +202,19 @@ invokes cmake commands as needed.
make release-static
Dependencies need to be built with -fPIC. Static libraries usually aren't, so you may have to build them yourself with -fPIC. Refer to their documentation for how to build them.
* **Optional**: build documentation in `doc/html` (omit `HAVE_DOT=YES` if `graphviz` is not installed):
HAVE_DOT=YES doxygen Doxyfile
#### On the Raspberry Pi
Tested on a Raspberry Pi 2 with a clean install of minimal Debian Jessie from https://www.raspberrypi.org/downloads/raspbian/
Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (2017-09-07 or later) from https://www.raspberrypi.org/downloads/raspbian/. If you are using Raspian Jessie, [please see note in the following section](#note-for-raspbian-jessie-users).
* `apt-get update && apt-get upgrade` to install all of the latest software
* Install the dependencies for Monero except libunwind and libboost-all-dev
* Install the dependencies for Monero from the 'Debian' column in the table above.
* Increase the system swap size:
```
@@ -204,27 +223,17 @@ Tested on a Raspberry Pi 2 with a clean install of minimal Debian Jessie from ht
CONF_SWAPSIZE=1024
sudo /etc/init.d/dphys-swapfile start
```
* Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*` to remove a previous version if you're not using a clean install):
* Clone monero and checkout most recent release version:
```
cd
wget https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.bz2
tar xvfo boost_1_62_0.tar.bz2
cd boost_1_62_0
./bootstrap.sh
sudo ./b2
git clone https://github.com/monero-project/monero.git
cd monero
git checkout tags/v0.11.1.0
```
* Build:
```
* Wait ~8 hours
sudo ./bjam install
* Wait ~4 hours
* Change to the root of the source code directory and build:
cd monero
make release
* Wait ~4 hours
```
* Wait 4-6 hours
* The resulting executables can be found in `build/release/bin`
@@ -234,6 +243,38 @@ Tested on a Raspberry Pi 2 with a clean install of minimal Debian Jessie from ht
* You may wish to reduce the size of the swap file after the build has finished, and delete the boost directory from your home directory
#### *Note for Raspbian Jessie users:*
If you are using the older Raspbian Jessie image, compiling Monero is a bit more complicated. The version of Boost available in the Debian Jessie repositories is too old to use with Monero, and thus you must compile a newer version yourself. The following explains the extra steps, and has been tested on a Raspberry Pi 2 with a clean install of minimal Raspbian Jessie.
* As before, `apt-get update && apt-get upgrade` to install all of the latest software, and increase the system swap size
```
sudo /etc/init.d/dphys-swapfile stop
sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=1024
sudo /etc/init.d/dphys-swapfile start
```
* Then, install the dependencies for Monero except `libunwind` and `libboost-all-dev`
* Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*` to remove a previous version if you're not using a clean install):
```
cd
wget https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2
tar xvfo boost_1_64_0.tar.bz2
cd boost_1_64_0
./bootstrap.sh
sudo ./b2
```
* Wait ~8 hours
```
sudo ./bjam install
```
* Wait ~4 hours
* From here, follow the [general Raspberry Pi instructions](#on-the-raspberry-pi) from the "Clone monero and checkout most recent release version" step.
#### On Windows:
Binaries for Windows are built on Windows using the MinGW toolchain within
@@ -242,7 +283,7 @@ POSIX system. The toolchain runs within the environment and *cross-compiles*
binaries that can run outside of the environment as a regular Windows
application.
**Preparing the Build Environment**
**Preparing the build environment**
* Download and install the [MSYS2 installer](http://msys2.github.io), either the 64-bit or the 32-bit package, depending on your system.
* Open the MSYS shell via the `MSYS2 Shell` shortcut
@@ -261,11 +302,11 @@ application.
To build for 64-bit Windows:
pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost
pacman -S 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
To build for 32-bit Windows:
pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost
pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-zeromq mingw-w64-i686-libsodium
* Open the MingW shell via `MinGW-w64-Win64 Shell` shortcut on 64-bit Windows
or `MinGW-w64-Win64 Shell` shortcut on 32-bit Windows. Note that if you are
@@ -285,12 +326,14 @@ application.
### On FreeBSD:
The project can be built from scratch by following instructions for Linux above.
The project can be built from scratch by following instructions for Linux above. If you are running monero in a jail you need to add the flag: `allow.sysvipc=1` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`.
We expect to add Monero into the ports tree in the near future, which will aid in managing installations using ports or packages.
### On OpenBSD:
#### OpenBSD < 6.2
This has been tested on OpenBSD 5.8.
You will need to add a few packages to your system. `pkg_add db cmake gcc gcc-libs g++ miniupnpc gtest`.
@@ -304,18 +347,154 @@ You will have to add the serialization, date_time, and regex modules to Boost wh
To build: `env CC=egcc CXX=eg++ CPP=ecpp DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/path/to/the/boost/you/built make release-static-64`
### Building Portable Statically Linked Binaries
#### OpenBSD >= 6.2
You will need to add a few packages to your system. `pkg_add cmake miniupnpc zeromq libiconv`.
The doxygen and graphviz packages are optional and require the xbase set.
Build the Boost library using clang. This guide is derived from: https://github.com/bitcoin/bitcoin/blob/master/doc/build-openbsd.md
We assume you are compiling with a non-root user and you have `doas` enabled.
Note: do not use the boost package provided by OpenBSD, as we are installing boost to `/usr/local`.
```
# Create boost building directory
mkdir ~/boost
cd ~/boost
# Fetch boost source
ftp -o boost_1_64_0.tar.bz2 https://netcologne.dl.sourceforge.net/project/boost/boost/1.64.0/boost_1_64_0.tar.bz2
# MUST output: (SHA256) boost_1_64_0.tar.bz2: OK
echo "7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 boost_1_64_0.tar.bz2" | sha256 -c
tar xfj boost_1_64_0.tar.bz2
# Fetch and apply boost patches, required for OpenBSD
ftp -o boost_test_impl_execution_monitor_ipp.patch https://raw.githubusercontent.com/openbsd/ports/bee9e6df517077a7269ff0dfd57995f5c6a10379/devel/boost/patches/patch-boost_test_impl_execution_monitor_ipp
ftp -o boost_config_platform_bsd_hpp.patch https://raw.githubusercontent.com/openbsd/ports/90658284fb786f5a60dd9d6e8d14500c167bdaa0/devel/boost/patches/patch-boost_config_platform_bsd_hpp
# MUST output: (SHA256) boost_config_platform_bsd_hpp.patch: OK
echo "1f5e59d1154f16ee1e0cc169395f30d5e7d22a5bd9f86358f738b0ccaea5e51d boost_config_platform_bsd_hpp.patch" | sha256 -c
# MUST output: (SHA256) boost_test_impl_execution_monitor_ipp.patch: OK
echo "30cec182a1437d40c3e0bd9a866ab5ddc1400a56185b7e671bb3782634ed0206 boost_test_impl_execution_monitor_ipp.patch" | sha256 -c
cd boost_1_64_0
patch -p0 < ../boost_test_impl_execution_monitor_ipp.patch
patch -p0 < ../boost_config_platform_bsd_hpp.patch
# Start building boost
echo 'using clang : : c++ : <cxxflags>"-fvisibility=hidden -fPIC" <linkflags>"" <archiver>"ar" <striper>"strip" <ranlib>"ranlib" <rc>"" : ;' > user-config.jam
./bootstrap.sh --without-icu --with-libraries=chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale --with-toolset=clang
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" -sICONV_PATH=/usr/local
doas ./b2 -d0 runtime-link=shared threadapi=pthread threading=multi link=static variant=release --layout=tagged --build-type=complete --user-config=user-config.jam -sNO_BZIP2=1 -sICONV_PATH=/usr/local --prefix=/usr/local install
```
Build cppzmq
Build the cppzmq bindings.
We assume you are compiling with a non-root user and you have `doas` enabled.
```
# Create cppzmq building directory
mkdir ~/cppzmq
cd ~/cppzmq
# Fetch cppzmq source
ftp -o cppzmq-4.2.3.tar.gz https://github.com/zeromq/cppzmq/archive/v4.2.3.tar.gz
# MUST output: (SHA256) cppzmq-4.2.3.tar.gz: OK
echo "3e6b57bf49115f4ae893b1ff7848ead7267013087dc7be1ab27636a97144d373 cppzmq-4.2.3.tar.gz" | sha256 -c
tar xfz cppzmq-4.2.3.tar.gz
# Start building cppzmq
cd cppzmq-4.2.3
mkdir build
cd build
cmake ..
doas make install
```
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local make release-static`
### On Solaris:
The default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld:
mkdir -p build/release
cd build/release
cmake -DCMAKE_LINKER=/path/to/ld -D CMAKE_BUILD_TYPE=Release ../..
cd ../..
Then you can run make as usual.
### On Linux for Android (using docker):
# Build image (select android64.Dockerfile for aarch64)
cd utils/build_scripts/ && docker build -f android32.Dockerfile -t monero-android .
# Create container
docker create -it --name monero-android monero-android bash
# Get binaries
docker cp monero-android:/opt/android/monero/build/release/bin .
### Building portable statically linked binaries
By default, in either dynamically or statically linked builds, binaries target the specific host processor on which the build happens and are not portable to other processors. Portable binaries can be built using the following targets:
* ```make release-static-64``` builds binaries on Linux on x86_64 portable across POSIX systems on x86_64 processors
* ```make release-static-32``` builds binaries on Linux on x86_64 or i686 portable across POSIX systems on i686 processors
* ```make release-static-armv8``` builds binaries on Linux portable across POSIX systems on armv8 processors
* ```make release-static-armv7``` builds binaries on Linux portable across POSIX systems on armv7 processors
* ```make release-static-armv6``` builds binaries on Linux portable across POSIX systems on armv6 processors
* ```make release-static-linux-x86_64``` builds binaries on Linux on x86_64 portable across POSIX systems on x86_64 processors
* ```make release-static-linux-i686``` builds binaries on Linux on x86_64 or i686 portable across POSIX systems on i686 processors
* ```make release-static-linux-armv8``` builds binaries on Linux portable across POSIX systems on armv8 processors
* ```make release-static-linux-armv7``` builds binaries on Linux portable across POSIX systems on armv7 processors
* ```make release-static-linux-armv6``` builds binaries on Linux portable across POSIX systems on armv6 processors
* ```make release-static-win64``` builds binaries on 64-bit Windows portable across 64-bit Windows systems
* ```make release-static-win32``` builds binaries on 64-bit or 32-bit Windows portable across 32-bit Windows systems
## Installing Monero from a package
**DISCLAIMER: These packages are not part of this repository or maintained by this project's contributors, and as such, do not go through the same review process to ensure their trustworthiness and security.**
Packages are available for
* Ubuntu and [snap supported](https://snapcraft.io/docs/core/install) systems, via a community contributed build.
snap install monero --beta
Installing a snap is very quick. Snaps are secure. They are isolated with all of their dependencies. Snaps also auto update when a new version is released.
* Arch Linux (via [AUR](https://aur.archlinux.org/)):
- Stable release: [`monero`](https://aur.archlinux.org/packages/monero)
- Bleeding edge: [`monero-git`](https://aur.archlinux.org/packages/monero-git)
* Void Linux:
xbps-install -S monero
* GuixSD
guix package -i monero
* Docker
# Build using all available cores
docker build -t monero .
# or build using a specific number of cores (reduce RAM requirement)
docker build --build-arg NPROC=1 -t monero .
# either run in foreground
docker run -it -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
# or in background
docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
* The build needs 3 GB space.
* Wait one hour or more
Packaging for your favorite distribution would be a welcome contribution!
## Running monerod
The build places the binary in `bin/` sub-directory within the build directory
@@ -346,43 +525,97 @@ monero-wallet-cli, and possibly monerod, if you get crashes refreshing.
## Internationalization
See README.i18n
See [README.i18n.md](README.i18n.md).
## Using Tor
While Monero isn't made to integrate with Tor, it can be used wrapped with torsocks, if you add --p2p-bind-ip 127.0.0.1 to the monerod command line. You also want to set DNS requests to go over TCP, so they'll be routed through Tor, by setting DNS_PUBLIC=tcp. You may also disable IGD (UPnP port forwarding negotiation), which is pointless with Tor. To allow local connections from the wallet, you might have to add TORSOCKS_ALLOW_INBOUND=1, some OSes need it and some don't. Example:
While Monero isn't made to integrate with Tor, it can be used wrapped with torsocks, by
setting the following configuration parameters and environment variables:
`DNS_PUBLIC=tcp torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd`
* `--p2p-bind-ip 127.0.0.1` on the command line or `p2p-bind-ip=127.0.0.1` in
monerod.conf to disable listening for connections on external interfaces.
* `--no-igd` on the command line or `no-igd=1` in monerod.conf to disable IGD
(UPnP port forwarding negotiation), which is pointless with Tor.
* `DNS_PUBLIC=tcp` or `DNS_PUBLIC=tcp://x.x.x.x` where x.x.x.x is the IP of the
desired DNS server, for DNS requests to go over TCP, so that they are routed
through Tor. When IP is not specified, monerod uses the default list of
servers defined in [src/common/dns_utils.cpp](src/common/dns_utils.cpp).
* `TORSOCKS_ALLOW_INBOUND=1` to tell torsocks to allow monerod to bind to interfaces
to accept connections from the wallet. On some Linux systems, torsocks
allows binding to localhost by default, so setting this variable is only
necessary to allow binding to local LAN/VPN interfaces to allow wallets to
connect from remote hosts. On other systems, it may be needed for local wallets
as well.
* Do NOT pass `--detach` when running through torsocks with systemd, (see
[utils/systemd/monerod.service](utils/systemd/monerod.service) for details).
* If you use the wallet with a Tor daemon via the loopback IP (eg, 127.0.0.1:9050),
then use `--untrusted-daemon` unless it is your own hidden service.
or:
Example command line to start monerod through Tor:
`DNS_PUBLIC=tcp TORSOCKS_ALLOW_INBOUND=1 torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd`
DNS_PUBLIC=tcp torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd
TAILS ships with a very restrictive set of firewall rules. Therefore, you need to add a rule to allow this connection too, in addition to telling torsocks to allow inbound connections. Full example:
### Using Tor on Tails
`sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT`
TAILS ships with a very restrictive set of firewall rules. Therefore, you need
to add a rule to allow this connection too, in addition to telling torsocks to
allow inbound connections. Full example:
`DNS_PUBLIC=tcp torsocks ./monerod --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 --data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain`
sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT
DNS_PUBLIC=tcp torsocks ./monerod --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \
--data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain
`./monero-wallet-cli`
## Debugging
## Using readline
This section contains general instructions for debugging failed installs or problems encountered with Monero. First ensure you are running the latest version built from the Github repo.
While monerod and monero-wallet-cli do not use readline directly, most of the functionality can be obtained by running them via rlwrap. This allows command recall, edit capabilities, etc. It does not give autocompletion without an extra completion file, however. To use rlwrap, simply prepend `rlwrap` to the command line, eg:
### Obtaining stack traces and core dumps on Unix systems
`rlwrap bin/monero-wallet-cli --wallet-file /path/to/wallet`
We generally use the tool `gdb` (GNU debugger) to provide stack trace functionality, and `ulimit` to provide core dumps in builds which crash or segfault.
Note: rlwrap will save things like your seed and private keys, if you supply them on prompt. You may want to not use rlwrap when you use simplewallet to restore from seed, etc.
* To use gdb in order to obtain a stack trace for a build that has stalled:
# Contributing
Run the build.
If you want to help out, see CONTRIBUTING for a set of guidelines.
Once it stalls, enter the following command:
# Debugging
```
gdb /path/to/monerod `pidof monerod`
```
This section contains general instructions for debugging failed installs or problems encountered with Monero. First ensure you are running the latest version built from the github repo.
Type `thread apply all bt` within gdb in order to obtain the stack trace
## LMDB
* If however the core dumps or segfaults:
Enter `ulimit -c unlimited` on the command line to enable unlimited filesizes for core dumps
Enter `echo core | sudo tee /proc/sys/kernel/core_pattern` to stop cores from being hijacked by other tools
Run the build.
When it terminates with an output along the lines of "Segmentation fault (core dumped)", there should be a core dump file in the same directory as monerod. It may be named just `core`, or `core.xxxx` with numbers appended.
You can now analyse this core dump with `gdb` as follows:
`gdb /path/to/monerod /path/to/dumpfile`
Print the stack trace with `bt`
* To run monero within gdb:
Type `gdb /path/to/monerod`
Pass command-line options with `--args` followed by the relevant arguments
Type `run` to run monerod
### Analysing memory corruption
We use the tool `valgrind` for this.
Run with `valgrind /path/to/monerod`. It will be slow.
### LMDB
Instructions for debugging suspected blockchain corruption as per @HYC

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
#
# All rights reserved.
#

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
#
# All rights reserved.
#

14
cmake/CheckLinkerFlag.c Normal file
View File

@@ -0,0 +1,14 @@
#ifdef __CLASSIC_C__
int main()
{
int ac;
char* av[];
#else
int main(int ac, char* av[])
{
#endif
if (ac > 1000) {
return *av[0];
}
return 0;
}

View File

@@ -0,0 +1,47 @@
include(CheckCCompilerFlag)
macro(CHECK_LINKER_FLAG flag VARIABLE)
if(NOT DEFINED "${VARIABLE}")
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag")
endif()
set(_cle_source ${CMAKE_SOURCE_DIR}/cmake/CheckLinkerFlag.c)
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${flag}")
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${_cle_source}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${flag}
CMAKE_FLAGS
OUTPUT_VARIABLE OUTPUT)
unset(_cle_source)
set(CMAKE_C_FLAGS ${saved_CMAKE_C_FLAGS})
unset(saved_CMAKE_C_FLAGS)
if ("${OUTPUT}" MATCHES "warning.*ignored")
set(${VARIABLE} 0)
endif()
if(${VARIABLE})
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have linker flag ${flag}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${flag} linker flag is supported "
"passed with the following output:\n"
"${OUTPUT}\n\n")
else()
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${flag} linker flag - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have linker flag ${flag}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${flag} linker flag is suppored "
"failed with the following output:\n"
"${OUTPUT}\n\n")
endif()
endif()
endmacro()

View File

@@ -17,6 +17,22 @@ find_path(LIBUNWIND_INCLUDE_DIR libunwind.h
)
find_library(LIBUNWIND_LIBRARIES NAMES unwind )
if(NOT LIBUNWIND_LIBRARIES STREQUAL "LIBUNWIND_LIBRARIES-NOTFOUND")
if (CMAKE_COMPILER_IS_GNUCC)
set(LIBUNWIND_LIBRARIES "gcc_eh;${LIBUNWIND_LIBRARIES}")
endif()
endif()
# some versions of libunwind need liblzma, and we don't use pkg-config
# so we just look whether liblzma is installed, and add it if it is.
# It might not be actually needed, but doesn't hurt if it is not.
# We don't need any headers, just the lib, as it's privately needed.
message(STATUS "looking for liblzma")
find_library(LIBLZMA_LIBRARIES lzma )
if(NOT LIBLZMA_LIBRARIES STREQUAL "LIBLZMA_LIBRARIES-NOTFOUND")
message(STATUS "liblzma found")
set(LIBUNWIND_LIBRARIES "${LIBUNWIND_LIBRARIES};${LIBLZMA_LIBRARIES}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libunwind "Could not find libunwind" LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES)

View File

@@ -4,10 +4,7 @@
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
# MINIUPNP_LIBRARY, the miniupnp variant
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
# MINIUPNPC_VERSION_PRE1_6 --> set if we detect the version of miniupnpc is
# pre 1.6
# MINIUPNPC_VERSION_PRE1_5 --> set if we detect the version of miniupnpc is
# pre 1.5
# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
#
# Note that the expected include convention is
# #include "miniupnpc.h"
@@ -16,170 +13,47 @@
# This is because, the miniupnpc location is not standardized and may exist
# in locations other than miniupnpc/
#=============================================================================
# Copyright 2011 Mark Vejvoda
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
# Already in cache, be silent
set(MINIUPNP_FIND_QUIETLY TRUE)
endif ()
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
PATH_SUFFIXES miniupnpc)
find_library(MINIUPNP_LIBRARY miniupnpc)
HINTS $ENV{MINIUPNP_INCLUDE_DIR}
PATH_SUFFIXES miniupnpc
)
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
set (MINIUPNP_FOUND TRUE)
endif ()
find_library(MINIUPNP_LIBRARY miniupnpc
HINTS $ENV{MINIUPNP_LIBRARY}
)
if (MINIUPNP_FOUND)
include(CheckCXXSourceRuns)
if (NOT MINIUPNP_FIND_QUIETLY)
message (STATUS "Found the miniupnpc libraries at ${MINIUPNP_LIBRARY}")
message (STATUS "Found the miniupnpc headers at ${MINIUPNP_INCLUDE_DIR}")
endif ()
find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
)
message(STATUS "Detecting version of miniupnpc in path: ${MINIUPNP_INCLUDE_DIR}")
set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
static struct UPNPUrls urls;
static struct IGDdatas data;
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
MiniUPnPc DEFAULT_MSG
MINIUPNP_INCLUDE_DIR
MINIUPNP_LIBRARY
)
GetUPNPUrls (&urls, &data, \"myurl\",0);
return 0;
}"
MINIUPNPC_VERSION_1_7_OR_HIGHER)
IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
struct UPNPDev *devlist = NULL;
int upnp_delay = 5000;
const char *upnp_multicastif = NULL;
const char *upnp_minissdpdsock = NULL;
int upnp_sameport = 0;
int upnp_ipv6 = 0;
int upnp_error = 0;
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport, upnp_ipv6, &upnp_error);
return 0;
}"
MINIUPNPC_VERSION_PRE1_7)
ENDIF()
IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
struct UPNPDev *devlist = NULL;
int upnp_delay = 5000;
const char *upnp_multicastif = NULL;
const char *upnp_minissdpdsock = NULL;
int upnp_sameport = 0;
int upnp_ipv6 = 0;
int upnp_error = 0;
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport);
return 0;
}"
MINIUPNPC_VERSION_PRE1_6)
ENDIF()
IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
static struct UPNPUrls urls;
static struct IGDdatas data;
int main()
{
char externalIP[16] = \"\";
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
return 0;
}"
MINIUPNPC_VERSION_1_5_OR_HIGHER)
ENDIF()
IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
static struct UPNPUrls urls;
static struct IGDdatas data;
int main()
{
char externalIP[16] = \"\";
UPNP_GetExternalIPAddress(urls.controlURL, data.servicetype, externalIP);
return 0;
}"
MINIUPNPC_VERSION_PRE1_5)
IF(MINIUPNPC_FOUND)
file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
set(MINIUPNP_FOUND true)
set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
endif()
endif()
ENDIF()
IF(MINIUPNPC_VERSION_PRE1_5)
message(STATUS "Found miniupnpc version is pre v1.5")
ENDIF()
IF(MINIUPNPC_VERSION_PRE1_6)
message(STATUS "Found miniupnpc version is pre v1.6")
ENDIF()
IF(MINIUPNPC_VERSION_PRE1_7)
message(STATUS "Found miniupnpc version is pre v1.7")
ENDIF()
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
IF(MINIUPNPC_VERSION_1_5_OR_HIGHER)
message(STATUS "Found miniupnpc version is v1.5 or higher")
ELSE()
message(STATUS "Found miniupnpc version is v1.7 or higher")
ENDIF()
ENDIF()
else ()
message (STATUS "Could not find miniupnp")
endif ()
MARK_AS_ADVANCED(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY)
mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
# --------------------------------- FindMiniupnpc End ---------------------------------

53
cmake/FindPCSC.cmake Normal file
View File

@@ -0,0 +1,53 @@
# - Find PCSC
# Find the native PCSC includes and library
#
# PCSC_INCLUDE_DIR - where to find winscard.h, wintypes.h, etc.
# PCSC_LIBRARIES - List of libraries when using PCSC.
# PCSC_FOUND - True if PCSC found.
IF (PCSC_INCLUDE_DIR AND PCSC_LIBRARIES)
# Already in cache, be silent
SET(PCSC_FIND_QUIETLY TRUE)
ENDIF (PCSC_INCLUDE_DIR AND PCSC_LIBRARIES)
IF (NOT WIN32)
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_PCSC libpcsclite)
FIND_PATH(PCSC_INCLUDE_DIR winscard.h
HINTS
/usr/include/PCSC
${PC_PCSC_INCLUDEDIR}
${PC_PCSC_INCLUDE_DIRS}
PATH_SUFFIXES PCSC
)
FIND_LIBRARY(PCSC_LIBRARY NAMES pcsclite libpcsclite PCSC
HINTS
${PC_PCSC_LIBDIR}
${PC_PCSC_LIBRARY_DIRS}
)
ELSE (NOT WIN32)
IF(BUILD_64 STREQUAL "ON")
set(PCSC_INCLUDE_DIR /mingw64/x86_64-w64-mingw32/include)
set(PCSC_LIBRARY /mingw64/x86_64-w64-mingw32/lib/libwinscard.a)
ELSE(BUILD_64 STREQUAL "ON")
set(PCSC_INCLUDE_DIR /mingw32/i686-w64-mingw32/include)
set(PCSC_LIBRARY /mingw32/i686-w64-mingw32/lib/libwinscard.a)
ENDIF(BUILD_64 STREQUAL "ON")
ENDIF (NOT WIN32)
# handle the QUIETLY and REQUIRED arguments and set PCSC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC DEFAULT_MSG PCSC_LIBRARY PCSC_INCLUDE_DIR)
IF(PCSC_FOUND)
SET( PCSC_LIBRARIES ${PCSC_LIBRARY} )
ELSE(PCSC_FOUND)
SET( PCSC_LIBRARIES )
ENDIF(PCSC_FOUND)
MARK_AS_ADVANCED( PCSC_LIBRARY PCSC_INCLUDE_DIR )

89
cmake/FindReadline.cmake Normal file
View File

@@ -0,0 +1,89 @@
# - Try to find readline include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Readline)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Readline_ROOT_DIR Set this variable to the root installation of
# readline if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# READLINE_FOUND System has readline, include and lib dirs found
# GNU_READLINE_FOUND Version of readline found is GNU readline, not libedit!
# LIBEDIT_FOUND Version of readline found is libedit, not GNU readline!
# Readline_INCLUDE_DIR The readline include directories.
# Readline_LIBRARY The readline library.
# GNU_READLINE_LIBRARY The GNU readline library or empty string.
# LIBEDIT_LIBRARY The libedit library or empty string.
find_path(Readline_ROOT_DIR
NAMES include/readline/readline.h
PATHS /opt/local/ /usr/local/ /usr/
NO_DEFAULT_PATH
)
find_path(Readline_INCLUDE_DIR
NAMES readline/readline.h
PATHS ${Readline_ROOT_DIR}/include
NO_DEFAULT_PATH
)
find_library(Readline_LIBRARY
NAMES readline
PATHS ${Readline_ROOT_DIR}/lib
NO_DEFAULT_PATH
)
find_library(Termcap_LIBRARY
NAMES tinfo termcap ncursesw ncurses cursesw curses
)
if(Readline_INCLUDE_DIR AND Readline_LIBRARY)
set(READLINE_FOUND TRUE)
else(Readline_INCLUDE_DIR AND Readline_LIBRARY)
FIND_LIBRARY(Readline_LIBRARY NAMES readline PATHS Readline_ROOT_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY )
MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
endif(Readline_INCLUDE_DIR AND Readline_LIBRARY)
mark_as_advanced(
Readline_ROOT_DIR
Readline_INCLUDE_DIR
Readline_LIBRARY
)
set(CMAKE_REQUIRED_INCLUDES ${Readline_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY})
include(CheckFunctionExists)
check_function_exists(rl_copy_text HAVE_COPY_TEXT)
check_function_exists(rl_filename_completion_function HAVE_COMPLETION_FUNCTION)
if(NOT HAVE_COMPLETION_FUNCTION)
set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY} ${Termcap_LIBRARY})
check_function_exists(rl_copy_text HAVE_COPY_TEXT_TC)
check_function_exists(rl_filename_completion_function HAVE_COMPLETION_FUNCTION_TC)
set(HAVE_COMPLETION_FUNCTION ${HAVE_COMPLETION_FUNCTION_TC})
set(HAVE_COPY_TEXT ${HAVE_COPY_TEXT_TC})
if(HAVE_COMPLETION_FUNCTION)
set(Readline_LIBRARY ${Readline_LIBRARY} ${Termcap_LIBRARY})
endif(HAVE_COMPLETION_FUNCTION)
endif(NOT HAVE_COMPLETION_FUNCTION)
set(LIBEDIT_LIBRARY "")
set(GNU_READLINE_LIBRARY "")
if(HAVE_COMPLETION_FUNCTION AND HAVE_COPY_TEXT)
set(GNU_READLINE_FOUND TRUE)
set(GNU_READLINE_LIBRARY ${Readline_LIBRARY})
elseif(READLINE_FOUND AND NOT HAVE_COPY_TEXT)
set(LIBEDIT_FOUND TRUE)
set(LIBEDIT_LIBRARY ${Readline_LIBRARY})
endif(HAVE_COMPLETION_FUNCTION AND HAVE_COPY_TEXT)

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
#
# All rights reserved.
#
@@ -36,7 +36,7 @@ if(RET)
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
set(VERSIONTAG "unknown")
configure_file("src/version.h.in" "${TO}")
configure_file("src/version.cpp.in" "${TO}")
else()
message(STATUS "You are currently on commit ${COMMIT}")
@@ -59,5 +59,5 @@ else()
endif()
endif()
configure_file("src/version.h.in" "${TO}")
configure_file("src/version.cpp.in" "${TO}")
endif()

52
cmake/Version.cmake Normal file
View File

@@ -0,0 +1,52 @@
# Copyright (c) 2014-2018, 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.
function (write_static_version_header hash)
set(VERSIONTAG "${hash}")
configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
endfunction ()
find_package(Git QUIET)
if ("$Format:$" STREQUAL "")
# We're in a tarball; use hard-coded variables.
write_static_version_header("release")
elseif (GIT_FOUND OR Git_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/version.cpp"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
"-P" "cmake/GenVersion.cmake"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
else()
message(STATUS "WARNING: Git was not found!")
write_static_version_header("unknown")
endif ()
add_custom_target(genversion ALL
DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2014-2018, 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.
#include <assert.h>
static_assert(1, "FAIL");
int main(int argc, char *argv[]) {
return 0;
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2018, The Monero Project
#
# All rights reserved.
#
@@ -26,5 +26,10 @@
# 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.
add_subdirectory(otshell_utils)
# warnings are cleared only for GCC on Linux
if (NOT (MINGW OR APPLE OR FREEBSD OR OPENBSD OR DRAGONFLY))
add_compile_options("${WARNINGS_AS_ERRORS_FLAG}") # applies only to targets that follow
endif()
add_subdirectory(epee)

View File

@@ -0,0 +1,30 @@
# Copyright (c) 2014-2018, 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.
add_subdirectory(src)

View File

@@ -1,217 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#include "stdafx.h"
#include "console_handler.h"
#include "demo_http_server.h"
#include "net/http_client.h"
#include "storages/http_abstract_invoke.h"
template<class t_request, class t_response>
bool communicate(const std::string url, t_request& req, t_response& rsp, const std::string& ip, const std::string& port, bool use_json, bool use_jrpc = false)
{
epee::net_utils::http::http_simple_client http_client;
bool r = http_client.connect(ip, port, 1000);
CHECK_AND_ASSERT_MES(r, false, "failed to connect");
if(use_json)
{
if(use_jrpc)
{
epee::json_rpc::request<t_request> req_t = AUTO_VAL_INIT(req_t);
req_t.jsonrpc = "2.0";
req_t.id = epee::serialization::storage_entry(10);
req_t.method = "command_example_1";
req_t.params = req;
epee::json_rpc::response<t_response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
if(!epee::net_utils::invoke_http_json_remote_command2("/request_json_rpc", req_t, resp_t, http_client))
{
return false;
}
rsp = resp_t.result;
return true;
}else
return epee::net_utils::invoke_http_json_remote_command2(url, req, rsp, http_client);
}
else
return epee::net_utils::invoke_http_bin_remote_command2(url, req, rsp, http_client);
}
int main(int argc, char* argv[])
{
TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
//set up logging options
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
log_space::log_singletone::add_logger(LOGGER_FILE,
log_space::log_singletone::get_default_log_file().c_str(),
log_space::log_singletone::get_default_log_folder().c_str());
LOG_PRINT("Demo server starting ...", LOG_LEVEL_0);
demo::demo_http_server srv;
start_default_console(&srv, "#");
std::string bind_param = "0.0.0.0";
std::string port = "83";
if(!srv.init(port, bind_param))
{
LOG_ERROR("Failed to initialize srv!");
return 1;
}
//log loop
srv.run();
size_t count = 0;
while (!srv.is_stop())
{
demo::COMMAND_EXAMPLE_1::request req;
req.sub = demo::get_test_data();
demo::COMMAND_EXAMPLE_1::response rsp;
bool r = false;
if(count%2)
{//invoke json
r = communicate("/request_api_json_1", req, rsp, "127.0.0.1", port, true, true);
}else{
r = communicate("/request_api_bin_1", req, rsp, "127.0.0.1", port, false);
}
CHECK_AND_ASSERT_MES(r, false, "failed to invoke http request");
CHECK_AND_ASSERT_MES(rsp.m_success, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.size()==1, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.front() == demo::get_test_data(), false, "wrong response");
//misc_utils::sleep_no_w(1000);
++count;
}
bool r = srv.wait_stop();
CHECK_AND_ASSERT_MES(r, 1, "failed to wait server stop");
srv.deinit();
LOG_PRINT("Demo server stoped.", LOG_LEVEL_0);
return 1;
CATCH_ENTRY_L0("main", 1);
}
/************************************************************************/
/* */
/************************************************************************/
namespace demo
{
bool demo_http_server::init(const std::string& bind_port, const std::string& bind_ip)
{
//set self as callback handler
m_net_server.get_config_object().m_phandler = this;
//here set folder for hosting reqests
m_net_server.get_config_object().m_folder = "";
LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port);
return m_net_server.init_server(bind_port, bind_ip);
}
bool demo_http_server::run()
{
m_stop = false;
//here you can set worker threads count
int thrds_count = 4;
//go to loop
LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...", LOG_LEVEL_0);
if(!m_net_server.run_server(thrds_count, false))
{
LOG_ERROR("Failed to run net tcp server!");
}
return true;
}
bool demo_http_server::deinit()
{
return m_net_server.deinit_server();
}
bool demo_http_server::send_stop_signal()
{
m_stop = true;
m_net_server.send_stop_signal();
return true;
}
bool demo_http_server::on_requestr_uri_1(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context)
{
return true;
}
bool demo_http_server::on_requestr_uri_2(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context)
{
return true;
}
bool demo_http_server::on_hosting_request( const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context)
{
//read file from filesystem here
return true;
}
bool demo_http_server::on_request_api_1(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, connection_context& ctxt)
{
CHECK_AND_ASSERT_MES(req.sub == demo::get_test_data(), false, "wrong request");
res.m_success = true;
res.subs.push_back(req.sub);
return true;
}
bool demo_http_server::on_request_api_1_with_error(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, epee::json_rpc::error& error_resp, connection_context& ctxt)
{
error_resp.code = 232432;
error_resp.message = "bla bla bla";
return false;
}
bool demo_http_server::on_request_api_2(const COMMAND_EXAMPLE_2::request& req, COMMAND_EXAMPLE_2::response& res, connection_context& ctxt)
{
return true;
}
}

View File

@@ -1,103 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#pragma once
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include "net/http_server_cp2.h"
#include "transport_defs.h"
#include "net/http_server_handlers_map2.h"
using namespace epee;
namespace demo
{
class demo_http_server: public net_utils::http::i_http_server_handler<epee::net_utils::connection_context_base>
{
public:
typedef epee::net_utils::connection_context_base connection_context;
demo_http_server():m_stop(false){}
bool run();
bool init(const std::string& bind_port = "11112", const std::string& bind_ip = "0.0.0.0");
bool deinit();
bool send_stop_signal();
bool is_stop(){return m_stop;}
bool wait_stop(){return m_net_server.timed_wait_server_stop(100000);}
private:
CHAIN_HTTP_TO_MAP2(connection_context); //forward http requests to uri map
BEGIN_URI_MAP2()
MAP_URI2("/requestr_uri_1", on_requestr_uri_1)
MAP_URI2("/requestr_uri_2", on_requestr_uri_1)
//MAP_URI_AUTO_XML2("/request_api_xml_1", on_request_api_1, COMMAND_EXAMPLE_1)
//MAP_URI_AUTO_XML2("/request_api_xml_2", on_request_api_2, COMMAND_EXAMPLE_2)
MAP_URI_AUTO_JON2("/request_api_json_1", on_request_api_1, COMMAND_EXAMPLE_1)
MAP_URI_AUTO_JON2("/request_api_json_2", on_request_api_2, COMMAND_EXAMPLE_2)
MAP_URI_AUTO_BIN2("/request_api_bin_1", on_request_api_1, COMMAND_EXAMPLE_1)
MAP_URI_AUTO_BIN2("/request_api_bin_2", on_request_api_2, COMMAND_EXAMPLE_2)
BEGIN_JSON_RPC_MAP("/request_json_rpc")
MAP_JON_RPC("command_example_1", on_request_api_1, COMMAND_EXAMPLE_1)
MAP_JON_RPC("command_example_2", on_request_api_2, COMMAND_EXAMPLE_2)
MAP_JON_RPC_WE("command_example_1_we", on_request_api_1_with_error, COMMAND_EXAMPLE_1)
END_JSON_RPC_MAP()
CHAIN_URI_MAP2(on_hosting_request)
END_URI_MAP2()
bool on_requestr_uri_1(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context);
bool on_requestr_uri_2(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context);
bool on_hosting_request( const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context);
bool on_request_api_1(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, connection_context& ctxt);
bool on_request_api_2(const COMMAND_EXAMPLE_2::request& req, COMMAND_EXAMPLE_2::response& res, connection_context& ctxt);
bool on_request_api_1_with_error(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, epee::json_rpc::error& error_resp, connection_context& ctxt);
net_utils::boosted_http_server_custum_handling m_net_server;
std::atomic<bool> m_stop;
};
}

View File

@@ -1,200 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#include "stdafx.h"
#include "demo_levin_server.h"
#include "console_handler.h"
template<class t_request>
bool communicate(net_utils::boosted_levin_async_server& transport, int id, t_request& req, const std::string& ip, const std::string& port, bool use_async)
{
if(use_async)
{
//IMPORTANT: do not pass local parameters from stack by reference! connect_async returns immediately, and callback will call in any thread later
transport.connect_async(ip, port, 10000, [&transport, id, req, ip, port](net_utils::connection_context_base& ctx, const boost::system::error_code& ec_)
{
if(!!ec_)
{
LOG_ERROR("Failed to connect to " << ip << ":" << port);
}else
{//connected ok!
epee::net_utils::async_invoke_remote_command2<demo::COMMAND_EXAMPLE_1::response>(ctx.m_connection_id, id, req, transport.get_config_object(), [&transport, ip, port](int res_code, demo::COMMAND_EXAMPLE_1::response& rsp, net_utils::connection_context_base& ctx)
{
if(res_code < 0)
{
LOG_ERROR("Failed to invoke to " << ip << ":" << port);
}else
{//invoked ok
CHECK_AND_ASSERT_MES(rsp.m_success, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.size()==1, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.front() == demo::get_test_data(), false, "wrong response");
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 async invoked ok", LOG_LEVEL_0);
}
transport.get_config_object().close(ctx.m_connection_id);
return true;
});
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 async invoke requested", LOG_LEVEL_0);
}
});
}else
{
net_utils::connection_context_base ctx = AUTO_VAL_INIT(ctx);
bool r = transport.connect(ip, port, 10000, ctx);
CHECK_AND_ASSERT_MES(r, false, "failed to connect to " << ip << ":" << port);
demo::COMMAND_EXAMPLE_1::response rsp = AUTO_VAL_INIT(rsp);
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 sync invoke requested", LOG_LEVEL_0);
r = epee::net_utils::invoke_remote_command2(ctx.m_connection_id, id, req, rsp, transport.get_config_object());
CHECK_AND_ASSERT_MES(r, false, "failed to invoke levin request");
CHECK_AND_ASSERT_MES(rsp.m_success, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.size()==1, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.front() == demo::get_test_data(), false, "wrong response");
transport.get_config_object().close(ctx.m_connection_id);
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 sync invoked ok", LOG_LEVEL_0);
}
return true;
}
int main(int argc, char* argv[])
{
TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
//set up logging options
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
log_space::log_singletone::add_logger(LOGGER_FILE,
log_space::log_singletone::get_default_log_file().c_str(),
log_space::log_singletone::get_default_log_folder().c_str());
LOG_PRINT("Demo server starting ...", LOG_LEVEL_0);
demo::demo_levin_server srv;
start_default_console(&srv, "#");
std::string bind_param = "0.0.0.0";
std::string port = "12345";
if(!srv.init(port, bind_param))
{
LOG_ERROR("Failed to initialize srv!");
return 1;
}
srv.run();
size_t c = 1;
while (!srv.is_stop())
{
demo::COMMAND_EXAMPLE_1::request req;
req.sub = demo::get_test_data();
bool r = communicate(srv.get_server(), demo::COMMAND_EXAMPLE_1::ID, req, "127.0.0.1", port, (c%2 == 0));
misc_utils::sleep_no_w(1000);
++c;
}
bool r = srv.wait_stop();
CHECK_AND_ASSERT_MES(r, 1, "failed to wait server stop");
srv.deinit();
LOG_PRINT("Demo server stoped.", LOG_LEVEL_0);
return 1;
CATCH_ENTRY_L0("main", 1);
}
/************************************************************************/
/* */
/************************************************************************/
namespace demo
{
bool demo_levin_server::init(const std::string& bind_port, const std::string& bind_ip)
{
m_net_server.get_config_object().m_pcommands_handler = this;
LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port);
return m_net_server.init_server(bind_port, bind_ip);
}
bool demo_levin_server::run()
{
m_stop = false;
//here you can set worker threads count
int thrds_count = 4;
m_net_server.get_config_object().m_invoke_timeout = 10000;
m_net_server.get_config_object().m_pcommands_handler = this;
//go to loop
LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...", LOG_LEVEL_0);
if(!m_net_server.run_server(thrds_count, false))
{
LOG_ERROR("Failed to run net tcp server!");
}
LOG_PRINT("net_service loop stopped.", LOG_LEVEL_0);
return true;
}
bool demo_levin_server::deinit()
{
return m_net_server.deinit_server();
}
bool demo_levin_server::send_stop_signal()
{
m_net_server.send_stop_signal();
return true;
}
int demo_levin_server::handle_command_1(int command, COMMAND_EXAMPLE_1::request& arg, COMMAND_EXAMPLE_1::response& rsp, const net_utils::connection_context_base& context)
{
CHECK_AND_ASSERT_MES(arg.sub == demo::get_test_data(), false, "wrong request");
rsp.m_success = true;
rsp.subs.push_back(arg.sub);
LOG_PRINT_GREEN("Server COMMAND_EXAMPLE_1 ok", LOG_LEVEL_0);
return 1;
}
int demo_levin_server::handle_command_2(int command, COMMAND_EXAMPLE_2::request& arg, COMMAND_EXAMPLE_2::response& rsp, const net_utils::connection_context_base& context)
{
return 1;
}
int demo_levin_server::handle_notify_1(int command, COMMAND_EXAMPLE_1::request& arg, const net_utils::connection_context_base& context)
{
return 1;
}
int demo_levin_server::handle_notify_2(int command, COMMAND_EXAMPLE_2::request& arg, const net_utils::connection_context_base& context)
{
return 1;
}
}

View File

@@ -1,76 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#pragma once
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include "net/levin_server_cp2.h"
#include "transport_defs.h"
#include "storages/levin_abstract_invoke2.h"
using namespace epee;
namespace demo
{
class demo_levin_server: public levin::levin_commands_handler<>
{
public:
bool run();
bool init(const std::string& bind_port = "11112", const std::string& bind_ip = "0.0.0.0");
bool deinit();
bool send_stop_signal();
bool is_stop(){return m_stop;}
bool wait_stop(){return m_net_server.timed_wait_server_stop(100000);}
net_utils::boosted_levin_async_server& get_server(){return m_net_server;}
private:
CHAIN_LEVIN_INVOKE_MAP(); //move levin_commands_handler interface invoke(...) callbacks into invoke map
CHAIN_LEVIN_NOTIFY_STUB(); //move levin_commands_handler interface notify(...) callbacks into nothing
BEGIN_INVOKE_MAP2(demo_levin_server)
HANDLE_INVOKE_T2(COMMAND_EXAMPLE_1, &demo_levin_server::handle_command_1)
HANDLE_INVOKE_T2(COMMAND_EXAMPLE_2, &demo_levin_server::handle_command_2)
HANDLE_NOTIFY_T2(COMMAND_EXAMPLE_1, &demo_levin_server::handle_notify_1)
HANDLE_NOTIFY_T2(COMMAND_EXAMPLE_2, &demo_levin_server::handle_notify_2)
END_INVOKE_MAP2()
//----------------- commands handlers ----------------------------------------------
int handle_command_1(int command, COMMAND_EXAMPLE_1::request& arg, COMMAND_EXAMPLE_1::response& rsp, const net_utils::connection_context_base& context);
int handle_command_2(int command, COMMAND_EXAMPLE_2::request& arg, COMMAND_EXAMPLE_2::response& rsp, const net_utils::connection_context_base& context);
int handle_notify_1(int command, COMMAND_EXAMPLE_1::request& arg, const net_utils::connection_context_base& context);
int handle_notify_2(int command, COMMAND_EXAMPLE_2::request& arg, const net_utils::connection_context_base& context);
//----------------------------------------------------------------------------------
net_utils::boosted_levin_async_server m_net_server;
std::atomic<bool> m_stop;
};
}

View File

@@ -27,6 +27,7 @@
#pragma once
#include "misc_log_ex.h"
#include "string_tools.h"
#include <atomic>
#include <condition_variable>
#include <functional>
@@ -37,6 +38,12 @@
#include <stdio.h>
#endif
#include <boost/thread.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#ifdef HAVE_READLINE
#include "readline_buffer.h"
#endif
namespace epee
{
@@ -48,6 +55,9 @@ namespace epee
, m_has_read_request(false)
, m_read_status(state_init)
{
#ifdef HAVE_READLINE
m_readline_buffer.start();
#endif
m_reader_thread = boost::thread(std::bind(&async_stdin_reader::reader_thread_func, this));
}
@@ -56,6 +66,13 @@ namespace epee
stop();
}
#ifdef HAVE_READLINE
rdln::readline_buffer& get_readline_buffer()
{
return m_readline_buffer;
}
#endif
// Not thread safe. Only one thread can call this method at once.
bool get_line(std::string& line)
{
@@ -98,6 +115,9 @@ namespace epee
m_request_cv.notify_one();
m_reader_thread.join();
#ifdef HAVE_READLINE
m_readline_buffer.stop();
#endif
}
}
@@ -133,7 +153,7 @@ namespace epee
bool wait_stdin_data()
{
#if !defined(WIN32)
#ifdef __OpenBSD__
#if defined(__OpenBSD__) || defined(__ANDROID__)
int stdin_fileno = fileno(stdin);
#else
int stdin_fileno = ::fileno(stdin);
@@ -183,11 +203,23 @@ namespace epee
std::string line;
bool read_ok = true;
#ifdef HAVE_READLINE
reread:
#endif
if (wait_stdin_data())
{
if (m_run.load(std::memory_order_relaxed))
{
#ifdef HAVE_READLINE
switch (m_readline_buffer.get_line(line))
{
case rdln::empty: goto eof;
case rdln::partial: goto reread;
case rdln::full: break;
}
#else
std::getline(std::cin, line);
#endif
read_ok = !std::cin.eof() && !std::cin.fail();
}
}
@@ -196,6 +228,9 @@ namespace epee
read_ok = false;
}
if (std::cin.eof()) {
#ifdef HAVE_READLINE
eof:
#endif
m_read_status = state_eos;
m_response_cv.notify_one();
break;
@@ -229,6 +264,9 @@ namespace epee
private:
boost::thread m_reader_thread;
std::atomic<bool> m_run;
#ifdef HAVE_READLINE
rdln::readline_buffer m_readline_buffer;
#endif
std::string m_line;
bool m_has_read_request;
@@ -256,13 +294,13 @@ namespace epee
}
template<class t_server, class chain_handler>
bool run(t_server* psrv, chain_handler ch_handler, const std::string& prompt = "#", const std::string& usage = "")
bool run(t_server* psrv, chain_handler ch_handler, std::function<std::string(void)> prompt, const std::string& usage = "")
{
return run(prompt, usage, [&](const std::string& cmd) { return ch_handler(psrv, cmd); }, [&] { psrv->send_stop_signal(); });
}
template<class chain_handler>
bool run(chain_handler ch_handler, const std::string& prompt = "#", const std::string& usage = "", std::function<void(void)> exit_handler = NULL)
bool run(chain_handler ch_handler, std::function<std::string(void)> prompt, const std::string& usage = "", std::function<void(void)> exit_handler = NULL)
{
return run(prompt, usage, [&](const std::string& cmd) { return ch_handler(cmd); }, exit_handler);
}
@@ -275,20 +313,29 @@ namespace epee
void print_prompt()
{
if (!m_prompt.empty())
std::string prompt = m_prompt();
if (!prompt.empty())
{
epee::log_space::set_console_color(epee::log_space::console_color_yellow, true);
std::cout << m_prompt;
if (' ' != m_prompt.back())
#ifdef HAVE_READLINE
std::string color_prompt = "\001\033[1;33m\002" + prompt;
if (' ' != prompt.back())
color_prompt += " ";
color_prompt += "\001\033[0m\002";
m_stdin_reader.get_readline_buffer().set_prompt(color_prompt);
#else
epee::set_console_color(epee::console_color_yellow, true);
std::cout << prompt;
if (' ' != prompt.back())
std::cout << ' ';
epee::log_space::reset_console_color();
epee::reset_console_color();
std::cout.flush();
#endif
}
}
private:
template<typename t_cmd_handler>
bool run(const std::string& prompt, const std::string& usage, const t_cmd_handler& cmd_handler, std::function<void(void)> exit_handler)
bool run(std::function<std::string(void)> prompt, const std::string& usage, const t_cmd_handler& cmd_handler, std::function<void(void)> exit_handler)
{
bool continue_handle = true;
m_prompt = prompt;
@@ -310,7 +357,7 @@ namespace epee
}
if (!get_line_ret)
{
LOG_PRINT("Failed to read line.", LOG_LEVEL_0);
MERROR("Failed to read line.");
}
string_tools::trim(command);
@@ -329,6 +376,9 @@ namespace epee
}
else
{
#ifdef HAVE_READLINE
rdln::suspend_readline pause_readline;
#endif
std::cout << "unknown command: " << command << std::endl;
std::cout << usage;
}
@@ -346,18 +396,24 @@ namespace epee
private:
async_stdin_reader m_stdin_reader;
std::atomic<bool> m_running = {true};
std::string m_prompt;
std::function<std::string(void)> m_prompt;
};
template<class t_server, class t_handler>
bool start_default_console(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
bool start_default_console(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{
std::shared_ptr<async_console_handler> console_handler = std::make_shared<async_console_handler>();
boost::thread([=](){console_handler->run<t_server, t_handler>(ptsrv, handlr, prompt, usage);}).detach();
return true;
}
template<class t_server, class t_handler>
bool start_default_console(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
{
return start_default_console(ptsrv, handlr, [prompt](){ return prompt; }, usage);
}
template<class t_server>
bool start_default_console(t_server* ptsrv, const std::string& prompt, const std::string& usage = "")
{
@@ -371,19 +427,31 @@ namespace epee
}
template<class t_server, class t_handler>
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{
async_console_handler console_handler;
return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage);
}
template<class t_server, class t_handler>
bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
{
return run_default_console_handler_no_srv_param(ptsrv, handlr, [prompt](){return prompt;},usage);
}
template<class t_server, class t_handler>
bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{
boost::thread( boost::bind(run_default_console_handler_no_srv_param<t_server, t_handler>, ptsrv, handlr, prompt, usage) );
return true;
}
template<class t_server, class t_handler>
bool start_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, const std::string& prompt, const std::string& usage = "")
{
return start_default_console_handler_no_srv_param(ptsrv, handlr, [prompt](){return prompt;}, usage);
}
/*template<class a>
bool f(int i, a l)
{
@@ -409,29 +477,38 @@ namespace epee
class command_handler {
public:
typedef boost::function<bool (const std::vector<std::string> &)> callback;
typedef std::map<std::string, std::pair<callback, std::string> > lookup;
typedef std::map<std::string, std::pair<callback, std::pair<std::string, std::string>>> lookup;
std::string get_usage()
{
std::stringstream ss;
size_t max_command_len = 0;
for(auto& x:m_command_handlers)
if(x.first.size() > max_command_len)
max_command_len = x.first.size();
for(auto& x:m_command_handlers)
{
ss.width(max_command_len + 3);
ss << std::left << x.first << x.second.second << ENDL;
ss << x.second.second.first << ENDL;
}
return ss.str();
}
void set_handler(const std::string& cmd, const callback& hndlr, const std::string& usage = "")
std::pair<std::string, std::string> get_documentation(const std::vector<std::string>& cmd)
{
if(cmd.empty())
return std::make_pair("", "");
auto it = m_command_handlers.find(cmd.front());
if(it == m_command_handlers.end())
return std::make_pair("", "");
return it->second.second;
}
void set_handler(const std::string& cmd, const callback& hndlr, const std::string& usage = "", const std::string& description = "")
{
lookup::mapped_type & vt = m_command_handlers[cmd];
vt.first = hndlr;
vt.second = usage;
vt.second.first = description.empty() ? cmd : usage;
vt.second.second = description.empty() ? usage : description;
#ifdef HAVE_READLINE
rdln::readline_buffer::add_completion(cmd);
#endif
}
bool process_command_vec(const std::vector<std::string>& cmd)
@@ -465,19 +542,23 @@ namespace epee
std::unique_ptr<boost::thread> m_console_thread;
async_console_handler m_console_handler;
public:
bool start_handling(const std::string& prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
bool start_handling(std::function<std::string(void)> prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
{
m_console_thread.reset(new boost::thread(boost::bind(&console_handlers_binder::run_handling, this, prompt, usage_string, exit_handler)));
m_console_thread->detach();
return true;
}
bool start_handling(const std::string &prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
{
return start_handling([prompt](){ return prompt; }, usage_string, exit_handler);
}
void stop_handling()
{
m_console_handler.stop();
}
bool run_handling(const std::string& prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
{
return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string, exit_handler);
}

View File

@@ -35,6 +35,8 @@ namespace epee
public:
copyable_atomic()
{};
copyable_atomic(uint32_t value)
{ store(value); }
copyable_atomic(const copyable_atomic& a):std::atomic<uint32_t>(a.load())
{}
copyable_atomic& operator= (const copyable_atomic& a)

View File

@@ -28,197 +28,40 @@
#ifndef _FILE_IO_UTILS_H_
#define _FILE_IO_UTILS_H_
//#include <sys/types.h>
//#include <sys/stat.h>
#include <iostream>
#include <boost/filesystem.hpp>
#ifndef MAKE64
#define MAKE64(low,high) ((__int64)(((DWORD)(low)) | ((__int64)((DWORD)(high))) << 32))
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#ifdef WIN32
#include <windows.h>
#include "string_tools.h"
#endif
#ifdef WINDOWS_PLATFORM
#include <psapi.h>
#include <strsafe.h>
#include <string.h>
#include <mbstring.h>
// On Windows there is a problem with non-ASCII characters in path and file names
// as far as support by the standard components used is concerned:
#endif
// The various file stream classes, e.g. std::ifstream and std::ofstream, are
// part of the GNU C++ Library / libstdc++. On the most basic level they use the
// fopen() call as defined / made accessible to programs compiled within MSYS2
// by the stdio.h header file maintained by the MinGW project.
// The critical point: The implementation of fopen() is part of MSVCRT, the
// Microsoft Visual C/C++ Runtime Library, and this method does NOT offer any
// Unicode support.
// Monero code that would want to continue to use the normal file stream classes
// but WITH Unicode support could therefore not solve this problem on its own,
// but 2 different projects from 2 different maintaining groups would need changes
// in this particular direction - something probably difficult to achieve and
// with a long time to wait until all new versions / releases arrive.
// Implemented solution approach: Circumvent the problem by stopping to use std
// file stream classes on Windows and directly use Unicode-capable WIN32 API
// calls. Most of the code doing so is concentrated in this header file here.
namespace epee
{
namespace file_io_utils
{
#ifdef WINDOWS_PLATFORM
inline
std::string get_temp_file_name_a()
{
std::string str_result;
char sz_temp[MAX_PATH*2] = {0};
if(!::GetTempPathA( sizeof( sz_temp ), sz_temp ))
return str_result;
char sz_temp_file[MAX_PATH*2] = {0};
if(!::GetTempFileNameA( sz_temp, "mail", 0, sz_temp_file))
return str_result;
sz_temp_file[sizeof(sz_temp_file)-1] = 0; //be happy!
str_result = sz_temp_file;
return str_result;
}
#ifdef BOOST_LEXICAL_CAST_INCLUDED
inline
bool get_not_used_filename(const std::string& folder, OUT std::string& result_name)
{
DWORD folder_attr = ::GetFileAttributesA(folder.c_str());
if(folder_attr == INVALID_FILE_ATTRIBUTES)
return false;
if(!(folder_attr&FILE_ATTRIBUTE_DIRECTORY))
return false;
std::string base_name = folder + "\\tmp";
std::string tmp_name;
bool name_found = false;
int current_index = 0;
tmp_name = base_name + boost::lexical_cast<std::string>(current_index) + ".tmp";
while(!name_found)
{
if(INVALID_FILE_ATTRIBUTES == ::GetFileAttributesA(tmp_name.c_str()))
name_found = true;
else
{
current_index++;
tmp_name = base_name + boost::lexical_cast<std::string>(current_index) + ".tmp";
}
}
result_name = tmp_name;
return true;
}
#endif
inline
std::string get_temp_folder_a()
{
std::string str_result;
char sz_temp[MAX_PATH*2] = {0};
if(!::GetTempPathA( sizeof( sz_temp ), sz_temp ))
return str_result;
sz_temp[(sizeof(sz_temp)/sizeof(sz_temp[0])) -1] = 0;
str_result = sz_temp;
return str_result;
}
std::string convert_from_device_path_to_standart(const std::string& path)
{
STRSAFE_LPSTR pszFilename = (STRSAFE_LPSTR)path.c_str();
// Translate path with device name to drive letters.
char szTemp[4000] = {0};
if (::GetLogicalDriveStringsA(sizeof(szTemp)-1, szTemp))
{
char szName[MAX_PATH];
char szDrive[3] = " :";
BOOL bFound = FALSE;
char* p = szTemp;
do
{
// Copy the drive letter to the template string
*szDrive = *p;
// Look up each device name
if (::QueryDosDeviceA(szDrive, szName, sizeof(szName)))
{
UINT uNameLen = strlen(szName);
if (uNameLen < MAX_PATH)
{
bFound = _mbsnbicmp((const unsigned char*)pszFilename, (const unsigned char*)szName,
uNameLen) == 0;
if (bFound)
{
// Reconstruct pszFilename using szTempFile
// Replace device path with DOS path
char szTempFile[MAX_PATH] = {0};
StringCchPrintfA(szTempFile,
MAX_PATH,
"%s%s",
szDrive,
pszFilename+uNameLen);
return szTempFile;
//::StringCchCopyNA(pszFilename, MAX_PATH+1, szTempFile, strlen(szTempFile));
}
}
}
// Go to the next NULL character.
while (*p++);
} while (!bFound && *p); // end of string
}
return "";
}
inline
std::string get_process_path_by_pid(DWORD pid)
{
std::string res;
HANDLE hprocess = 0;
if( hprocess = ::OpenProcess( PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, pid) )
{
char buff[MAX_PATH]= {0};
if(!::GetModuleFileNameExA( hprocess, 0, buff, MAX_PATH - 1 ))
res = "Unknown_b";
else
{
buff[MAX_PATH - 1]=0; //be happy!
res = buff;
std::string::size_type a = res.rfind( '\\' );
if ( a != std::string::npos )
res.erase( 0, a+1);
}
::CloseHandle( hprocess );
}else
res = "Unknown_a";
return res;
}
inline
std::wstring get_temp_file_name_w()
{
std::wstring str_result;
wchar_t sz_temp[MAX_PATH*2] = {0};
if(!::GetTempPathW( sizeof(sz_temp)/sizeof(sz_temp[0]), sz_temp ))
return str_result;
wchar_t sz_temp_file[MAX_PATH+1] = {0};
if(!::GetTempFileNameW( sz_temp, L"mail", 0, sz_temp_file))
return str_result;
sz_temp_file[(sizeof(sz_temp_file)/sizeof(sz_temp_file[0]))-1] = 0; //be happy!
str_result = sz_temp_file;
return str_result;
}
#endif
inline
bool is_file_exist(const std::string& path)
{
@@ -226,39 +69,23 @@ namespace file_io_utils
return boost::filesystem::exists(p);
}
/*
inline
bool save_string_to_handle(HANDLE hfile, const std::string& str)
{
if( INVALID_HANDLE_VALUE != hfile )
{
DWORD dw;
if( !::WriteFile( hfile, str.data(), (DWORD) str.size(), &dw, NULL) )
{
int err_code = GetLastError();
//LOG_PRINT("Failed to write to file handle: " << hfile<< " Last error code:" << err_code << " : " << log_space::get_win32_err_descr(err_code), LOG_LEVEL_2);
return false;
}
::CloseHandle(hfile);
return true;
}else
{
//LOG_WIN32_ERROR(::GetLastError());
return false;
}
return false;
}*/
inline
bool save_string_to_file(const std::string& path_to_file, const std::string& str)
{
#ifdef WIN32
std::wstring wide_path;
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE)
return false;
DWORD bytes_written;
DWORD bytes_to_write = (DWORD)str.size();
BOOL result = WriteFile(file_handle, str.data(), bytes_to_write, &bytes_written, NULL);
CloseHandle(file_handle);
if (bytes_written != bytes_to_write)
result = FALSE;
return result;
#else
try
{
std::ofstream fstream;
@@ -273,36 +100,11 @@ namespace file_io_utils
{
return false;
}
#endif
}
/*
inline
bool load_form_handle(HANDLE hfile, std::string& str)
{
if( INVALID_HANDLE_VALUE != hfile )
{
bool res = true;
DWORD dw = 0;
DWORD fsize = ::GetFileSize(hfile, &dw);
if(fsize > 300000000)
{
::CloseHandle(hfile);
return false;
}
if(fsize)
{
str.resize(fsize);
if(!::ReadFile( hfile, (LPVOID)str.data(), (DWORD)str.size(), &dw, NULL))
res = false;
}
::CloseHandle(hfile);
return res;
}
return false;
}
*/
inline
bool get_file_time(const std::string& path_to_file, OUT time_t& ft)
bool get_file_time(const std::string& path_to_file, time_t& ft)
{
boost::system::error_code ec;
ft = boost::filesystem::last_write_time(boost::filesystem::path(path_to_file), ec);
@@ -325,8 +127,27 @@ namespace file_io_utils
inline
bool load_file_to_string(const std::string& path_to_file, std::string& target_str)
bool load_file_to_string(const std::string& path_to_file, std::string& target_str, size_t max_size = 1000000000)
{
#ifdef WIN32
std::wstring wide_path;
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE)
return false;
DWORD file_size = GetFileSize(file_handle, NULL);
if ((file_size == INVALID_FILE_SIZE) || (uint64_t)file_size > (uint64_t)max_size) {
CloseHandle(file_handle);
return false;
}
target_str.resize(file_size);
DWORD bytes_read;
BOOL result = ReadFile(file_handle, &target_str[0], file_size, &bytes_read, NULL);
CloseHandle(file_handle);
if (bytes_read != file_size)
result = FALSE;
return result;
#else
try
{
std::ifstream fstream;
@@ -335,7 +156,7 @@ namespace file_io_utils
std::ifstream::pos_type file_size = fstream.tellg();
if(file_size > 1000000000)
if((uint64_t)file_size > (uint64_t)max_size) // ensure a large domain for comparison, and negative -> too large
return false;//don't go crazy
size_t file_size_t = static_cast<size_t>(file_size);
@@ -351,11 +172,13 @@ namespace file_io_utils
{
return false;
}
#endif
}
inline
bool append_string_to_file(const std::string& path_to_file, const std::string& str)
{
// No special Windows implementation because so far not used in Monero code
try
{
std::ofstream fstream;
@@ -372,83 +195,40 @@ namespace file_io_utils
}
}
/*
bool remove_dir_and_subirs(const char* path_to_dir);
inline
bool clean_dir(const char* path_to_dir)
{
if(!path_to_dir)
return false;
std::string folder = path_to_dir;
WIN32_FIND_DATAA find_data = {0};
HANDLE hfind = ::FindFirstFileA((folder + "\\*.*").c_str(), &find_data);
if(INVALID_HANDLE_VALUE == hfind)
return false;
do{
if(!strcmp("..", find_data.cFileName) || (!strcmp(".", find_data.cFileName)))
continue;
if(find_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
{
if(!remove_dir_and_subirs((folder + "\\" + find_data.cFileName).c_str()))
return false;
}else
{
if(!::DeleteFileA((folder + "\\" + find_data.cFileName).c_str()))
return false;
}
}while(::FindNextFileA(hfind, &find_data));
::FindClose(hfind);
return true;
}
*/
#ifdef WINDOWS_PLATFORM
inline bool get_folder_content(const std::string& path, std::list<WIN32_FIND_DATAA>& OUT target_list)
{
WIN32_FIND_DATAA find_data = {0};
HANDLE hfind = ::FindFirstFileA((path + "\\*.*").c_str(), &find_data);
if(INVALID_HANDLE_VALUE == hfind)
return false;
do{
if(!strcmp("..", find_data.cFileName) || (!strcmp(".", find_data.cFileName)))
continue;
target_list.push_back(find_data);
}while(::FindNextFileA(hfind, &find_data));
::FindClose(hfind);
return true;
}
#endif
inline bool get_folder_content(const std::string& path, std::list<std::string>& OUT target_list, bool only_files = false)
inline
bool get_file_size(const std::string& path_to_file, uint64_t &size)
{
#ifdef WIN32
std::wstring wide_path;
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE)
return false;
LARGE_INTEGER file_size;
BOOL result = GetFileSizeEx(file_handle, &file_size);
CloseHandle(file_handle);
if (result) {
size = file_size.QuadPart;
}
return size;
#else
try
{
boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
for ( boost::filesystem::directory_iterator itr( path ); itr != end_itr; ++itr )
{
if ( only_files && boost::filesystem::is_directory(itr->status()) )
{
continue;
}
target_list.push_back(itr->path().filename().string());
}
std::ifstream fstream;
fstream.exceptions(std::ifstream::failbit | std::ifstream::badbit);
fstream.open(path_to_file, std::ios_base::binary | std::ios_base::in | std::ios::ate);
size = fstream.tellg();
fstream.close();
return true;
}
catch(...)
{
return false;
}
return true;
#endif
}
}
}

View File

@@ -0,0 +1,65 @@
// Copyright (c) 2017-2018, 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.
#pragma once
#include <array>
#include <cstdint>
#include <iosfwd>
#include <string>
#include "span.h"
namespace epee
{
struct to_hex
{
//! \return A std::string containing hex of `src`.
static std::string string(const span<const std::uint8_t> src);
//! \return An array containing hex of `src`.
template<std::size_t N>
static std::array<char, N * 2> array(const std::array<std::uint8_t, N>& src) noexcept
{
std::array<char, N * 2> out{{}};
static_assert(N <= 128, "keep the stack size down");
buffer_unchecked(out.data(), {src.data(), src.size()});
return out;
}
//! Append `src` as hex to `out`.
static void buffer(std::ostream& out, const span<const std::uint8_t> src);
//! Append `< + src + >` as hex to `out`.
static void formatted(std::ostream& out, const span<const std::uint8_t> src);
private:
//! Write `src` bytes as hex to `out`. `out` must be twice the length
static void buffer_unchecked(char* out, const span<const std::uint8_t> src) noexcept;
};
}

View File

@@ -37,6 +37,7 @@
#include <boost/uuid/random_generator.hpp>
#include "misc_os_dependent.h"
#include "syncobj.h"
namespace epee
{

View File

@@ -74,7 +74,7 @@ namespace md5
static void MD5Init(MD5_CTX * context);
static void MD5Update( MD5_CTX *context, const unsigned char *input, unsigned int inputLen );
static void MD5Final ( unsigned char digest[16], MD5_CTX *context );
static void hmac_md5(const unsigned char* text, int text_len, const unsigned char* key, int key_len, unsigned char *digest);
static inline void hmac_md5(const unsigned char* text, int text_len, const unsigned char* key, int key_len, unsigned char *digest);
inline bool md5( unsigned char *input, int ilen, unsigned char output[16] )

View File

@@ -58,14 +58,11 @@ These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* do i need all of this just for htonl()? damn. */
//#include <sys/types.h>
//#include <sys/param.h>
//#include <sys/socket.h>
//#include <netinet/in.h>
#ifdef _WIN32
# include <winsock2.h>
#else
# include <arpa/inet.h>
#endif
#include "md5global.h"
#include "md5_l.h"
#include "hmac-md5.h"

View File

@@ -0,0 +1,80 @@
// Copyright (c) 2017-2018, 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.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#ifdef __cplusplus
#include <array>
extern "C" {
#endif
void *memwipe(void *src, size_t n);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
namespace tools {
/// Scrubs data in the contained type upon destruction.
///
/// Primarily useful for making sure that private keys don't stick around in
/// memory after the objects that held them have gone out of scope.
template <class T>
struct scrubbed : public T {
using type = T;
~scrubbed() {
scrub();
}
/// Destroy the contents of the contained type.
void scrub() {
static_assert(std::is_pod<T>::value,
"T cannot be auto-scrubbed. T must be POD.");
static_assert(std::is_trivially_destructible<T>::value,
"T cannot be auto-scrubbed. T must be trivially destructable.");
memwipe(this, sizeof(T));
}
};
template<typename T>
T& unwrap(scrubbed<T>& src) { return src; }
template<typename T>
const T& unwrap(scrubbed<T> const& src) { return src; }
template <class T, size_t N>
using scrubbed_arr = scrubbed<std::array<T, N>>;
} // namespace tools
#endif // __cplusplus

File diff suppressed because it is too large Load Diff

View File

@@ -23,6 +23,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifdef _WIN32
#include <Winsock2.h>
#endif
#ifdef WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
@@ -42,23 +46,26 @@
#include <mach/mach.h>
#endif
#include <iostream>
#include <boost/lexical_cast.hpp>
#pragma once
namespace epee
{
namespace misc_utils
{
inline uint64_t get_tick_count()
inline uint64_t get_ns_count()
{
#if defined(_MSC_VER)
return ::GetTickCount64();
return ::GetTickCount64() * 1000000;
#elif defined(WIN32)
static LARGE_INTEGER pcfreq = {0};
LARGE_INTEGER ticks;
if (!pcfreq.QuadPart)
QueryPerformanceFrequency(&pcfreq);
QueryPerformanceCounter(&ticks);
ticks.QuadPart *= 1000; /* we want msec */
ticks.QuadPart *= 1000000000; /* we want nsec */
return ticks.QuadPart / pcfreq.QuadPart;
#elif defined(__MACH__)
clock_serv_t cclock;
@@ -68,16 +75,21 @@ namespace misc_utils
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
return (mts.tv_sec * 1000) + (mts.tv_nsec/1000000);
return ((uint64_t)mts.tv_sec * 1000000000) + (mts.tv_nsec);
#else
struct timespec ts;
if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
return 0;
}
return (ts.tv_sec * 1000) + (ts.tv_nsec/1000000);
return ((uint64_t)ts.tv_sec * 1000000000) + (ts.tv_nsec);
#endif
}
inline uint64_t get_tick_count()
{
return get_ns_count() / 1000000;
}
inline int call_sys_cmd(const std::string& cmd)
{

View File

@@ -38,6 +38,9 @@
#pragma comment(lib, "Ws2_32.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace net_utils
@@ -293,7 +296,7 @@ namespace net_utils
}
//----------------------------------------------------------------------------------------
template<class THandler>
bool abstract_tcp_server<THandler>::invoke_connection(SOCKET hnew_sock, long ip_from, int post_from)
bool abstract_tcp_server<THandler>::invoke_connection(SOCKET hnew_sock, const network_address &remote_address)
{
m_connections_lock.lock();
m_connections.push_back(thread_context());
@@ -301,9 +304,8 @@ namespace net_utils
m_connections.back().m_socket = hnew_sock;
m_connections.back().powner = this;
m_connections.back().m_self_it = --m_connections.end();
m_connections.back().m_context.m_remote_ip = ip_from;
m_connections.back().m_context.m_remote_port = post_from;
m_connections.back().m_htread = threads_helper::create_thread(ConnectionHandlerProc, &m_connections.back());
m_connections.back().m_context.m_remote_address = remote_address;
m_connections.back().m_htread = threads_helper::create_thread(ConnectionHandlerProc, &m_connections.back()); // ugh, seems very risky
return true;
}

View File

@@ -54,9 +54,11 @@
#include <boost/thread/thread.hpp>
#include "net_utils_base.h"
#include "syncobj.h"
#include "../../../../src/p2p/connection_basic.hpp"
#include "../../../../contrib/otshell_utils/utils.hpp"
#include "../../../../src/p2p/network_throttle-detail.hpp"
#include "connection_basic.hpp"
#include "network_throttle-detail.hpp"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#define ABSTRACT_SERVER_SEND_QUE_MAX_COUNT 1000
@@ -67,7 +69,7 @@ namespace net_utils
struct i_connection_filter
{
virtual bool is_remote_ip_allowed(uint32_t adress)=0;
virtual bool is_remote_host_allowed(const epee::net_utils::network_address &address)=0;
protected:
virtual ~i_connection_filter(){}
};
@@ -117,6 +119,7 @@ namespace net_utils
//----------------- i_service_endpoint ---------------------
virtual bool do_send(const void* ptr, size_t cb); ///< (see do_send from i_service_endpoint)
virtual bool do_send_chunk(const void* ptr, size_t cb); ///< will send (or queue) a part of data
virtual bool send_done();
virtual bool close();
virtual bool call_run_once_service_io();
virtual bool request_callback();
@@ -133,6 +136,14 @@ namespace net_utils
/// Handle completion of a write operation.
void handle_write(const boost::system::error_code& e, size_t cb);
/// reset connection timeout timer and callback
void reset_timer(boost::posix_time::milliseconds ms, bool add);
boost::posix_time::milliseconds get_default_timeout();
boost::posix_time::milliseconds get_timeout_from_bytes_read(size_t bytes);
/// host connection count tracking
unsigned int host_count(const std::string &host, int delta = 0);
/// Buffer for incoming data.
boost::array<char, 8192> buffer_;
//boost::array<char, 1024> buffer_;
@@ -156,6 +167,11 @@ namespace net_utils
boost::mutex m_throttle_speed_in_mutex;
boost::mutex m_throttle_speed_out_mutex;
boost::asio::deadline_timer m_timer;
bool m_local;
bool m_ready_to_close;
std::string m_host;
public:
void setRpcStation();
};
@@ -205,12 +221,18 @@ namespace net_utils
bool connect(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_connection_context& cn, const std::string& bind_ip = "0.0.0.0");
template<class t_callback>
bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_callback cb, const std::string& bind_ip = "0.0.0.0");
bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, const t_callback &cb, const std::string& bind_ip = "0.0.0.0");
typename t_protocol_handler::config_type& get_config_object(){return m_config;}
int get_binded_port(){return m_port;}
long get_connections_count() const
{
auto connections_count = (m_sock_count > 0) ? (m_sock_count - 1) : 0; // Socket count minus listening socket
return connections_count;
}
boost::asio::io_service& get_io_service(){return io_service_;}
struct idle_callback_conext_base
@@ -279,8 +301,6 @@ namespace net_utils
bool is_thread_worker();
bool cleanup_connections();
/// The io_service used to perform asynchronous operations.
std::unique_ptr<boost::asio::io_service> m_io_service_local_instance;
boost::asio::io_service& io_service_;
@@ -307,7 +327,7 @@ namespace net_utils
connection_ptr new_connection_;
boost::mutex connections_mutex;
std::deque<std::pair<boost::system_time, connection_ptr>> connections_;
std::set<connection_ptr> connections_;
}; // class <>boosted_tcp_server

View File

@@ -41,8 +41,10 @@
#include <boost/utility/value_init.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp> // TODO
#include <boost/thread/v2/thread.hpp> // TODO
#include <boost/thread/thread.hpp> // TODO
#include <boost/thread/condition_variable.hpp> // TODO
#include "misc_language.h"
#include "net/local_ip.h"
#include "pragma_comp_defs.h"
#include <sstream>
@@ -51,11 +53,12 @@
#include "../../../../src/cryptonote_core/cryptonote_core.h" // e.g. for the send_stop_signal()
#include "../../../../contrib/otshell_utils/utils.hpp"
#include "../../../../src/p2p/data_logger.hpp"
using namespace nOT::nUtils; // TODO
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#define CONNECTION_CLEANUP_TIME 30 // seconds
#define DEFAULT_TIMEOUT_MS_LOCAL 1800000 // 30 minutes
#define DEFAULT_TIMEOUT_MS_REMOTE 300000 // 5 minutes
#define TIMEOUT_EXTRA_MS_PER_BYTE 0.2
PRAGMA_WARNING_PUSH
namespace epee
@@ -81,9 +84,12 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_pfilter( pfilter ),
m_connection_type( connection_type ),
m_throttle_speed_in("speed_in", "throttle_speed_in"),
m_throttle_speed_out("speed_out", "throttle_speed_out")
m_throttle_speed_out("speed_out", "throttle_speed_out"),
m_timer(io_service),
m_local(false),
m_ready_to_close(false)
{
_info_c("net/sleepRPC", "test, connection constructor set m_connection_type="<<m_connection_type);
MDEBUG("test, connection constructor set m_connection_type="<<m_connection_type);
}
PRAGMA_WARNING_DISABLE_VS(4355)
//---------------------------------------------------------------------------------
@@ -134,32 +140,39 @@ PRAGMA_WARNING_DISABLE_VS(4355)
boost::system::error_code ec;
auto remote_ep = socket_.remote_endpoint(ec);
CHECK_AND_NO_ASSERT_MES(!ec, false, "Failed to get remote endpoint: " << ec.message() << ':' << ec.value());
CHECK_AND_NO_ASSERT_MES(remote_ep.address().is_v4(), false, "IPv6 not supported here");
auto local_ep = socket_.local_endpoint(ec);
CHECK_AND_NO_ASSERT_MES(!ec, false, "Failed to get local endpoint: " << ec.message() << ':' << ec.value());
context = boost::value_initialized<t_connection_context>();
long ip_ = boost::asio::detail::socket_ops::host_to_network_long(remote_ep.address().to_v4().to_ulong());
const unsigned long ip_{boost::asio::detail::socket_ops::host_to_network_long(remote_ep.address().to_v4().to_ulong())};
m_local = epee::net_utils::is_ip_loopback(ip_) || epee::net_utils::is_ip_local(ip_);
// create a random uuid
boost::uuids::uuid random_uuid;
// that stuff turns out to be included, even though it's from src... Taking advantage
random_uuid = crypto::rand<boost::uuids::uuid>();
context.set_details(random_uuid, ip_, remote_ep.port(), is_income);
context.set_details(random_uuid, epee::net_utils::ipv4_network_address(ip_, remote_ep.port()), is_income);
_dbg3("[sock " << socket_.native_handle() << "] new connection from " << print_connection_context_short(context) <<
" to " << local_ep.address().to_string() << ':' << local_ep.port() <<
", total sockets objects " << m_ref_sock_count);
if(m_pfilter && !m_pfilter->is_remote_ip_allowed(context.m_remote_ip))
if(m_pfilter && !m_pfilter->is_remote_host_allowed(context.m_remote_address))
{
_dbg2("[sock " << socket_.native_handle() << "] ip denied " << string_tools::get_ip_string_from_int32(context.m_remote_ip) << ", shutdowning connection");
_dbg2("[sock " << socket_.native_handle() << "] host denied " << context.m_remote_address.host_str() << ", shutdowning connection");
close();
return false;
}
m_host = context.m_remote_address.host_str();
try { host_count(m_host, 1); } catch(...) { /* ignore */ }
m_protocol_handler.after_init_connection();
reset_timer(get_default_timeout(), false);
socket_.async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_read, self,
@@ -209,14 +222,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
bool connection<t_protocol_handler>::add_ref()
{
TRY_ENTRY();
//_dbg3("[sock " << socket_.native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
CRITICAL_REGION_LOCAL(m_self_refs_lock);
//_dbg3("[sock " << socket_.native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
// Use safe_shared_from_this, because of this is public method and it can be called on the object being deleted
auto self = safe_shared_from_this();
if(!self)
return false;
//_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_self_refs.push_back(self);
@@ -229,7 +242,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
TRY_ENTRY();
boost::shared_ptr<connection<t_protocol_handler> > back_connection_copy;
LOG_PRINT_L4("[sock " << socket_.native_handle() << "] release");
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] release");
CRITICAL_REGION_BEGIN(m_self_refs_lock);
CHECK_AND_ASSERT_MES(m_self_refs.size(), false, "[sock " << socket_.native_handle() << "] m_self_refs empty at connection<t_protocol_handler>::release() call");
//erasing from container without additional copy can cause start deleting object, including m_self_refs
@@ -266,8 +279,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
address = endpoint.address().to_string();
port = boost::lexical_cast<std::string>(endpoint.port());
}
_mark_c("net/kind" ,
" connection type " << to_string( m_connection_type ) << " "
MDEBUG(" connection type " << to_string( m_connection_type ) << " "
<< socket_.local_endpoint().address().to_string() << ":" << socket_.local_endpoint().port()
<< " <--> " << address << ":" << port);
}
@@ -289,7 +301,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::network_throttle_manager::m_lock_get_global_throttle_in );
epee::net_utils::network_throttle_manager::network_throttle_manager::get_global_throttle_in().handle_trafic_exact(bytes_transferred * 1024);
epee::net_utils::network_throttle_manager::network_throttle_manager::get_global_throttle_in().handle_trafic_exact(bytes_transferred);
}
double delay=0; // will be calculated - how much we should sleep to obey speed limit etc
@@ -300,13 +312,13 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
{ //_scope_dbg1("CRITICAL_REGION_LOCAL");
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_in );
delay = epee::net_utils::network_throttle_manager::get_global_throttle_in().get_sleep_time_after_tick( bytes_transferred ); // decission from global throttle
delay = epee::net_utils::network_throttle_manager::get_global_throttle_in().get_sleep_time_after_tick( bytes_transferred );
}
delay *= 0.5;
if (delay > 0) {
long int ms = (long int)(delay * 100);
epee::net_utils::data_logger::get_instance().add_data("sleep_down", ms);
reset_timer(boost::posix_time::milliseconds(ms + 1), true);
boost::this_thread::sleep_for(boost::chrono::milliseconds(ms));
}
} while(delay > 0);
@@ -316,6 +328,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
logger_handle_net_read(bytes_transferred);
context.m_last_recv = time(NULL);
context.m_recv_cnt += bytes_transferred;
m_ready_to_close = false;
bool recv_res = m_protocol_handler.handle_recv(buffer_.data(), bytes_transferred);
if(!recv_res)
{
@@ -332,6 +345,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
shutdown();
}else
{
reset_timer(get_timeout_from_bytes_read(bytes_transferred), false);
socket_.async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_read, connection<t_protocol_handler>::shared_from_this(),
@@ -347,6 +361,13 @@ PRAGMA_WARNING_DISABLE_VS(4355)
_dbg3("[sock " << socket_.native_handle() << "] Some problems at read: " << e.message() << ':' << e.value());
shutdown();
}
else
{
_dbg3("[sock " << socket_.native_handle() << "] peer closed connection");
if (m_ready_to_close)
shutdown();
}
m_ready_to_close = true;
}
// If an error occurs then no new asynchronous operations are started. This
// means that all shared_ptr references to the connection object will
@@ -397,14 +418,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
const t_safe chunksize_max = chunksize_good * 2 ;
const bool allow_split = (m_connection_type == e_connection_type_RPC) ? false : true; // do not split RPC data
ASRT(! (chunksize_max<0) ); // make sure it is unsigned before removin sign with cast:
CHECK_AND_ASSERT_MES(! (chunksize_max<0), false, "Negative chunksize_max" ); // make sure it is unsigned before removin sign with cast:
long long unsigned int chunksize_max_unsigned = static_cast<long long unsigned int>( chunksize_max ) ;
if (allow_split && (cb > chunksize_max_unsigned)) {
{ // LOCK: chunking
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
_dbg3_c("net/out/size", "do_send() will SPLIT into small chunks, from packet="<<cb<<" B for ptr="<<ptr);
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<cb<<" B for ptr="<<ptr);
t_safe all = cb; // all bytes to send
t_safe pos = 0; // current sending position
// 01234567890
@@ -419,39 +440,39 @@ PRAGMA_WARNING_DISABLE_VS(4355)
while (pos < all) {
t_safe lenall = all-pos; // length from here to end
t_safe len = std::min( chunksize_good , lenall); // take a smaller part
ASRT(len<=chunksize_good);
CHECK_AND_ASSERT_MES(len<=chunksize_good, false, "len too large");
// pos=8; len=4; all=10; len=3;
ASRT(! (len<0) ); // check before we cast away sign:
CHECK_AND_ASSERT_MES(! (len<0), false, "negative len"); // check before we cast away sign:
unsigned long long int len_unsigned = static_cast<long long int>( len );
ASRT(len>0); // (redundand)
ASRT(len_unsigned < std::numeric_limits<size_t>::max()); // yeap we want strong < then max size, to be sure
CHECK_AND_ASSERT_MES(len>0, false, "len not strictly positive"); // (redundant)
CHECK_AND_ASSERT_MES(len_unsigned < std::numeric_limits<size_t>::max(), false, "Invalid len_unsigned"); // yeap we want strong < then max size, to be sure
void *chunk_start = ((char*)ptr) + pos;
_fact_c("net/out/size","chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);
ASRT(chunk_start >= ptr); // not wrapped around address?
MDEBUG("chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);
CHECK_AND_ASSERT_MES(chunk_start >= ptr, false, "Pointer wraparound"); // not wrapped around address?
//std::memcpy( (void*)buf, chunk_start, len);
_dbg3_c("net/out/size", "part of " << lenall << ": pos="<<pos << " len="<<len);
MDEBUG("part of " << lenall << ": pos="<<pos << " len="<<len);
bool ok = do_send_chunk(chunk_start, len); // <====== ***
all_ok = all_ok && ok;
if (!all_ok) {
_dbg1_c("net/out/size", "do_send() DONE ***FAILED*** from packet="<<cb<<" B for ptr="<<ptr);
_dbg1("do_send() SEND was aborted in middle of big package - this is mostly harmless "
MDEBUG("do_send() DONE ***FAILED*** from packet="<<cb<<" B for ptr="<<ptr);
MDEBUG("do_send() SEND was aborted in middle of big package - this is mostly harmless "
<< " (e.g. peer closed connection) but if it causes trouble tell us at #monero-dev. " << cb);
return false; // partial failure in sending
}
pos = pos+len; ASRT(pos >0);
pos = pos+len;
CHECK_AND_ASSERT_MES(pos >0, false, "pos <= 0");
// (in catch block, or uniq pointer) delete buf;
} // each chunk
_dbg3_c("net/out/size", "do_send() DONE SPLIT from packet="<<cb<<" B for ptr="<<ptr);
_dbg3 ( "do_send() DONE SPLIT from packet="<<cb<<" B for ptr="<<ptr);
MDEBUG("do_send() DONE SPLIT from packet="<<cb<<" B for ptr="<<ptr);
_info_c("net/sleepRPC", "do_send() m_connection_type = " << m_connection_type);
MDEBUG("do_send() m_connection_type = " << m_connection_type);
return all_ok; // done - e.g. queued - all the chunks of current do_send call
} // LOCK: chunking
@@ -486,9 +507,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
//some data should be wrote to stream
//request complete
if (speed_limit_is_enabled()) {
sleep_before_packet(cb, 1, 1);
}
// No sleeping here; sleeping is done once and for all in "handle_write"
m_send_que_lock.lock(); // *** critical ***
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_send_que_lock.unlock();});
@@ -505,15 +524,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}*/
long int ms = 250 + (rand()%50);
_info_c("net/sleep", "Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<cb); // XXX debug sleep
MDEBUG("Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<cb); // XXX debug sleep
m_send_que_lock.unlock();
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
m_send_que_lock.lock();
_dbg1("sleep for queue: " << ms);
if (retry > retry_limit) {
_erro("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
// _dbg1_c("net/sleep", "send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
MWARNING("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
shutdown();
return false;
}
@@ -525,10 +543,10 @@ PRAGMA_WARNING_DISABLE_VS(4355)
if(m_send_que.size() > 1)
{ // active operation should be in progress, nothing to do, just wait last operation callback
auto size_now = cb;
_info_c("net/out/size", "do_send() NOW just queues: packet="<<size_now<<" B, is added to queue-size="<<m_send_que.size());
MDEBUG("do_send_chunk() NOW just queues: packet="<<size_now<<" B, is added to queue-size="<<m_send_que.size());
//do_send_handler_delayed( ptr , size_now ); // (((H))) // empty function
LOG_PRINT_L4("[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
}
else
{ // no active operation
@@ -540,11 +558,12 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}
auto size_now = m_send_que.front().size();
_dbg1_c("net/out/size", "do_send() NOW SENSD: packet="<<size_now<<" B");
MDEBUG("do_send_chunk() NOW SENSD: packet="<<size_now<<" B");
if (speed_limit_is_enabled())
do_send_handler_write( ptr , size_now ); // (((H)))
ASRT( size_now == m_send_que.front().size() );
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), false, "Unexpected queue size");
reset_timer(get_default_timeout(), false);
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now ) ,
//strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
@@ -559,15 +578,86 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return true;
CATCH_ENTRY_L0("connection<t_protocol_handler>::do_send", false);
CATCH_ENTRY_L0("connection<t_protocol_handler>::do_send_chunk", false);
} // do_send_chunk
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
boost::posix_time::milliseconds connection<t_protocol_handler>::get_default_timeout()
{
unsigned count;
try { count = host_count(m_host); } catch (...) { count = 0; }
const unsigned shift = std::min(std::max(count, 1u) - 1, 8u);
boost::posix_time::milliseconds timeout(0);
if (m_local)
timeout = boost::posix_time::milliseconds(DEFAULT_TIMEOUT_MS_LOCAL >> shift);
else
timeout = boost::posix_time::milliseconds(DEFAULT_TIMEOUT_MS_REMOTE >> shift);
return timeout;
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
boost::posix_time::milliseconds connection<t_protocol_handler>::get_timeout_from_bytes_read(size_t bytes)
{
boost::posix_time::milliseconds ms = (boost::posix_time::milliseconds)(unsigned)(bytes * TIMEOUT_EXTRA_MS_PER_BYTE);
ms += m_timer.expires_from_now();
if (ms > get_default_timeout())
ms = get_default_timeout();
return ms;
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
unsigned int connection<t_protocol_handler>::host_count(const std::string &host, int delta)
{
static boost::mutex hosts_mutex;
CRITICAL_REGION_LOCAL(hosts_mutex);
static std::map<std::string, unsigned int> hosts;
unsigned int &val = hosts[host];
if (delta > 0)
MTRACE("New connection from host " << host << ": " << val);
else if (delta < 0)
MTRACE("Closed connection from host " << host << ": " << val);
CHECK_AND_ASSERT_THROW_MES(delta >= 0 || val >= (unsigned)-delta, "Count would go negative");
CHECK_AND_ASSERT_THROW_MES(delta <= 0 || val <= std::numeric_limits<unsigned int>::max() - (unsigned)delta, "Count would wrap");
val += delta;
return val;
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
void connection<t_protocol_handler>::reset_timer(boost::posix_time::milliseconds ms, bool add)
{
if (m_connection_type != e_connection_type_RPC)
return;
MTRACE("Setting " << ms << " expiry");
auto self = safe_shared_from_this();
if(!self)
{
MERROR("Resetting timer on a dead object");
return;
}
if (add)
ms += m_timer.expires_from_now();
m_timer.expires_from_now(ms);
m_timer.async_wait([=](const boost::system::error_code& ec)
{
if(ec == boost::asio::error::operation_aborted)
return;
MDEBUG(context << "connection timeout, closing");
self->close();
});
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
bool connection<t_protocol_handler>::shutdown()
{
// Initiate graceful connection closure.
m_timer.cancel();
boost::system::error_code ignored_ec;
socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
if (!m_host.empty())
{
try { host_count(m_host, -1); } catch (...) { /* ignore */ }
m_host = "";
}
m_was_shutdown = true;
m_protocol_handler.release_protocol();
return true;
@@ -578,6 +668,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
TRY_ENTRY();
//_info("[sock " << socket_.native_handle() << "] Que Shutdown called.");
m_timer.cancel();
size_t send_que_size = 0;
CRITICAL_REGION_BEGIN(m_send_que_lock);
send_que_size = m_send_que.size();
@@ -593,6 +684,15 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
bool connection<t_protocol_handler>::send_done()
{
if (m_ready_to_close)
return close();
m_ready_to_close = true;
return true;
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
bool connection<t_protocol_handler>::cancel()
{
return close();
@@ -602,7 +702,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
void connection<t_protocol_handler>::handle_write(const boost::system::error_code& e, size_t cb)
{
TRY_ENTRY();
LOG_PRINT_L4("[sock " << socket_.native_handle() << "] Async send calledback " << cb);
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] Async send calledback " << cb);
if (e)
{
@@ -612,6 +712,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}
logger_handle_net_write(cb);
// The single sleeping that is needed for correctly handling "out" speed throttling
if (speed_limit_is_enabled()) {
sleep_before_packet(cb, 1, 1);
}
@@ -634,11 +735,12 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}else
{
//have more data to send
reset_timer(get_default_timeout(), false);
auto size_now = m_send_que.front().size();
_dbg1_c("net/out/size", "handle_write() NOW SENDS: packet="<<size_now<<" B" <<", from queue size="<<m_send_que.size());
MDEBUG("handle_write() NOW SENDS: packet="<<size_now<<" B" <<", from queue size="<<m_send_que.size());
if (speed_limit_is_enabled())
do_send_handler_write_from_queue(e, m_send_que.front().size() , m_send_que.size()); // (((H)))
ASRT( size_now == m_send_que.front().size() );
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now) ,
// strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
@@ -660,8 +762,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
void connection<t_protocol_handler>::setRpcStation()
{
m_connection_type = e_connection_type_RPC;
_fact_c("net/sleepRPC", "set m_connection_type = RPC ");
_info_c("net/kind", "set m_connection_type = RPC ");
MDEBUG("set m_connection_type = RPC ");
}
@@ -683,7 +784,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_sock_count(0), m_sock_number(0), m_threads_count(0),
m_pfilter(NULL), m_thread_index(0),
m_connection_type( connection_type ),
new_connection_(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type))
new_connection_()
{
create_server_type_map();
m_thread_name_prefix = "NET";
@@ -697,7 +798,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_sock_count(0), m_sock_number(0), m_threads_count(0),
m_pfilter(NULL), m_thread_index(0),
m_connection_type(connection_type),
new_connection_(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, connection_type))
new_connection_()
{
create_server_type_map();
m_thread_name_prefix = "NET";
@@ -735,13 +836,24 @@ PRAGMA_WARNING_DISABLE_VS(4355)
acceptor_.listen();
boost::asio::ip::tcp::endpoint binded_endpoint = acceptor_.local_endpoint();
m_port = binded_endpoint.port();
_fact_c("net/RPClog", "start accept");
MDEBUG("start accept");
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
return true;
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::init_server", false);
}
catch (const std::exception &e)
{
MFATAL("Error starting server: " << e.what());
return false;
}
catch (...)
{
MFATAL("Error starting server");
return false;
}
}
//-----------------------------------------------------------------------------
PUSH_WARNINGS
@@ -752,7 +864,7 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
uint32_t p = 0;
if (port.size() && !string_tools::get_xtype_from_string(p, port)) {
LOG_ERROR("Failed to convert port no = " << port);
MERROR("Failed to convert port no = " << port);
return false;
}
return this->init_server(p, address);
@@ -766,7 +878,7 @@ POP_WARNINGS
uint32_t local_thr_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index);
std::string thread_name = std::string("[") + m_thread_name_prefix;
thread_name += boost::to_string(local_thr_index) + "]";
log_space::log_singletone::set_thread_log_prefix(thread_name);
MLOG_SET_THREAD_NAME(thread_name);
// _fact("Thread name: " << m_thread_name_prefix);
while(!m_stop_signal_sent)
{
@@ -795,8 +907,7 @@ POP_WARNINGS
auto it = server_type_map.find(m_thread_name_prefix);
if (it==server_type_map.end()) throw std::runtime_error("Unknown prefix/server type:" + std::string(prefix_name));
auto connection_type = it->second; // the value of type
_info_c("net/RPClog", "Set server type to: " << connection_type << " from name: " << m_thread_name_prefix);
_info_c("net/RPClog", "prefix_name = " << prefix_name);
MINFO("Set server type to: " << connection_type << " from name: " << m_thread_name_prefix << ", prefix_name = " << prefix_name);
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
@@ -811,8 +922,7 @@ POP_WARNINGS
TRY_ENTRY();
m_threads_count = threads_count;
m_main_thread_id = boost::this_thread::get_id();
log_space::log_singletone::set_thread_log_prefix("[SRV_MAIN]");
add_idle_handler(boost::bind(&boosted_tcp_server::cleanup_connections, this), 5000);
MLOG_SET_THREAD_NAME("[SRV_MAIN]");
while(!m_stop_signal_sent)
{
@@ -902,7 +1012,7 @@ POP_WARNINGS
connections_mutex.lock();
for (auto &c: connections_)
{
c.second->cancel();
c->cancel();
}
connections_.clear();
connections_mutex.unlock();
@@ -911,19 +1021,6 @@ POP_WARNINGS
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
bool boosted_tcp_server<t_protocol_handler>::cleanup_connections()
{
connections_mutex.lock();
boost::system_time cutoff = boost::get_system_time() - boost::posix_time::seconds(CONNECTION_CLEANUP_TIME);
while (!connections_.empty() && connections_.front().first < cutoff)
{
connections_.pop_front();
}
connections_mutex.unlock();
return true;
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
bool boosted_tcp_server<t_protocol_handler>::is_stop_signal_sent()
{
return m_stop_signal_sent;
@@ -932,13 +1029,13 @@ POP_WARNINGS
template<class t_protocol_handler>
void boosted_tcp_server<t_protocol_handler>::handle_accept(const boost::system::error_code& e)
{
_fact_c("net/RPClog", "handle_accept");
TRY_ENTRY();
MDEBUG("handle_accept");
try
{
if (!e)
{
if (m_connection_type == e_connection_type_RPC) {
_note_c("net/rpc", "New server for RPC connections");
_fact_c("net/RPClog", "New server for RPC connections");
MDEBUG("New server for RPC connections");
new_connection_->setRpcStation(); // hopefully this is not needed actually
}
connection_ptr conn(std::move(new_connection_));
@@ -947,13 +1044,30 @@ POP_WARNINGS
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
boost::asio::socket_base::keep_alive opt(true);
conn->socket().set_option(opt);
conn->start(true, 1 < m_threads_count);
conn->save_dbg_log();
}else
{
_erro("Some problems at accept: " << e.message() << ", connections_count = " << m_sock_count);
return;
}
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::handle_accept", void());
else
{
MERROR("Error in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e);
}
}
catch (const std::exception &e)
{
MERROR("Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what());
}
// error path, if e or exception
_erro("Some problems at accept: " << e.message() << ", connections_count = " << m_sock_count);
misc_utils::sleep_no_w(100);
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
@@ -963,9 +1077,10 @@ POP_WARNINGS
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
connections_mutex.lock();
connections_.push_back(std::make_pair(boost::get_system_time(), new_connection_l));
LOG_PRINT_L2("connections_ size now " << connections_.size());
connections_.insert(new_connection_l);
MDEBUG("connections_ size now " << connections_.size());
connections_mutex.unlock();
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ CRITICAL_REGION_LOCAL(connections_mutex); connections_.erase(new_connection_l); });
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
//////////////////////////////////////////////////////////////////////////
@@ -1043,6 +1158,10 @@ POP_WARNINGS
_dbg3("Connected success to " << adr << ':' << port);
// start adds the connection to the config object's list, so we don't need to have it locally anymore
connections_mutex.lock();
connections_.erase(new_connection_l);
connections_mutex.unlock();
bool r = new_connection_l->start(false, 1 < m_threads_count);
if (r)
{
@@ -1051,7 +1170,7 @@ POP_WARNINGS
}
else
{
_erro("[sock " << new_connection_->socket().native_handle() << "] Failed to start connection, connections_count = " << m_sock_count);
_erro("[sock " << new_connection_l->socket().native_handle() << "] Failed to start connection, connections_count = " << m_sock_count);
}
new_connection_l->save_dbg_log();
@@ -1062,14 +1181,15 @@ POP_WARNINGS
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler> template<class t_callback>
bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, t_callback cb, const std::string& bind_ip)
bool boosted_tcp_server<t_protocol_handler>::connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeout, const t_callback &cb, const std::string& bind_ip)
{
TRY_ENTRY();
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
connections_mutex.lock();
connections_.push_back(std::make_pair(boost::get_system_time(), new_connection_l));
LOG_PRINT_L2("connections_ size now " << connections_.size());
connections_.insert(new_connection_l);
MDEBUG("connections_ size now " << connections_.size());
connections_mutex.unlock();
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ CRITICAL_REGION_LOCAL(connections_mutex); connections_.erase(new_connection_l); });
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
//////////////////////////////////////////////////////////////////////////
@@ -1118,6 +1238,11 @@ POP_WARNINGS
{
_dbg3("[sock " << new_connection_l->socket().native_handle() << "] Connected success to " << adr << ':' << port <<
" from " << lep.address().to_string() << ':' << lep.port());
// start adds the connection to the config object's list, so we don't need to have it locally anymore
connections_mutex.lock();
connections_.erase(new_connection_l);
connections_mutex.unlock();
bool r = new_connection_l->start(false, 1 < m_threads_count);
if (r)
{

View File

@@ -42,6 +42,9 @@
#include "net_utils_base.h"
#include "pragma_comp_defs.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#define LEVIN_DEFAULT_DATA_BUFF_SIZE 2000
namespace epee

View File

@@ -27,6 +27,9 @@
#pragma comment(lib, "Ws2_32.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace net_utils
@@ -468,7 +471,7 @@ bool cp_server_impl<TProtocol>::run_server(int threads_count = 0)
}
//-------------------------------------------------------------
template<class TProtocol>
bool cp_server_impl<TProtocol>::add_new_connection(SOCKET new_sock, long ip_from, int port_from)
bool cp_server_impl<TProtocol>::add_new_connection(SOCKET new_sock, const network_address &address_from)
{
PROFILE_FUNC("[add_new_connection]");
@@ -484,8 +487,7 @@ bool cp_server_impl<TProtocol>::add_new_connection(SOCKET new_sock, long ip_from
m_connections_lock.unlock();
conn.init_buffers();
conn.m_sock = new_sock;
conn.context.m_remote_ip = ip_from;
conn.context.m_remote_port = port_from;
conn.context.m_remote_address = address_from;
conn.m_completion_port = m_completion_port;
{
PROFILE_FUNC("[add_new_connection] CreateIoCompletionPort");

View File

@@ -8,7 +8,7 @@
// ! (how ever if in some wonderful juristdictions that is not the case, then why not make another sub-class withat that members and licence it as epee part)
// ! Working on above premise, IF this is valid in your juristdictions, then consider this code as released as:
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
@@ -59,8 +59,8 @@
#include <memory>
#include "../../contrib/epee/include/net/net_utils_base.h"
#include "../../contrib/epee/include/syncobj.h"
#include "net/net_utils_base.h"
#include "syncobj.h"
namespace epee
{

View File

@@ -0,0 +1,173 @@
// Copyright (c) 2014-2018, 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.
#pragma once
#include <boost/optional/optional.hpp>
#include <boost/utility/string_ref.hpp>
#include <cstdint>
#include <functional>
#include <string>
#include <utility>
#include "wipeable_string.h"
#include "http_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
{
namespace http
{
struct login
{
login() : username(), password() {}
login(std::string username_, wipeable_string password_)
: username(std::move(username_)), password(std::move(password_))
{}
std::string username;
wipeable_string password;
};
//! Implements RFC 2617 digest auth. Digests from RFC 7616 can be added.
class http_server_auth
{
public:
struct session
{
session(login credentials_)
: credentials(std::move(credentials_)), nonce(), counter(0)
{}
login credentials;
std::string nonce;
std::uint32_t counter;
};
http_server_auth() : user(), rng() {}
http_server_auth(login credentials, std::function<void(size_t, uint8_t*)> r);
//! \return Auth response, or `boost::none` iff `request` had valid auth.
boost::optional<http_response_info> get_response(const http_request_info& request)
{
if (user)
return do_get_response(request);
return boost::none;
}
private:
boost::optional<http_response_info> do_get_response(const http_request_info& request);
boost::optional<session> user;
std::function<void(size_t, uint8_t*)> rng;
};
//! Implements RFC 2617 digest auth. Digests from RFC 7616 can be added.
class http_client_auth
{
public:
enum status : std::uint8_t { kSuccess = 0, kBadPassword, kParseFailure };
struct session
{
session(login credentials_)
: credentials(std::move(credentials_)), server(), counter(0)
{}
struct keys
{
using algorithm =
std::function<std::string(const session&, boost::string_ref, boost::string_ref)>;
keys() : nonce(), opaque(), realm(), generator() {}
keys(std::string nonce_, std::string opaque_, std::string realm_, algorithm generator_)
: nonce(std::move(nonce_))
, opaque(std::move(opaque_))
, realm(std::move(realm_))
, generator(std::move(generator_))
{}
std::string nonce;
std::string opaque;
std::string realm;
algorithm generator;
};
login credentials;
keys server;
std::uint32_t counter;
};
http_client_auth() : user() {}
http_client_auth(login credentials);
/*!
Clients receiving a 401 response code from the server should call this
function to process the server auth. Then, before every client request,
`get_auth_field()` should be called to retrieve the newest
authorization request.
\return `kBadPassword` if client will never be able to authenticate,
`kParseFailure` if all server authentication responses were invalid,
and `kSuccess` if `get_auth_field` is ready to generate authorization
fields.
*/
status handle_401(const http_response_info& response)
{
if (user)
return do_handle_401(response);
return kBadPassword;
}
/*!
After calling `handle_401`, clients should call this function to
generate an authentication field for every request.
\return A HTTP "Authorization" field if `handle_401(...)` previously
returned `kSuccess`.
*/
boost::optional<std::pair<std::string, std::string>> get_auth_field(
const boost::string_ref method, const boost::string_ref uri)
{
if (user)
return do_get_auth_field(method, uri);
return boost::none;
}
private:
status do_handle_401(const http_response_info&);
boost::optional<std::pair<std::string, std::string>> do_get_auth_field(boost::string_ref, boost::string_ref);
boost::optional<session> user;
};
}
}
}

View File

@@ -29,8 +29,15 @@
#pragma once
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
#include <boost/utility/string_ref.hpp>
#include <string>
#include <utility>
#include "string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
@@ -39,6 +46,7 @@ namespace net_utils
{
enum http_method{
http_method_options,
http_method_get,
http_method_post,
http_method_put,
@@ -86,6 +94,15 @@ namespace net_utils
return std::string();
}
static inline void add_field(std::string& out, const boost::string_ref name, const boost::string_ref value)
{
out.append(name.data(), name.size()).append(": ");
out.append(value.data(), value.size()).append("\r\n");
}
static inline void add_field(std::string& out, const std::pair<std::string, std::string>& field)
{
add_field(out, field.first, field.second);
}
struct http_header_info
@@ -99,6 +116,7 @@ namespace net_utils
std::string m_host; //"Host:"
std::string m_cookie; //"Cookie:"
std::string m_user_agent; //"User-Agent:"
std::string m_origin; //"Origin:"
fields_list m_etc_fields;
void clear()
@@ -112,6 +130,7 @@ namespace net_utils
m_host.clear();
m_cookie.clear();
m_user_agent.clear();
m_origin.clear();
m_etc_fields.clear();
}
};
@@ -139,7 +158,8 @@ namespace net_utils
http_request_info():m_http_method(http_method_unknown),
m_http_ver_hi(0),
m_http_ver_lo(0),
m_have_to_block(false)
m_have_to_block(false),
m_full_request_buf_size(0)
{}
http_method m_http_method;

View File

@@ -27,9 +27,12 @@
#pragma once
#include <ctype.h>
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional/optional.hpp>
#include <boost/utility/string_ref.hpp>
//#include <mbstring.h>
#include <algorithm>
#include <cctype>
@@ -45,13 +48,18 @@
#include "string_tools.h"
#include "reg_exp_definer.h"
#include "http_base.h"
#include "http_auth.h"
#include "to_nonconst_iterator.h"
#include "net_parse_helpers.h"
#include "syncobj.h"
//#include "shlwapi.h"
//#pragma comment(lib, "shlwapi.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
extern epee::critical_section gregexp_lock;
@@ -60,8 +68,6 @@ namespace epee
namespace net_utils
{
using namespace std;
/*struct url
{
public:
@@ -101,14 +107,14 @@ using namespace std;
//---------------------------------------------------------------------------
static inline const char* get_hex_vals()
{
static char hexVals[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
static const char hexVals[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
return hexVals;
}
static inline const char* get_unsave_chars()
{
//static char unsave_chars[] = "\"<>%\\^[]`+$,@:;/!#?=&";
static char unsave_chars[] = "\"<>%\\^[]`+$,@:;!#&";
static const char unsave_chars[] = "\"<>%\\^[]`+$,@:;!#&";
return unsave_chars;
}
@@ -231,11 +237,9 @@ using namespace std;
namespace http
{
class http_simple_client: public i_target_handler
template<typename net_client_type>
class http_simple_client_template: public i_target_handler
{
public:
private:
enum reciev_machine_state
{
@@ -257,10 +261,10 @@ using namespace std;
};
blocked_mode_client m_net_client;
net_client_type m_net_client;
std::string m_host_buff;
std::string m_port;
unsigned int m_timeout;
http_client_auth m_auth;
std::string m_header_cache;
http_response_info m_response_info;
size_t m_len_in_summary;
@@ -271,25 +275,53 @@ using namespace std;
chunked_state m_chunked_state;
std::string m_chunked_cache;
critical_section m_lock;
bool m_ssl;
public:
void set_host_name(const std::string& name)
explicit http_simple_client_template()
: i_target_handler()
, m_net_client()
, m_host_buff()
, m_port()
, m_auth()
, m_header_cache()
, m_response_info()
, m_len_in_summary(0)
, m_len_in_remain(0)
, m_pcontent_encoding_handler(nullptr)
, m_state()
, m_chunked_state()
, m_chunked_cache()
, m_lock()
, m_ssl(false)
{}
const std::string &get_host() const { return m_host_buff; };
const std::string &get_port() const { return m_port; };
bool set_server(const std::string& address, boost::optional<login> user, bool ssl = false)
{
http::url_content parsed{};
const bool r = parse_url(address, parsed);
CHECK_AND_ASSERT_MES(r, false, "failed to parse url: " << address);
set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user), ssl);
return true;
}
void set_server(std::string host, std::string port, boost::optional<login> user, bool ssl = false)
{
CRITICAL_REGION_LOCAL(m_lock);
m_host_buff = name;
disconnect();
m_host_buff = std::move(host);
m_port = std::move(port);
m_auth = user ? http_client_auth{std::move(*user)} : http_client_auth{};
m_ssl = ssl;
}
bool connect(const std::string& host, int port, unsigned int timeout)
{
return connect(host, std::to_string(port), timeout);
}
bool connect(const std::string& host, const std::string& port, unsigned int timeout)
bool connect(std::chrono::milliseconds timeout)
{
CRITICAL_REGION_LOCAL(m_lock);
m_host_buff = host;
m_port = port;
m_timeout = timeout;
return m_net_client.connect(host, port, timeout, timeout);
return m_net_client.connect(m_host_buff, m_port, timeout, m_ssl);
}
//---------------------------------------------------------------------------
bool disconnect()
@@ -311,60 +343,105 @@ using namespace std;
piece_of_transfer.clear();
return true;
}
//---------------------------------------------------------------------------
virtual bool on_header(const http_response_info &headers)
{
return true;
}
//---------------------------------------------------------------------------
inline
bool invoke_get(const std::string& uri, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
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())
{
CRITICAL_REGION_LOCAL(m_lock);
return invoke(uri, "GET", body, ppresponse_info, additional_params);
return invoke(uri, "GET", body, timeout, ppresponse_info, additional_params);
}
//---------------------------------------------------------------------------
inline bool invoke(const std::string& uri, const std::string& method, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
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())
{
CRITICAL_REGION_LOCAL(m_lock);
if(!is_connected())
{
LOG_PRINT("Reconnecting...", LOG_LEVEL_3);
if(!connect(m_host_buff, m_port, m_timeout))
MDEBUG("Reconnecting...");
if(!connect(timeout))
{
LOG_PRINT("Failed to connect to " << m_host_buff << ":" << m_port, LOG_LEVEL_3);
MDEBUG("Failed to connect to " << m_host_buff << ":" << m_port);
return false;
}
}
m_response_info.clear();
std::string req_buff = method + " ";
req_buff += uri + " HTTP/1.1\r\n" +
"Host: "+ m_host_buff +"\r\n" + "Content-Length: " + boost::lexical_cast<std::string>(body.size()) + "\r\n";
std::string req_buff{};
req_buff.reserve(2048);
req_buff.append(method.data(), method.size()).append(" ").append(uri.data(), uri.size()).append(" HTTP/1.1\r\n");
add_field(req_buff, "Host", m_host_buff);
add_field(req_buff, "Content-Length", std::to_string(body.size()));
//handle "additional_params"
for(fields_list::const_iterator it = additional_params.begin(); it!=additional_params.end(); it++)
req_buff += it->first + ": " + it->second + "\r\n";
req_buff += "\r\n";
//--
for(const auto& field : additional_params)
add_field(req_buff, field);
bool res = m_net_client.send(req_buff);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
if(body.size())
res = m_net_client.send(body);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
for (unsigned sends = 0; sends < 2; ++sends)
{
const std::size_t initial_size = req_buff.size();
const auto auth = m_auth.get_auth_field(method, uri);
if (auth)
add_field(req_buff, *auth);
if(ppresponse_info)
*ppresponse_info = &m_response_info;
req_buff += "\r\n";
//--
m_state = reciev_machine_state_header;
return handle_reciev();
bool res = m_net_client.send(req_buff, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
if(body.size())
res = m_net_client.send(body, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
m_response_info.clear();
m_state = reciev_machine_state_header;
if (!handle_reciev(timeout))
return false;
if (m_response_info.m_response_code != 401)
{
if(ppresponse_info)
*ppresponse_info = std::addressof(m_response_info);
return true;
}
switch (m_auth.handle_401(m_response_info))
{
case http_client_auth::kSuccess:
break;
case http_client_auth::kBadPassword:
sends = 2;
break;
default:
case http_client_auth::kParseFailure:
LOG_ERROR("Bad server response for authentication");
return false;
}
req_buff.resize(initial_size); // rollback for new auth generation
}
LOG_ERROR("Client has incorrect username/password for server requiring authentication");
return false;
}
//---------------------------------------------------------------------------
inline bool invoke_post(const std::string& uri, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
inline 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())
{
CRITICAL_REGION_LOCAL(m_lock);
return invoke(uri, "POST", body, ppresponse_info, additional_params);
return invoke(uri, "POST", body, timeout, ppresponse_info, additional_params);
}
//---------------------------------------------------------------------------
bool test(const std::string &s, std::chrono::milliseconds timeout) // TEST FUNC ONLY
{
CRITICAL_REGION_LOCAL(m_lock);
m_net_client.set_test_data(s);
m_state = reciev_machine_state_header;
return handle_reciev(timeout);
}
//---------------------------------------------------------------------------
private:
//---------------------------------------------------------------------------
inline bool handle_reciev()
inline bool handle_reciev(std::chrono::milliseconds timeout)
{
CRITICAL_REGION_LOCAL(m_lock);
bool keep_handling = true;
@@ -374,9 +451,9 @@ using namespace std;
{
if(need_more_data)
{
if(!m_net_client.recv(recv_buffer))
if(!m_net_client.recv(recv_buffer, timeout))
{
LOG_PRINT("Unexpected reciec fail", LOG_LEVEL_3);
MERROR("Unexpected recv fail");
m_state = reciev_machine_state_error;
}
if(!recv_buffer.size())
@@ -448,6 +525,12 @@ using namespace std;
m_header_cache.erase(m_header_cache.begin()+pos+4, m_header_cache.end());
analize_cached_header_and_invoke_state();
if (!on_header(m_response_info))
{
MDEBUG("Connection cancelled by on_header");
m_state = reciev_machine_state_done;
return false;
}
m_header_cache.clear();
if(!recv_buff.size() && (m_state != reciev_machine_state_error && m_state != reciev_machine_state_done))
need_more_data = true;
@@ -464,13 +547,17 @@ using namespace std;
CRITICAL_REGION_LOCAL(m_lock);
if(!recv_buff.size())
{
LOG_PRINT("Warning: Content-Len mode, but connection unexpectedly closed", LOG_LEVEL_3);
MERROR("Warning: Content-Len mode, but connection unexpectedly closed");
m_state = reciev_machine_state_done;
return true;
}
CHECK_AND_ASSERT_MES(m_len_in_remain >= recv_buff.size(), false, "m_len_in_remain >= recv_buff.size()");
m_len_in_remain -= recv_buff.size();
m_pcontent_encoding_handler->update_in(recv_buff);
if (!m_pcontent_encoding_handler->update_in(recv_buff))
{
m_state = reciev_machine_state_done;
return false;
}
if(m_len_in_remain == 0)
m_state = reciev_machine_state_done;
@@ -578,7 +665,7 @@ using namespace std;
CRITICAL_REGION_LOCAL(m_lock);
if(!recv_buff.size())
{
LOG_PRINT("Warning: CHUNKED mode, but connection unexpectedly closed", LOG_LEVEL_3);
MERROR("Warning: CHUNKED mode, but connection unexpectedly closed");
m_state = reciev_machine_state_done;
return true;
}
@@ -643,7 +730,11 @@ using namespace std;
m_len_in_remain = 0;
}
m_pcontent_encoding_handler->update_in(chunk_body);
if (!m_pcontent_encoding_handler->update_in(chunk_body))
{
m_state = reciev_machine_state_error;
return false;
}
if(!m_len_in_remain)
m_chunked_state = http_chunked_state_chunk_head;
@@ -662,85 +753,107 @@ using namespace std;
return true;
}
//---------------------------------------------------------------------------
inline
bool parse_header(http_header_info& body_info, const std::string& m_cache_to_process)
{
LOG_FRAME("http_stream_filter::parse_cached_header(*)", LOG_LEVEL_4);
STATIC_REGEXP_EXPR_1(rexp_mach_field,
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)|(User-Agent)"
// 12 3 4 5 6 7 8 9 10
"|([\\w-]+?)) ?: ?((.*?)(\r?\n))[^\t ]",
//11 1213 14
boost::regex::icase | boost::regex::normal);
boost::smatch result;
std::string::const_iterator it_current_bound = m_cache_to_process.begin();
std::string::const_iterator it_end_bound = m_cache_to_process.end();
//lookup all fields and fill well-known fields
while( boost::regex_search( it_current_bound, it_end_bound, result, rexp_mach_field, boost::match_default) && result[0].matched)
{
const size_t field_val = 13;
//const size_t field_etc_name = 11;
int i = 2; //start position = 2
if(result[i++].matched)//"Connection"
body_info.m_connection = result[field_val];
else if(result[i++].matched)//"Referrer"
body_info.m_referer = result[field_val];
else if(result[i++].matched)//"Content-Length"
body_info.m_content_length = result[field_val];
else if(result[i++].matched)//"Content-Type"
body_info.m_content_type = result[field_val];
else if(result[i++].matched)//"Transfer-Encoding"
body_info.m_transfer_encoding = result[field_val];
else if(result[i++].matched)//"Content-Encoding"
body_info.m_content_encoding = result[field_val];
else if(result[i++].matched)//"Host"
{ body_info.m_host = result[field_val];
string_tools::trim(body_info.m_host);
}
else if(result[i++].matched)//"Cookie"
body_info.m_cookie = result[field_val];
else if(result[i++].matched)//"User-Agent"
body_info.m_user_agent = result[field_val];
else if(result[i++].matched)//e.t.c (HAVE TO BE MATCHED!)
{;}
else
{CHECK_AND_ASSERT_MES(false, false, "http_stream_filter::parse_cached_header() not matched last entry in:"<<m_cache_to_process);}
it_current_bound = result[(int)result.size()-1]. first;
}
return true;
}
inline
bool analize_first_response_line()
inline bool parse_header(http_header_info& body_info, const std::string& m_cache_to_process)
{
MTRACE("http_stream_filter::parse_cached_header(*)");
//First line response, look like this: "HTTP/1.1 200 OK"
STATIC_REGEXP_EXPR_1(rexp_match_first_response_line, "^HTTP/(\\d+).(\\d+) ((\\d)\\d{2})( [^\n]*)?\r?\n", boost::regex::icase | boost::regex::normal);
// 1 2 34 5
//size_t match_len = 0;
boost::smatch result;
if(boost::regex_search( m_header_cache, result, rexp_match_first_response_line, boost::match_default) && result[0].matched)
const char *ptr = m_cache_to_process.c_str();
while (ptr[0] != '\r' || ptr[1] != '\n')
{
CHECK_AND_ASSERT_MES(result[1].matched&&result[2].matched, false, "http_stream_filter::handle_invoke_reply_line() assert failed...");
m_response_info.m_http_ver_hi = boost::lexical_cast<int>(result[1]);
m_response_info.m_http_ver_lo = boost::lexical_cast<int>(result[2]);
m_response_info.m_response_code = boost::lexical_cast<int>(result[3]);
m_header_cache.erase(to_nonsonst_iterator(m_header_cache, result[0].first), to_nonsonst_iterator(m_header_cache, result[0].second));
return true;
}else
{
LOG_ERROR("http_stream_filter::handle_invoke_reply_line(): Failed to match first response line:" << m_header_cache);
return false;
// optional \n
if (*ptr == '\n')
++ptr;
// an identifier composed of letters or -
const char *key_pos = ptr;
while (isalnum(*ptr) || *ptr == '_' || *ptr == '-')
++ptr;
const char *key_end = ptr;
// optional space (not in RFC, but in previous code)
if (*ptr == ' ')
++ptr;
CHECK_AND_ASSERT_MES(*ptr == ':', true, "http_stream_filter::parse_cached_header() invalid header in: " << m_cache_to_process);
++ptr;
// optional whitespace, but not newlines - line folding is obsolete, let's ignore it
while (isblank(*ptr))
++ptr;
const char *value_pos = ptr;
while (*ptr != '\r' && *ptr != '\n')
++ptr;
const char *value_end = ptr;
// optional trailing whitespace
while (value_end > value_pos && isblank(*(value_end-1)))
--value_end;
if (*ptr == '\r')
++ptr;
CHECK_AND_ASSERT_MES(*ptr == '\n', true, "http_stream_filter::parse_cached_header() invalid header in: " << m_cache_to_process);
++ptr;
const std::string key = std::string(key_pos, key_end - key_pos);
const std::string value = std::string(value_pos, value_end - value_pos);
if (!key.empty())
{
if (!string_tools::compare_no_case(key, "Connection"))
body_info.m_connection = value;
else if(!string_tools::compare_no_case(key, "Referrer"))
body_info.m_referer = value;
else if(!string_tools::compare_no_case(key, "Content-Length"))
body_info.m_content_length = value;
else if(!string_tools::compare_no_case(key, "Content-Type"))
body_info.m_content_type = value;
else if(!string_tools::compare_no_case(key, "Transfer-Encoding"))
body_info.m_transfer_encoding = value;
else if(!string_tools::compare_no_case(key, "Content-Encoding"))
body_info.m_content_encoding = value;
else if(!string_tools::compare_no_case(key, "Host"))
body_info.m_host = value;
else if(!string_tools::compare_no_case(key, "Cookie"))
body_info.m_cookie = value;
else if(!string_tools::compare_no_case(key, "User-Agent"))
body_info.m_user_agent = value;
else if(!string_tools::compare_no_case(key, "Origin"))
body_info.m_origin = value;
else
body_info.m_etc_fields.emplace_back(key, value);
}
}
return true;
}
//---------------------------------------------------------------------------
inline bool analize_first_response_line()
{
//First line response, look like this: "HTTP/1.1 200 OK"
const char *ptr = m_header_cache.c_str();
CHECK_AND_ASSERT_MES(!memcmp(ptr, "HTTP/", 5), false, "Invalid first response line: " + m_header_cache);
ptr += 5;
CHECK_AND_ASSERT_MES(isdigit(*ptr), false, "Invalid first response line: " + m_header_cache);
unsigned long ul;
char *end;
ul = strtoul(ptr, &end, 10);
CHECK_AND_ASSERT_MES(ul <= INT_MAX && *end =='.', false, "Invalid first response line: " + m_header_cache);
m_response_info.m_http_ver_hi = ul;
ptr = end + 1;
CHECK_AND_ASSERT_MES(isdigit(*ptr), false, "Invalid first response line: " + m_header_cache + ", ptr: " << ptr);
ul = strtoul(ptr, &end, 10);
CHECK_AND_ASSERT_MES(ul <= INT_MAX && isblank(*end), false, "Invalid first response line: " + m_header_cache + ", ptr: " << ptr);
m_response_info.m_http_ver_lo = ul;
ptr = end + 1;
while (isblank(*ptr))
++ptr;
CHECK_AND_ASSERT_MES(isdigit(*ptr), false, "Invalid first response line: " + m_header_cache);
ul = strtoul(ptr, &end, 10);
CHECK_AND_ASSERT_MES(ul >= 100 && ul <= 999 && isspace(*end), false, "Invalid first response line: " + m_header_cache);
m_response_info.m_response_code = ul;
ptr = end;
// ignore the optional text, till the end
while (*ptr != '\r' && *ptr != '\n')
++ptr;
if (*ptr == '\r')
++ptr;
CHECK_AND_ASSERT_MES(*ptr == '\n', false, "Invalid first response line: " << m_header_cache);
++ptr;
m_header_cache.erase(0, ptr - m_header_cache.c_str());
return true;
}
inline
bool set_reply_content_encoder()
@@ -833,7 +946,7 @@ using namespace std;
}else
{ //Apparently there are no signs of the form of transfer, will receive data until the connection is closed
m_state = reciev_machine_state_error;
LOG_PRINT("Undefinded transfer type, consider http_body_transfer_connection_close method. header: " << m_header_cache, LOG_LEVEL_2);
MERROR("Undefined transfer type, consider http_body_transfer_connection_close method. header: " << m_header_cache);
return false;
}
return false;
@@ -875,33 +988,7 @@ using namespace std;
return true;
}
};
/************************************************************************/
/* */
/************************************************************************/
//inline
template<class t_transport>
bool invoke_request(const std::string& url, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
{
http::url_content u_c;
bool res = parse_url(url, u_c);
if(!tr.is_connected() && !u_c.host.empty())
{
CHECK_AND_ASSERT_MES(res, false, "failed to parse url: " << url);
if(!u_c.port)
u_c.port = 80;//default for http
res = tr.connect(u_c.host, static_cast<int>(u_c.port), timeout);
CHECK_AND_ASSERT_MES(res, false, "failed to connect " << u_c.host << ":" << u_c.port);
}
return tr.invoke(u_c.uri, method, body, ppresponse_info, additional_params);
}
typedef http_simple_client_template<blocked_mode_client> http_simple_client;
}
}
}

View File

@@ -1,98 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#pragma once
#include "storages/serializeble_struct_helper.h"
namespace epee
{
namespace net_utils
{
namespace http
{
template<class TArg, class TResult, class TTransport>
bool invoke_http_json_remote_command(const std::string& url, TArg& out_struct, TResult& result_struct, TTransport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
{
std::string req_param;
StorageNamed::InMemStorageSpace::json::store_t_to_json(out_struct, req_param);
const http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
return false;
}
if(!pri->m_response_code)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
return false;
}
return StorageNamed::InMemStorageSpace::json::load_t_from_json(result_struct, pri->m_body);
}
template<class TArg, class TResult, class TTransport>
bool invoke_http_bin_remote_command(const std::string& url, TArg& out_struct, TResult& result_struct, TTransport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
{
std::string req_param;
epee::StorageNamed::save_struct_as_storage_to_buff(out_struct, req_param);
const http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
return false;
}
if(!pri->m_response_code)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
return false;
}
return epee::StorageNamed::load_struct_from_storage_buff(result_struct, pri->m_body);
}
}
}
}

View File

@@ -26,6 +26,9 @@
#pragma once
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
@@ -35,8 +38,8 @@ namespace epee
virtual ~i_sub_handler(){}
virtual bool update_in( std::string& piece_of_transfer)=0;
virtual void stop(std::string& OUT collect_remains)=0;
virtual bool update_and_stop(std::string& OUT collect_remains, bool& is_changed)
virtual void stop(std::string& collect_remains)=0;
virtual bool update_and_stop(std::string& collect_remains, bool& is_changed)
{
is_changed = true;
bool res = this->update_in(collect_remains);
@@ -63,7 +66,7 @@ namespace epee
{
return m_powner_filter->handle_target_data(piece_of_transfer);
}
virtual void stop(std::string& OUT collect_remains)
virtual void stop(std::string& collect_remains)
{
}

View File

@@ -32,6 +32,9 @@
#include <atlutil.h>
#pragma comment(lib, "Wininet.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -30,11 +30,16 @@
#ifndef _HTTP_SERVER_H_
#define _HTTP_SERVER_H_
#include <boost/optional/optional.hpp>
#include <string>
#include "net_utils_base.h"
#include "to_nonconst_iterator.h"
#include "http_auth.h"
#include "http_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
@@ -49,7 +54,8 @@ namespace net_utils
struct http_server_config
{
std::string m_folder;
std::string m_required_user_agent;
std::vector<std::string> m_access_control_origins;
boost::optional<login> m_user;
critical_section m_lock;
};
@@ -135,6 +141,7 @@ namespace net_utils
size_t m_len_summary, m_len_remain;
config_type& m_config;
bool m_want_close;
size_t m_newlines;
protected:
i_service_endpoint* m_psnd_hndlr;
};
@@ -154,6 +161,7 @@ namespace net_utils
struct custum_handler_config: public http_server_config
{
i_http_server_handler<t_connection_context>* m_phandler;
std::function<void(size_t, uint8_t*)> rng;
};
/************************************************************************/
@@ -169,16 +177,26 @@ namespace net_utils
http_custom_handler(i_service_endpoint* psnd_hndlr, config_type& config, t_connection_context& conn_context)
: simple_http_connection_handler<t_connection_context>(psnd_hndlr, config),
m_config(config),
m_conn_context(conn_context)
m_conn_context(conn_context),
m_auth(m_config.m_user ? http_server_auth{*m_config.m_user, config.rng} : http_server_auth{})
{}
inline bool handle_request(const http_request_info& query_info, http_response_info& response)
{
CHECK_AND_ASSERT_MES(m_config.m_phandler, false, "m_config.m_phandler is NULL!!!!");
const auto auth_response = m_auth.get_response(query_info);
if (auth_response)
{
response = std::move(*auth_response);
return true;
}
//fill with default values
response.m_mime_tipe = "text/plain";
response.m_response_code = 200;
response.m_response_comment = "OK";
response.m_body.clear();
return m_config.m_phandler->handle_http_request(query_info, response, m_conn_context);
}
@@ -202,6 +220,7 @@ namespace net_utils
//simple_http_connection_handler::config_type m_stub_config;
config_type& m_config;
t_connection_context& m_conn_context;
http_server_auth m_auth;
};
}
}

View File

@@ -33,8 +33,12 @@
#include "file_io_utils.h"
#include "net_parse_helpers.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
#define HTTP_MAX_URI_LEN 9000
#define HTTP_MAX_HEADER_LEN 100000
#define HTTP_MAX_STARTING_NEWLINES 8
namespace epee
{
@@ -133,7 +137,7 @@ namespace net_utils
std::string boundary;
if(!match_boundary(content_type, boundary))
{
LOG_PRINT("Failed to match boundary in content type: " << content_type, LOG_LEVEL_0);
MERROR("Failed to match boundary in content type: " << content_type);
return false;
}
@@ -155,7 +159,7 @@ namespace net_utils
pos = body.find(boundary, std::distance(body.begin(), it_begin));
if(std::string::npos == pos)
{
LOG_PRINT("Error: Filed to match closing multipart tag", LOG_LEVEL_0);
MERROR("Error: Filed to match closing multipart tag");
it_end = body.end();
}else
{
@@ -177,7 +181,7 @@ namespace net_utils
out_values.push_back(multipart_entry());
if(!handle_part_of_multipart(it_begin, it_end, out_values.back()))
{
LOG_PRINT("Failed to handle_part_of_multipart", LOG_LEVEL_0);
MERROR("Failed to handle_part_of_multipart");
return false;
}
@@ -200,6 +204,7 @@ namespace net_utils
m_len_remain(0),
m_config(config),
m_want_close(false),
m_newlines(0),
m_psnd_hndlr(psnd_hndlr)
{
@@ -213,6 +218,7 @@ namespace net_utils
m_body_transfer_type = http_body_transfer_undefined;
m_query_info.clear();
m_len_summary = 0;
m_newlines = 0;
return true;
}
//--------------------------------------------------------------------------------------------
@@ -233,6 +239,8 @@ namespace net_utils
bool simple_http_connection_handler<t_connection_context>::handle_buff_in(std::string& buf)
{
size_t ndel;
if(m_cache.size())
m_cache += buf;
else
@@ -250,11 +258,19 @@ namespace net_utils
break;
//check_and_handle_fake_response();
if((m_cache[0] == '\r' || m_cache[0] == '\n'))
ndel = m_cache.find_first_not_of("\r\n");
if (ndel != 0)
{
//some times it could be that before query line cold be few line breaks
//so we have to be calm without panic with assers
m_cache.erase(0, 1);
m_newlines += std::string::npos == ndel ? m_cache.size() : ndel;
if (m_newlines > HTTP_MAX_STARTING_NEWLINES)
{
LOG_ERROR("simple_http_connection_handler::handle_buff_out: Too many starting newlines");
m_state = http_state_error;
return false;
}
m_cache.erase(0, ndel);
break;
}
@@ -313,7 +329,10 @@ namespace net_utils
CHECK_AND_ASSERT_MES(result[0].matched, false, "simple_http_connection_handler::analize_http_method() assert failed...");
http_ver_major = boost::lexical_cast<int>(result[11]);
http_ver_minor = boost::lexical_cast<int>(result[12]);
if(result[4].matched)
if(result[3].matched)
method = http::http_method_options;
else if(result[4].matched)
method = http::http_method_get;
else if(result[5].matched)
method = http::http_method_head;
@@ -331,8 +350,6 @@ namespace net_utils
template<class t_connection_context>
bool simple_http_connection_handler<t_connection_context>::handle_invoke_query_line()
{
LOG_FRAME("simple_http_connection_handler<t_connection_context>::handle_recognize_protocol_out(*)", LOG_LEVEL_3);
STATIC_REGEXP_EXPR_1(rexp_match_command_line, "^(((OPTIONS)|(GET)|(HEAD)|(POST)|(PUT)|(DELETE)|(TRACE)) (\\S+) HTTP/(\\d+).(\\d+))\r?\n", boost::regex::icase | boost::regex::normal);
// 123 4 5 6 7 8 9 10 11 12
//size_t match_len = 0;
@@ -341,7 +358,12 @@ namespace net_utils
{
analize_http_method(result, m_query_info.m_http_method, m_query_info.m_http_ver_hi, m_query_info.m_http_ver_hi);
m_query_info.m_URI = result[10];
parse_uri(m_query_info.m_URI, m_query_info.m_uri_content);
if (!parse_uri(m_query_info.m_URI, m_query_info.m_uri_content))
{
m_state = http_state_error;
MERROR("Failed to parse URI: m_query_info.m_URI");
return false;
}
m_query_info.m_http_method_str = result[2];
m_query_info.m_full_request_str = result[0];
@@ -377,9 +399,7 @@ namespace net_utils
template<class t_connection_context>
bool simple_http_connection_handler<t_connection_context>::analize_cached_request_header_and_invoke_state(size_t pos)
{
//LOG_PRINT_L4("HTTP HEAD:\r\n" << m_cache.substr(0, pos));
LOG_FRAME("simple_http_connection_handler<t_connection_context>::analize_cached_request_header_and_invoke_state(*)", LOG_LEVEL_3);
LOG_PRINT_L3("HTTP HEAD:\r\n" << m_cache.substr(0, pos));
m_query_info.m_full_request_buf_size = pos;
m_query_info.m_request_head.assign(m_cache.begin(), m_cache.begin()+pos);
@@ -391,13 +411,6 @@ namespace net_utils
return false;
}
if (!m_config.m_required_user_agent.empty() && m_query_info.m_header_info.m_user_agent != m_config.m_required_user_agent)
{
LOG_ERROR("simple_http_connection_handler<t_connection_context>::analize_cached_request_header_and_invoke_state(): unexpected user agent: " << m_query_info.m_header_info.m_user_agent);
m_state = http_state_error;
return false;
}
m_cache.erase(0, pos);
std::string req_command_str = m_query_info.m_full_request_str;
@@ -479,11 +492,9 @@ namespace net_utils
template<class t_connection_context>
bool simple_http_connection_handler<t_connection_context>::parse_cached_header(http_header_info& body_info, const std::string& m_cache_to_process, size_t pos)
{
LOG_FRAME("http_stream_filter::parse_cached_header(*)", LOG_LEVEL_3);
STATIC_REGEXP_EXPR_1(rexp_mach_field,
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)|(User-Agent)"
// 12 3 4 5 6 7 8 9 10
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)|(User-Agent)|(Origin)"
// 12 3 4 5 6 7 8 9 10 11
"|([\\w-]+?)) ?: ?((.*?)(\r?\n))[^\t ]",
//11 1213 14
boost::regex::icase | boost::regex::normal);
@@ -497,8 +508,8 @@ namespace net_utils
//lookup all fields and fill well-known fields
while( boost::regex_search( it_current_bound, it_end_bound, result, rexp_mach_field, boost::match_default) && result[0].matched)
{
const size_t field_val = 13;
const size_t field_etc_name = 11;
const size_t field_val = 14;
const size_t field_etc_name = 12;
int i = 2; //start position = 2
if(result[i++].matched)//"Connection"
@@ -519,6 +530,8 @@ namespace net_utils
body_info.m_cookie = result[field_val];
else if(result[i++].matched)//"User-Agent"
body_info.m_user_agent = result[field_val];
else if(result[i++].matched)//"Origin"
body_info.m_origin = result[field_val];
else if(result[i++].matched)//e.t.c (HAVE TO BE MATCHED!)
body_info.m_etc_fields.push_back(std::pair<std::string, std::string>(result[field_etc_name], result[field_val]));
else
@@ -547,18 +560,29 @@ namespace net_utils
template<class t_connection_context>
bool simple_http_connection_handler<t_connection_context>::handle_request_and_send_response(const http::http_request_info& query_info)
{
http_response_info response;
bool res = handle_request(query_info, response);
http_response_info response{};
//CHECK_AND_ASSERT_MES(res, res, "handle_request(query_info, response) returned false" );
bool res = true;
if (query_info.m_http_method != http::http_method_options)
{
res = handle_request(query_info, response);
}
else
{
response.m_response_code = 200;
response.m_response_comment = "OK";
}
std::string response_data = get_response_header(response);
//LOG_PRINT_L0("HTTP_SEND: << \r\n" << response_data + response.m_body);
LOG_PRINT_L3("HTTP_RESPONSE_HEAD: << \r\n" << response_data);
m_psnd_hndlr->do_send((void*)response_data.data(), response_data.size());
if(response.m_body.size())
if ((response.m_body.size() && (query_info.m_http_method != http::http_method_head)) || (query_info.m_http_method == http::http_method_options))
m_psnd_hndlr->do_send((void*)response.m_body.data(), response.m_body.size());
m_psnd_hndlr->send_done();
return res;
}
//-----------------------------------------------------------------------------------
@@ -576,7 +600,7 @@ namespace net_utils
m_config.m_lock.unlock();
if(!file_io_utils::load_file_to_string(destination_file_path.c_str(), response.m_body))
{
LOG_PRINT("URI \""<< query_info.m_full_request_str.substr(0, query_info.m_full_request_str.size()-2) << "\" [" << destination_file_path << "] Not Found (404 )" , LOG_LEVEL_1);
MWARNING("URI \""<< query_info.m_full_request_str.substr(0, query_info.m_full_request_str.size()-2) << "\" [" << destination_file_path << "] Not Found (404 )");
response.m_body = get_not_found_response_body(query_info.m_URI);
response.m_response_code = 404;
response.m_response_comment = "Not found";
@@ -584,12 +608,11 @@ namespace net_utils
return true;
}
LOG_PRINT(" -->> " << query_info.m_full_request_str << "\r\n<<--OK" , LOG_LEVEL_3);
MDEBUG(" -->> " << query_info.m_full_request_str << "\r\n<<--OK");
response.m_response_code = 200;
response.m_response_comment = "OK";
response.m_mime_tipe = get_file_mime_tipe(uri_to_path);
return true;
}
//-----------------------------------------------------------------------------------
@@ -601,8 +624,12 @@ namespace net_utils
"Server: Epee-based\r\n"
"Content-Length: ";
buf += boost::lexical_cast<std::string>(response.m_body.size()) + "\r\n";
buf += "Content-Type: ";
buf += response.m_mime_tipe + "\r\n";
if(!response.m_mime_tipe.empty())
{
buf += "Content-Type: ";
buf += response.m_mime_tipe + "\r\n";
}
buf += "Last-Modified: ";
time_t tm;
@@ -622,6 +649,22 @@ namespace net_utils
m_want_close = true;
}
}
// Cross-origin resource sharing
if(m_query_info.m_header_info.m_origin.size())
{
if (std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), m_query_info.m_header_info.m_origin))
{
buf += "Access-Control-Allow-Origin: ";
buf += m_query_info.m_header_info.m_origin;
buf += "\r\n";
buf += "Access-Control-Expose-Headers: www-authenticate\r\n";
if (m_query_info.m_http_method == http::http_method_options)
buf += "Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With\r\n";
buf += "Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS\r\n";
}
}
//add additional fields, if it is
for(fields_list::const_iterator it = response.m_additional_fields.begin(); it!=response.m_additional_fields.end(); it++)
buf += it->first + ":" + it->second + "\r\n";

View File

@@ -32,6 +32,10 @@
#include "abstract_tcp_server_cp.h"
#include "http_server.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -32,6 +32,10 @@
#include "abstract_tcp_server2.h"
#include "http_protocol_handler.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -31,12 +31,15 @@
#include "storages/portable_storage.h"
#include "storages/portable_storage_template_helper.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
#define CHAIN_HTTP_TO_MAP2(context_type) bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, \
epee::net_utils::http::http_response_info& response, \
context_type& m_conn_context) \
{\
LOG_PRINT_L2("HTTP [" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "] " << query_info.m_http_method_str << " " << query_info.m_URI); \
LOG_PRINT_L2("HTTP [" << m_conn_context.m_remote_address.host_str() << "] " << query_info.m_http_method_str << " " << query_info.m_URI); \
response.m_response_code = 200; \
response.m_response_comment = "Ok"; \
if(!handle_http_request_map(query_info, response, m_conn_context)) \
@@ -77,7 +80,7 @@
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = "application/json"; \
response_info.m_header_info.m_content_type = " application/json"; \
LOG_PRINT( s_pattern << " processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
MDEBUG( s_pattern << " processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms"); \
}
#define MAP_URI_AUTO_JON2(s_pattern, callback_f, command_type) MAP_URI_AUTO_JON2_IF(s_pattern, callback_f, command_type, true)
@@ -104,7 +107,7 @@
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = " application/octet-stream"; \
response_info.m_header_info.m_content_type = " application/octet-stream"; \
LOG_PRINT( s_pattern << "() processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
MDEBUG( s_pattern << "() processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms"); \
}
#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);handled = true;}
@@ -166,7 +169,7 @@
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = "application/json"; \
response_info.m_header_info.m_content_type = " application/json"; \
LOG_PRINT( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2);
MDEBUG( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms");
#define MAP_JON_RPC_WE_IF(method_name, callback_f, command_type, cond) \
else if((callback_name == method_name) && (cond)) \

View File

@@ -36,6 +36,9 @@
#include "net/http_server_cp2.h"
#include "net/http_server_handlers_map2.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
@@ -52,19 +55,25 @@ namespace epee
: m_net_server(external_io_service)
{}
bool init(const std::string& bind_port = "0", const std::string& bind_ip = "0.0.0.0", const std::string &user_agent = "")
bool init(std::function<void(size_t, uint8_t*)> rng, const std::string& bind_port = "0", const std::string& bind_ip = "0.0.0.0",
std::vector<std::string> access_control_origins = std::vector<std::string>(),
boost::optional<net_utils::http::login> user = boost::none)
{
//set self as callback handler
m_net_server.get_config_object().m_phandler = static_cast<t_child_class*>(this);
m_net_server.get_config_object().rng = std::move(rng);
//here set folder for hosting reqests
m_net_server.get_config_object().m_folder = "";
// workaround till we get auth/encryption
m_net_server.get_config_object().m_required_user_agent = user_agent;
//set access control allow origins if configured
std::sort(access_control_origins.begin(), access_control_origins.end());
m_net_server.get_config_object().m_access_control_origins = std::move(access_control_origins);
LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port);
m_net_server.get_config_object().m_user = std::move(user);
MGINFO("Binding on " << bind_ip << ":" << bind_port);
bool res = m_net_server.init_server(bind_port, bind_ip);
if(!res)
{
@@ -77,15 +86,14 @@ namespace epee
bool run(size_t threads_count, bool wait = true)
{
//go to loop
LOG_PRINT("Run net_service loop( " << threads_count << " threads)...", LOG_LEVEL_0);
_fact_c("net/RPClog", "Run net_service loop( " << threads_count << " threads)...");
MINFO("Run net_service loop( " << threads_count << " threads)...");
if(!m_net_server.run_server(threads_count, wait))
{
LOG_ERROR("Failed to run net tcp server!");
}
if(wait)
LOG_PRINT("net_service loop stopped.", LOG_LEVEL_0);
MINFO("net_service loop stopped.");
return true;
}
@@ -110,6 +118,11 @@ namespace epee
return m_net_server.get_binded_port();
}
long get_connections_count() const
{
return m_net_server.get_connections_count();
}
protected:
net_utils::boosted_tcp_server<net_utils::http::http_custom_handler<t_connection_context> > m_net_server;
};

View File

@@ -87,6 +87,7 @@ namespace levin
virtual void on_connection_new(t_connection_context& context){};
virtual void on_connection_close(t_connection_context& context){};
virtual ~levin_commands_handler(){}
};
#define LEVIN_OK 0

View File

@@ -30,6 +30,10 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#include "string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace levin
@@ -95,7 +99,7 @@ int levin_client_impl::invoke(int command, const std::string& in_buff, std::stri
if(head.m_signature!=LEVIN_SIGNATURE)
{
LOG_PRINT_L1("Signature missmatch in response");
LOG_PRINT_L1("Signature mismatch in response");
return -1;
}
@@ -156,7 +160,7 @@ inline
if(head.m_signature!=LEVIN_SIGNATURE)
{
LOG_PRINT_L1("Signature missmatch in response");
LOG_PRINT_L1("Signature mismatch in response");
return -1;
}

View File

@@ -31,6 +31,9 @@
#include "net_helper.h"
#include "levin_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
@@ -49,6 +52,7 @@ namespace levin
class levin_client_async
{
levin_commands_handler* m_pcommands_handler;
void (*commands_handler_destroy)(levin_commands_handler*);
volatile uint32_t m_is_stop;
volatile uint32_t m_threads_count;
::critical_section m_send_lock;
@@ -82,9 +86,9 @@ namespace levin
::critical_section m_connection_lock;
net_utils::blocked_mode_client m_transport;
public:
levin_client_async():m_pcommands_handler(NULL), m_is_stop(0), m_threads_count(0), m_invoke_data_ready(0), m_invoke_is_active(0)
levin_client_async():m_pcommands_handler(NULL), commands_handler_destroy(NULL), m_is_stop(0), m_threads_count(0), m_invoke_data_ready(0), m_invoke_is_active(0)
{}
levin_client_async(const levin_client_async& /*v*/):m_pcommands_handler(NULL), m_is_stop(0), m_threads_count(0), m_invoke_data_ready(0), m_invoke_is_active(0)
levin_client_async(const levin_client_async& /*v*/):m_pcommands_handler(NULL), commands_handler_destroy(NULL), m_is_stop(0), m_threads_count(0), m_invoke_data_ready(0), m_invoke_is_active(0)
{}
~levin_client_async()
{
@@ -94,11 +98,16 @@ namespace levin
while(boost::interprocess::ipcdetail::atomic_read32(&m_threads_count))
::Sleep(100);
set_handler(NULL);
}
void set_handler(levin_commands_handler* phandler)
void set_handler(levin_commands_handler* phandler, void (*destroy)(levin_commands_handler*) = NULL)
{
if (commands_handler_destroy && m_pcommands_handler)
(*commands_handler_destroy)(m_pcommands_handler);
m_pcommands_handler = phandler;
m_pcommands_handler_destroy = destroy;
}
bool connect(uint32_t ip, uint32_t port, uint32_t timeout)
@@ -141,7 +150,7 @@ namespace levin
{
if( !reconnect() )
{
LOG_ERROR("Reconnect Failed. Failed to invoke() becouse not connected!");
LOG_ERROR("Reconnect Failed. Failed to invoke() because not connected!");
return false;
}
}
@@ -405,7 +414,7 @@ namespace levin
if(head.m_signature!=LEVIN_SIGNATURE)
{
LOG_ERROR("Signature missmatch in response");
LOG_ERROR("Signature mismatch in response");
return false;
}
@@ -489,8 +498,7 @@ namespace levin
{
net_utils::connection_context_base conn_context;
conn_context.m_remote_ip = m_ip;
conn_context.m_remote_port = m_port;
conn_context.m_remote_address = m_address;
if(head.m_have_to_return_data)
{
std::string return_buff;

View File

@@ -31,6 +31,9 @@
#include "levin_base.h"
#include "serializeble_struct_helper.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace levin
@@ -91,7 +94,7 @@ namespace levin
}
if(head.m_cb != buff.size()-sizeof(levin::bucket_head))
{
LOG_PRINT_L3("sizes missmatch, at load_struct_from_levin_message");
LOG_PRINT_L3("sizes mismatch, at load_struct_from_levin_message");
return false;
}
@@ -118,7 +121,7 @@ namespace levin
}
if(head.m_cb != buff.size()-sizeof(levin::bucket_head))
{
LOG_ERROR("sizes missmatch, at load_struct_from_levin_message");
LOG_ERROR("sizes mismatch, at load_struct_from_levin_message");
return false;
}

View File

@@ -32,6 +32,9 @@
#include <boost/uuid/uuid_generators.hpp>
#include "levin_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace levin
@@ -40,6 +43,8 @@ namespace levin
struct protocl_handler_config
{
levin_commands_handler<t_connection_context>* m_pcommands_handler;
void (*m_pcommands_handler_destroy)(levin_commands_handler<t_connection_context>*);
~protocl_handler_config() { if (m_pcommands_handler && m_pcommands_handler_destroy) (*m_pcommands_handler_destroy)(m_pcommands_handler); }
};
template<class t_connection_context = net_utils::connection_context_base>
@@ -85,7 +90,7 @@ namespace levin
{
if(!m_config.m_pcommands_handler)
{
LOG_ERROR("Command handler not set!");
LOG_ERROR_CC(m_conn_context, "Command handler not set!");
return false;
}
m_cach_in_buffer.append((const char*)ptr, cb);
@@ -100,7 +105,7 @@ namespace levin
{
if(m_cach_in_buffer.size() >= sizeof(uint64_t) && *((uint64_t*)m_cach_in_buffer.data()) != LEVIN_SIGNATURE)
{
LOG_ERROR("Signature missmatch on accepted connection");
LOG_ERROR_CC(m_conn_context, "Signature mismatch on accepted connection");
return false;
}
is_continue = false;
@@ -110,7 +115,7 @@ namespace levin
bucket_head* phead = (bucket_head*)m_cach_in_buffer.data();
if(LEVIN_SIGNATURE != phead->m_signature)
{
LOG_ERROR("Signature missmatch on accepted connection");
LOG_ERROR_CC(m_conn_context, "Signature mismatch on accepted connection");
return false;
}
m_current_head = *phead;
@@ -154,7 +159,7 @@ namespace levin
m_state = conn_state_reading_head;
break;
default:
LOG_ERROR("Undefined state in levin_server_impl::connection_handler, m_state=" << m_state);
LOG_ERROR_CC(m_conn_context, "Undefined state in levin_server_impl::connection_handler, m_state=" << m_state);
return false;
}
}

View File

@@ -25,6 +25,7 @@
//
#pragma once
#include <boost/asio/deadline_timer.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/unordered_map.hpp>
#include <boost/interprocess/detail/atomic.hpp>
@@ -34,10 +35,18 @@
#include "levin_base.h"
#include "misc_language.h"
#include "syncobj.h"
#include "misc_os_dependent.h"
#include <random>
#include <chrono>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MIN_BYTES_WANTED
#define MIN_BYTES_WANTED 512
#endif
namespace epee
{
@@ -65,27 +74,36 @@ class async_protocol_handler_config
friend class async_protocol_handler<t_connection_context>;
levin_commands_handler<t_connection_context>* m_pcommands_handler;
void (*m_pcommands_handler_destroy)(levin_commands_handler<t_connection_context>*);
void delete_connections (size_t count, bool incoming);
public:
typedef t_connection_context connection_context;
levin_commands_handler<t_connection_context>* m_pcommands_handler;
uint64_t m_max_packet_size;
uint64_t m_invoke_timeout;
int invoke(int command, const std::string& in_buff, std::string& buff_out, boost::uuids::uuid connection_id);
template<class callback_t>
int invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, callback_t cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
int invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
int notify(int command, const std::string& in_buff, boost::uuids::uuid connection_id);
bool close(boost::uuids::uuid connection_id);
bool update_connection_context(const t_connection_context& contxt);
bool request_callback(boost::uuids::uuid connection_id);
template<class callback_t>
bool foreach_connection(callback_t cb);
bool foreach_connection(const callback_t &cb);
template<class callback_t>
bool for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb);
size_t get_connections_count();
void set_handler(levin_commands_handler<t_connection_context>* handler, void (*destroy)(levin_commands_handler<t_connection_context>*) = NULL);
async_protocol_handler_config():m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE)
async_protocol_handler_config():m_pcommands_handler(NULL), m_pcommands_handler_destroy(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE)
{}
~async_protocol_handler_config() { set_handler(NULL, NULL); }
void del_out_connections(size_t count);
void del_in_connections(size_t count);
};
@@ -136,22 +154,24 @@ public:
virtual bool is_timer_started() const=0;
virtual void cancel()=0;
virtual bool cancel_timer()=0;
virtual void reset_timer()=0;
};
template <class callback_t>
struct anvoke_handler: invoke_response_handler_base
{
anvoke_handler(const callback_t& cb, uint64_t timeout, async_protocol_handler& con, int command)
:m_cb(cb), m_con(con), m_timer(con.m_pservice_endpoint->get_io_service()), m_timer_started(false),
:m_cb(cb), m_timeout(timeout), m_con(con), m_timer(con.m_pservice_endpoint->get_io_service()), m_timer_started(false),
m_cancel_timer_called(false), m_timer_cancelled(false), m_command(command)
{
if(m_con.start_outer_call())
{
MDEBUG(con.get_context_ref() << "anvoke_handler, timeout: " << timeout);
m_timer.expires_from_now(boost::posix_time::milliseconds(timeout));
m_timer.async_wait([&con, command, cb](const boost::system::error_code& ec)
m_timer.async_wait([&con, command, cb, timeout](const boost::system::error_code& ec)
{
if(ec == boost::asio::error::operation_aborted)
return;
LOG_PRINT_CC(con.get_context_ref(), "Timeout on invoke operation happened, command: " << command, LOG_LEVEL_2);
MINFO(con.get_context_ref() << "Timeout on invoke operation happened, command: " << command << " timeout: " << timeout);
std::string fake;
cb(LEVIN_ERROR_CONNECTION_TIMEDOUT, fake, con.get_context_ref());
con.close();
@@ -168,6 +188,7 @@ public:
bool m_timer_started;
bool m_cancel_timer_called;
bool m_timer_cancelled;
uint64_t m_timeout;
int m_command;
virtual bool handle(int res, const std::string& buff, typename async_protocol_handler::connection_context& context)
{
@@ -200,12 +221,34 @@ public:
}
return m_timer_cancelled;
}
virtual void reset_timer()
{
boost::system::error_code ignored_ec;
if (!m_cancel_timer_called && m_timer.cancel(ignored_ec) > 0)
{
callback_t& cb = m_cb;
uint64_t timeout = m_timeout;
async_protocol_handler& con = m_con;
int command = m_command;
m_timer.expires_from_now(boost::posix_time::milliseconds(m_timeout));
m_timer.async_wait([&con, cb, command, timeout](const boost::system::error_code& ec)
{
if(ec == boost::asio::error::operation_aborted)
return;
MINFO(con.get_context_ref() << "Timeout on invoke operation happened, command: " << command << " timeout: " << timeout);
std::string fake;
cb(LEVIN_ERROR_CONNECTION_TIMEDOUT, fake, con.get_context_ref());
con.close();
con.finish_outer_call();
});
}
}
};
critical_section m_invoke_response_handlers_lock;
std::list<boost::shared_ptr<invoke_response_handler_base> > m_invoke_response_handlers;
template<class callback_t>
bool add_invoke_response_handler(callback_t cb, uint64_t timeout, async_protocol_handler& con, int command)
bool add_invoke_response_handler(const callback_t &cb, uint64_t timeout, async_protocol_handler& con, int command)
{
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<anvoke_handler<callback_t>>(cb, timeout, con, command));
@@ -244,15 +287,15 @@ public:
}
CHECK_AND_ASSERT_MES_NO_RET(0 == boost::interprocess::ipcdetail::atomic_read32(&m_wait_count), "Failed to wait for operation completion. m_wait_count = " << m_wait_count);
LOG_PRINT_CC(m_connection_context, "~async_protocol_handler()", LOG_LEVEL_4);
MTRACE(m_connection_context << "~async_protocol_handler()");
}
bool start_outer_call()
{
LOG_PRINT_CC_L4(m_connection_context, "[levin_protocol] -->> start_outer_call");
MTRACE(m_connection_context << "[levin_protocol] -->> start_outer_call");
if(!m_pservice_endpoint->add_ref())
{
LOG_PRINT_CC_RED(m_connection_context, "[levin_protocol] -->> start_outer_call failed", LOG_LEVEL_4);
MERROR(m_connection_context << "[levin_protocol] -->> start_outer_call failed");
return false;
}
boost::interprocess::ipcdetail::atomic_inc32(&m_wait_count);
@@ -260,7 +303,7 @@ public:
}
bool finish_outer_call()
{
LOG_PRINT_CC_L4(m_connection_context, "[levin_protocol] <<-- finish_outer_call");
MTRACE(m_connection_context << "[levin_protocol] <<-- finish_outer_call");
boost::interprocess::ipcdetail::atomic_dec32(&m_wait_count);
m_pservice_endpoint->release();
return true;
@@ -316,13 +359,13 @@ public:
if(!m_config.m_pcommands_handler)
{
LOG_ERROR_CC(m_connection_context, "Commands handler not set!");
MERROR(m_connection_context << "Commands handler not set!");
return false;
}
if(m_cache_in_buffer.size() + cb > m_config.m_max_packet_size)
{
LOG_ERROR_CC(m_connection_context, "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
MWARNING(m_connection_context << "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
<< ", packet received " << m_cache_in_buffer.size() + cb
<< ", connection will be closed.");
return false;
@@ -339,6 +382,17 @@ public:
if(m_cache_in_buffer.size() < m_current_head.m_cb)
{
is_continue = false;
if(cb >= MIN_BYTES_WANTED)
{
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
if (!m_invoke_response_handlers.empty())
{
//async call scenario
boost::shared_ptr<invoke_response_handler_base> response_handler = m_invoke_response_handlers.front();
response_handler->reset_timer();
MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb);
}
}
break;
}
{
@@ -353,7 +407,7 @@ public:
bool is_response = (m_oponent_protocol_ver == LEVIN_PROTOCOL_VER_1 && m_current_head.m_flags&LEVIN_PACKET_RESPONSE);
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_RECIEVED. [len=" << m_current_head.m_cb
MDEBUG(m_connection_context << "LEVIN_PACKET_RECIEVED. [len=" << m_current_head.m_cb
<< ", flags" << m_current_head.m_flags
<< ", r?=" << m_current_head.m_have_to_return_data
<<", cmd = " << m_current_head.m_command
@@ -381,7 +435,7 @@ public:
//use sync call scenario
if(!boost::interprocess::ipcdetail::atomic_read32(&m_wait_count) && !boost::interprocess::ipcdetail::atomic_read32(&m_close_called))
{
LOG_ERROR_CC(m_connection_context, "no active invoke when response came, wtf?");
MERROR(m_connection_context << "no active invoke when response came, wtf?");
return false;
}else
{
@@ -413,7 +467,7 @@ public:
if(!m_pservice_endpoint->do_send(send_buff.data(), send_buff.size()))
return false;
CRITICAL_REGION_END();
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_SENT. [len=" << m_current_head.m_cb
MDEBUG(m_connection_context << "LEVIN_PACKET_SENT. [len=" << m_current_head.m_cb
<< ", flags" << m_current_head.m_flags
<< ", r?=" << m_current_head.m_have_to_return_data
<<", cmd = " << m_current_head.m_command
@@ -431,7 +485,7 @@ public:
{
if(m_cache_in_buffer.size() >= sizeof(uint64_t) && *((uint64_t*)m_cache_in_buffer.data()) != LEVIN_SIGNATURE)
{
LOG_ERROR_CC(m_connection_context, "Signature mismatch, connection will be closed");
MWARNING(m_connection_context << "Signature mismatch, connection will be closed");
return false;
}
is_continue = false;
@@ -478,7 +532,7 @@ public:
}
template<class callback_t>
bool async_invoke(int command, const std::string& in_buff, callback_t cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
bool async_invoke(int command, const std::string& in_buff, const callback_t &cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
{
misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler::finish_outer_call, this));
@@ -585,19 +639,25 @@ public:
}
CRITICAL_REGION_END();
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_SENT. [len=" << head.m_cb
MDEBUG(m_connection_context << "LEVIN_PACKET_SENT. [len=" << head.m_cb
<< ", f=" << head.m_flags
<< ", r?=" << head.m_have_to_return_data
<< ", cmd = " << head.m_command
<< ", ver=" << head.m_protocol_version);
uint64_t ticks_start = misc_utils::get_tick_count();
size_t prev_size = 0;
while(!boost::interprocess::ipcdetail::atomic_read32(&m_invoke_buf_ready) && !m_deletion_initiated && !m_protocol_released)
{
if(m_cache_in_buffer.size() - prev_size >= MIN_BYTES_WANTED)
{
prev_size = m_cache_in_buffer.size();
ticks_start = misc_utils::get_tick_count();
}
if(misc_utils::get_tick_count() - ticks_start > m_config.m_invoke_timeout)
{
LOG_PRINT_CC_L2(m_connection_context, "invoke timeout (" << m_config.m_invoke_timeout << "), closing connection ");
MWARNING(m_connection_context << "invoke timeout (" << m_config.m_invoke_timeout << "), closing connection ");
close();
return LEVIN_ERROR_CONNECTION_TIMEDOUT;
}
@@ -650,7 +710,7 @@ public:
return -1;
}
CRITICAL_REGION_END();
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_SENT. [len=" << head.m_cb <<
LOG_DEBUG_CC(m_connection_context, "LEVIN_PACKET_SENT. [len=" << head.m_cb <<
", f=" << head.m_flags <<
", r?=" << head.m_have_to_return_data <<
", cmd = " << head.m_command <<
@@ -674,32 +734,50 @@ 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;
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);
}
// 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);
close(*i);
connections.erase(i);
}
catch (const std::out_of_range &e)
{
MWARNING("Connection not found in m_connects, continuing");
}
--count;
}
CRITICAL_REGION_END();
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
void async_protocol_handler_config<t_connection_context>::del_out_connections(size_t count)
{
std::vector <boost::uuids::uuid> out_connections;
CRITICAL_REGION_BEGIN(m_connects_lock);
for (auto& c: m_connects)
{
if (!c.second->m_connection_context.m_is_income)
out_connections.push_back(c.first);
}
if (out_connections.size() == 0)
return;
// close random out connections
// TODO or better just keep removing random elements (performance)
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(out_connections.begin(), out_connections.end(), std::default_random_engine(seed));
while (count > 0 && out_connections.size() > 0)
{
close(*out_connections.begin());
del_connection(m_connects.at(*out_connections.begin()));
out_connections.erase(out_connections.begin());
--count;
}
CRITICAL_REGION_END();
delete_connections(count, false);
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
void async_protocol_handler_config<t_connection_context>::del_in_connections(size_t count)
{
delete_connections(count, true);
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
@@ -739,7 +817,7 @@ int async_protocol_handler_config<t_connection_context>::invoke(int command, con
}
//------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t>
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, callback_t cb, size_t timeout)
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout)
{
async_protocol_handler<t_connection_context>* aph;
int r = find_and_lock_connection(connection_id, aph);
@@ -747,7 +825,7 @@ 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(callback_t cb)
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)
@@ -759,6 +837,18 @@ bool async_protocol_handler_config<t_connection_context>::foreach_connection(cal
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)
return false;
if(!cb(aph->get_context_ref()))
return false;
return true;
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
size_t async_protocol_handler_config<t_connection_context>::get_connections_count()
{
@@ -767,6 +857,15 @@ size_t async_protocol_handler_config<t_connection_context>::get_connections_coun
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
void async_protocol_handler_config<t_connection_context>::set_handler(levin_commands_handler<t_connection_context>* handler, void (*destroy)(levin_commands_handler<t_connection_context>*))
{
if (m_pcommands_handler && m_pcommands_handler_destroy)
(*m_pcommands_handler_destroy)(m_pcommands_handler);
m_pcommands_handler = handler;
m_pcommands_handler_destroy = destroy;
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
int async_protocol_handler_config<t_connection_context>::notify(int command, const std::string& in_buff, boost::uuids::uuid connection_id)
{
async_protocol_handler<t_connection_context>* aph;

View File

@@ -48,7 +48,7 @@ namespace epee
if( (ip | 0xffffff00) == 0xffffffac)
{
uint32_t second_num = (ip << 8) & 0xff000000;
uint32_t second_num = (ip >> 8) & 0xff;
if(second_num >= 16 && second_num <= 31 )
return true;
}

View File

@@ -31,20 +31,19 @@
//#include <Winsock2.h>
//#include <Ws2tcpip.h>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <istream>
#include <ostream>
#include <string>
#include <boost/version.hpp>
#include <boost/asio.hpp>
#include <boost/preprocessor/selection/min.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/interprocess/detail/atomic.hpp>
#include "net/net_utils_base.h"
#include "misc_language.h"
//#include "profile_tools.h"
#include "../string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MAKE_IP
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
@@ -81,11 +80,13 @@ namespace net_utils
public:
inline
blocked_mode_client():m_socket(m_io_service),
m_initialized(false),
blocked_mode_client():m_initialized(false),
m_connected(false),
m_deadline(m_io_service),
m_shutdowned(0)
m_shutdowned(0),
m_ssl(false),
m_ctx(boost::asio::ssl::context::sslv23),
m_ssl_socket(m_io_service,m_ctx)
{
@@ -95,7 +96,7 @@ namespace net_utils
// No deadline is required until the first socket operation is started. We
// set the deadline to positive infinity so that the actor takes no action
// until a specific deadline is set.
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
// Start the persistent actor that checks for deadline expiry.
check_deadline();
@@ -108,29 +109,26 @@ namespace net_utils
shutdown();
}
inline void set_recv_timeout(int reciev_timeout)
{
m_reciev_timeout = reciev_timeout;
}
inline
bool connect(const std::string& addr, int port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
bool connect(const std::string& addr, int port, std::chrono::milliseconds timeout, bool ssl = false, const std::string& bind_ip = "0.0.0.0")
{
return connect(addr, std::to_string(port), connect_timeout, reciev_timeout, bind_ip);
return connect(addr, std::to_string(port), timeout, ssl, bind_ip);
}
inline
bool connect(const std::string& addr, const std::string& port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
bool connect(const std::string& addr, const std::string& port, std::chrono::milliseconds timeout, bool ssl = false, const std::string& bind_ip = "0.0.0.0")
{
m_connect_timeout = connect_timeout;
m_reciev_timeout = reciev_timeout;
m_connected = false;
if(!m_reciev_timeout)
m_reciev_timeout = m_connect_timeout;
m_ssl = ssl;
try
{
m_socket.close();
m_ssl_socket.next_layer().close();
// Set SSL options
// disable sslv2
m_ctx.set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2);
m_ctx.set_default_verify_paths();
// Get a list of endpoints corresponding to the server name.
@@ -153,53 +151,59 @@ namespace net_utils
boost::asio::ip::tcp::endpoint remote_endpoint(*iterator);
m_socket.open(remote_endpoint.protocol());
m_ssl_socket.next_layer().open(remote_endpoint.protocol());
if(bind_ip != "0.0.0.0" && bind_ip != "0" && bind_ip != "" )
{
boost::asio::ip::tcp::endpoint local_endpoint(boost::asio::ip::address::from_string(addr.c_str()), 0);
m_socket.bind(local_endpoint);
m_ssl_socket.next_layer().bind(local_endpoint);
}
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_connect_timeout));
m_deadline.expires_from_now(timeout);
boost::system::error_code ec = boost::asio::error::would_block;
//m_socket.connect(remote_endpoint);
m_socket.async_connect(remote_endpoint, boost::lambda::var(ec) = boost::lambda::_1);
m_ssl_socket.next_layer().async_connect(remote_endpoint, boost::lambda::var(ec) = boost::lambda::_1);
while (ec == boost::asio::error::would_block)
{
m_io_service.run_one();
}
if (!ec && m_socket.is_open())
if (!ec && m_ssl_socket.next_layer().is_open())
{
m_connected = true;
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
// SSL Options
if(m_ssl) {
// Disable verification of host certificate
m_ssl_socket.set_verify_mode(boost::asio::ssl::verify_peer);
// Handshake
m_ssl_socket.next_layer().set_option(boost::asio::ip::tcp::no_delay(true));
m_ssl_socket.handshake(boost::asio::ssl::stream_base::client);
}
return true;
}else
{
LOG_PRINT("Some problems at connect, message: " << ec.message(), LOG_LEVEL_3);
MWARNING("Some problems at connect, message: " << ec.message());
return false;
}
}
catch(const boost::system::system_error& er)
{
LOG_PRINT("Some problems at connect, message: " << er.what(), LOG_LEVEL_4);
MDEBUG("Some problems at connect, message: " << er.what());
return false;
}
catch(...)
{
LOG_PRINT("Some fatal problems.", LOG_LEVEL_4);
MDEBUG("Some fatal problems.");
return false;
}
return true;
}
inline
bool disconnect()
{
@@ -208,8 +212,9 @@ namespace net_utils
if(m_connected)
{
m_connected = false;
m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both);
if(m_ssl)
shutdown_ssl();
m_ssl_socket.next_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both);
}
}
@@ -228,12 +233,12 @@ namespace net_utils
inline
bool send(const std::string& buff)
bool send(const std::string& buff, std::chrono::milliseconds timeout)
{
try
{
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
m_deadline.expires_from_now(timeout);
// Set up the variable that receives the result of the asynchronous
// operation. The error code is set to would_block to signal that the
@@ -246,7 +251,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.
boost::asio::async_write(m_socket, boost::asio::buffer(buff), boost::lambda::var(ec) = boost::lambda::_1);
async_write(buff.c_str(), buff.size(), ec);
// Block until the asynchronous operation has completed.
while (ec == boost::asio::error::would_block)
@@ -261,7 +266,7 @@ namespace net_utils
return false;
}else
{
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
}
@@ -308,9 +313,7 @@ namespace net_utils
*/
boost::system::error_code ec;
size_t writen = m_socket.write_some(boost::asio::buffer(data, sz), ec);
size_t writen = write(data, sz, ec);
if (!writen || ec)
{
@@ -319,7 +322,7 @@ namespace net_utils
return false;
}else
{
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
}
@@ -340,14 +343,11 @@ namespace net_utils
bool is_connected()
{
return m_connected && m_socket.is_open();
//TRY_ENTRY()
//return m_socket.is_open();
//CATCH_ENTRY_L0("is_connected", false)
return m_connected && m_ssl_socket.next_layer().is_open();
}
inline
bool recv(std::string& buff)
bool recv(std::string& buff, std::chrono::milliseconds timeout)
{
try
@@ -355,7 +355,7 @@ namespace net_utils
// Set a deadline for the asynchronous operation. Since this function uses
// a composed operation (async_read_until), the deadline applies to the
// entire operation, rather than individual reads from the socket.
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
m_deadline.expires_from_now(timeout);
// Set up the variable that receives the result of the asynchronous
// operation. The error code is set to would_block to signal that the
@@ -375,8 +375,8 @@ namespace net_utils
handler_obj hndlr(ec, bytes_transfered);
char local_buff[10000] = {0};
//m_socket.async_read_some(boost::asio::buffer(local_buff, sizeof(local_buff)), hndlr);
boost::asio::async_read(m_socket, boost::asio::buffer(local_buff, sizeof(local_buff)), boost::asio::transfer_at_least(1), hndlr);
async_read(local_buff, sizeof(local_buff), boost::asio::transfer_at_least(1), hndlr);
// Block until the asynchronous operation has completed.
while (ec == boost::asio::error::would_block && !boost::interprocess::ipcdetail::atomic_read32(&m_shutdowned))
@@ -387,21 +387,21 @@ namespace net_utils
if (ec)
{
LOG_PRINT_L4("READ ENDS: Connection err_code " << ec.value());
MTRACE("READ ENDS: Connection err_code " << ec.value());
if(ec == boost::asio::error::eof)
{
LOG_PRINT_L4("Connection err_code eof.");
MTRACE("Connection err_code eof.");
//connection closed there, empty
return true;
}
LOG_PRINT_L3("Problems at read: " << ec.message());
MDEBUG("Problems at read: " << ec.message());
m_connected = false;
return false;
}else
{
LOG_PRINT_L4("READ ENDS: Success. bytes_tr: " << bytes_transfered);
m_deadline.expires_at(boost::posix_time::pos_infin);
MTRACE("READ ENDS: Success. bytes_tr: " << bytes_transfered);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
/*if(!bytes_transfered)
@@ -429,7 +429,7 @@ namespace net_utils
}
inline bool recv_n(std::string& buff, int64_t sz)
inline bool recv_n(std::string& buff, int64_t sz, std::chrono::milliseconds timeout)
{
try
@@ -437,7 +437,7 @@ namespace net_utils
// Set a deadline for the asynchronous operation. Since this function uses
// a composed operation (async_read_until), the deadline applies to the
// entire operation, rather than individual reads from the socket.
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
m_deadline.expires_from_now(timeout);
// Set up the variable that receives the result of the asynchronous
// operation. The error code is set to would_block to signal that the
@@ -457,10 +457,8 @@ namespace net_utils
handler_obj hndlr(ec, bytes_transfered);
//char local_buff[10000] = {0};
boost::asio::async_read(m_socket, boost::asio::buffer((char*)buff.data(), buff.size()), boost::asio::transfer_at_least(buff.size()), hndlr);
async_read((char*)buff.data(), buff.size(), boost::asio::transfer_at_least(buff.size()), hndlr);
// Block until the asynchronous operation has completed.
while (ec == boost::asio::error::would_block && !boost::interprocess::ipcdetail::atomic_read32(&m_shutdowned))
{
@@ -474,12 +472,12 @@ namespace net_utils
return false;
}else
{
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
if(bytes_transfered != buff.size())
{
LOG_ERROR("Transferred missmatch with transfer_at_least value: m_bytes_transferred=" << bytes_transfered << " at_least value=" << buff.size());
LOG_ERROR("Transferred mismatch with transfer_at_least value: m_bytes_transferred=" << bytes_transfered << " at_least value=" << buff.size());
return false;
}
@@ -506,10 +504,18 @@ namespace net_utils
bool shutdown()
{
m_deadline.cancel();
boost::system::error_code ignored_ec;
m_socket.cancel(ignored_ec);
m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
m_socket.close(ignored_ec);
boost::system::error_code ec;
if(m_ssl)
shutdown_ssl();
m_ssl_socket.next_layer().cancel(ec);
if(ec)
MDEBUG("Problems at cancel: " << ec.message());
m_ssl_socket.next_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
if(ec)
MDEBUG("Problems at shutdown: " << ec.message());
m_ssl_socket.next_layer().close(ec);
if(ec)
MDEBUG("Problems at close: " << ec.message());
boost::interprocess::ipcdetail::atomic_write32(&m_shutdowned, 1);
m_connected = false;
return true;
@@ -526,7 +532,7 @@ namespace net_utils
boost::asio::ip::tcp::socket& get_socket()
{
return m_socket;
return m_ssl_socket.next_layer();
}
private:
@@ -536,34 +542,81 @@ namespace net_utils
// Check whether the deadline has passed. We compare the deadline against
// the current time since a new asynchronous operation may have moved the
// deadline before this actor had a chance to run.
if (m_deadline.expires_at() <= boost::asio::deadline_timer::traits_type::now())
if (m_deadline.expires_at() <= std::chrono::steady_clock::now())
{
// The deadline has passed. The socket is closed so that any outstanding
// asynchronous operations are cancelled. This allows the blocked
// connect(), read_line() or write_line() functions to return.
LOG_PRINT_L3("Timed out socket");
m_connected = false;
m_socket.close();
m_ssl_socket.next_layer().close();
// There is no longer an active deadline. The expiry is set to positive
// infinity so that the actor takes no action until a new deadline is set.
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
// Put the actor back to sleep.
m_deadline.async_wait(boost::bind(&blocked_mode_client::check_deadline, this));
}
void shutdown_ssl() {
// ssl socket shutdown blocks if server doesn't respond. We close after 2 secs
boost::system::error_code ec = boost::asio::error::would_block;
m_deadline.expires_from_now(std::chrono::milliseconds(2000));
m_ssl_socket.async_shutdown(boost::lambda::var(ec) = boost::lambda::_1);
while (ec == boost::asio::error::would_block)
{
m_io_service.run_one();
}
// Ignore "short read" error
if (ec.category() == boost::asio::error::get_ssl_category() &&
ec.value() !=
#if BOOST_VERSION >= 106200
boost::asio::ssl::error::stream_truncated
#else // older Boost supports only OpenSSL 1.0, so 1.0-only macros are appropriate
ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
#endif
)
MDEBUG("Problems at ssl shutdown: " << ec.message());
}
protected:
bool write(const void* data, size_t sz, boost::system::error_code& ec)
{
bool success;
if(m_ssl)
success = boost::asio::write(m_ssl_socket, boost::asio::buffer(data, sz), ec);
else
success = boost::asio::write(m_ssl_socket.next_layer(), boost::asio::buffer(data, sz), ec);
return success;
}
void async_write(const void* data, size_t sz, boost::system::error_code& ec)
{
if(m_ssl)
boost::asio::async_write(m_ssl_socket, boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
else
boost::asio::async_write(m_ssl_socket.next_layer(), boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
}
void async_read(char* buff, size_t sz, boost::asio::detail::transfer_at_least_t transfer_at_least, handler_obj& hndlr)
{
if(!m_ssl)
boost::asio::async_read(m_ssl_socket.next_layer(), boost::asio::buffer(buff, sz), transfer_at_least, hndlr);
else
boost::asio::async_read(m_ssl_socket, boost::asio::buffer(buff, sz), transfer_at_least, hndlr);
}
protected:
boost::asio::io_service m_io_service;
boost::asio::ip::tcp::socket m_socket;
int m_connect_timeout;
int m_reciev_timeout;
boost::asio::ssl::context m_ctx;
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> m_ssl_socket;
bool m_ssl;
bool m_initialized;
bool m_connected;
boost::asio::deadline_timer m_deadline;
boost::asio::steady_timer m_deadline;
volatile uint32_t m_shutdowned;
};
@@ -626,8 +679,8 @@ namespace net_utils
boost::system::error_code ec;
size_t writen = m_socket.write_some(boost::asio::buffer(data, sz), ec);
size_t writen = write(data, sz, ec);
if (!writen || ec)
{
LOG_PRINT_L3("Problems at write: " << ec.message());
@@ -668,7 +721,7 @@ namespace net_utils
// asynchronous operations are cancelled. This allows the blocked
// connect(), read_line() or write_line() functions to return.
LOG_PRINT_L3("Timed out socket");
m_socket.close();
m_ssl_socket.next_layer().close();
// There is no longer an active deadline. The expiry is set to positive
// infinity so that the actor takes no action until a new deadline is set.

View File

@@ -31,6 +31,8 @@
#include "http_base.h"
#include "reg_exp_definer.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
@@ -101,7 +103,7 @@ namespace net_utils
STATIC_REGEXP_EXPR_1(rexp_match_uri, "^([^?#]*)(\\?([^#]*))?(#(.*))?", boost::regex::icase | boost::regex::normal);
boost::smatch result;
if(!boost::regex_search(uri, result, rexp_match_uri, boost::match_default) && result[0].matched)
if(!(boost::regex_search(uri, result, rexp_match_uri, boost::match_default) && result[0].matched))
{
LOG_PRINT_L1("[PARSE URI] regex not matched for uri: " << uri);
content.m_path = uri;
@@ -137,7 +139,7 @@ namespace net_utils
// 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)
if(!(boost::regex_search(url_str, result, rexp_match_uri, boost::match_default) && result[0].matched))
{
LOG_PRINT_L1("[PARSE URI] regex not matched for uri: " << rexp_match_uri);
//content.m_path = uri;

View File

@@ -30,25 +30,196 @@
#define _NET_UTILS_BASE_H_
#include <boost/uuid/uuid.hpp>
#include "string_tools.h"
#include <boost/asio/io_service.hpp>
#include <typeinfo>
#include <type_traits>
#include "serialization/keyvalue_serialization.h"
#include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MAKE_IP
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
#endif
namespace epee
{
namespace net_utils
{
class ipv4_network_address
{
uint32_t m_ip;
uint16_t m_port;
public:
constexpr ipv4_network_address(uint32_t ip, uint16_t port) noexcept
: m_ip(ip), m_port(port) {}
bool equal(const ipv4_network_address& other) const noexcept;
bool less(const ipv4_network_address& other) const noexcept;
constexpr bool is_same_host(const ipv4_network_address& other) const noexcept
{ return ip() == other.ip(); }
constexpr uint32_t ip() const noexcept { return m_ip; }
constexpr uint16_t port() const noexcept { return m_port; }
std::string str() const;
std::string host_str() const;
bool is_loopback() const;
bool is_local() const;
static constexpr uint8_t get_type_id() noexcept { return ID; }
static const uint8_t ID = 1;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(m_ip)
KV_SERIALIZE(m_port)
END_KV_SERIALIZE_MAP()
};
inline bool operator==(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return lhs.equal(rhs); }
inline bool operator!=(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return !lhs.equal(rhs); }
inline bool operator<(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return lhs.less(rhs); }
inline bool operator<=(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return !rhs.less(lhs); }
inline bool operator>(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return rhs.less(lhs); }
inline bool operator>=(const ipv4_network_address& lhs, const ipv4_network_address& rhs) noexcept
{ return !lhs.less(rhs); }
class network_address
{
struct interface
{
virtual ~interface() {};
virtual bool equal(const interface&) const = 0;
virtual bool less(const interface&) const = 0;
virtual bool is_same_host(const interface&) const = 0;
virtual std::string str() const = 0;
virtual std::string host_str() const = 0;
virtual bool is_loopback() const = 0;
virtual bool is_local() const = 0;
virtual uint8_t get_type_id() const = 0;
};
template<typename T>
struct implementation final : interface
{
T value;
implementation(const T& src) : value(src) {}
~implementation() = default;
// Type-checks for cast are done in cpp
static const T& cast(const interface& src) noexcept
{ return static_cast<const implementation<T>&>(src).value; }
virtual bool equal(const interface& other) const override
{ return value.equal(cast(other)); }
virtual bool less(const interface& other) const override
{ return value.less(cast(other)); }
virtual bool is_same_host(const interface& other) const override
{ return value.is_same_host(cast(other)); }
virtual std::string str() const override { return value.str(); }
virtual std::string host_str() const override { return value.host_str(); }
virtual bool is_loopback() const override { return value.is_loopback(); }
virtual bool is_local() const override { return value.is_local(); }
virtual uint8_t get_type_id() const override { return value.get_type_id(); }
};
std::shared_ptr<interface> self;
template<typename Type>
Type& as_mutable() const
{
// types `implmentation<Type>` and `implementation<const Type>` are unique
using Type_ = typename std::remove_const<Type>::type;
network_address::interface* const self_ = self.get(); // avoid clang warning in typeid
if (!self_ || typeid(implementation<Type_>) != typeid(*self_))
throw std::bad_cast{};
return static_cast<implementation<Type_>*>(self_)->value;
}
public:
network_address() : self(nullptr) {}
template<typename T>
network_address(const T& src)
: self(std::make_shared<implementation<T>>(src)) {}
bool equal(const network_address &other) const;
bool less(const network_address &other) const;
bool is_same_host(const network_address &other) const;
std::string str() const { return self ? self->str() : "<none>"; }
std::string host_str() const { return self ? self->host_str() : "<none>"; }
bool is_loopback() const { return self ? self->is_loopback() : false; }
bool is_local() const { return self ? self->is_local() : false; }
uint8_t get_type_id() const { return self ? self->get_type_id() : 0; }
template<typename Type> const Type &as() const { return as_mutable<const Type>(); }
BEGIN_KV_SERIALIZE_MAP()
uint8_t type = is_store ? this_ref.get_type_id() : 0;
if (!epee::serialization::selector<is_store>::serialize(type, stg, hparent_section, "type"))
return false;
switch (type)
{
case ipv4_network_address::ID:
{
if (!is_store)
{
const_cast<network_address&>(this_ref) = ipv4_network_address{0, 0};
auto &addr = this_ref.template as_mutable<ipv4_network_address>();
if (epee::serialization::selector<is_store>::serialize(addr, stg, hparent_section, "addr"))
MDEBUG("Found as addr: " << this_ref.str());
else if (epee::serialization::selector<is_store>::serialize(addr, stg, hparent_section, "template as<ipv4_network_address>()"))
MDEBUG("Found as template as<ipv4_network_address>(): " << this_ref.str());
else if (epee::serialization::selector<is_store>::serialize(addr, stg, hparent_section, "template as_mutable<ipv4_network_address>()"))
MDEBUG("Found as template as_mutable<ipv4_network_address>(): " << this_ref.str());
else
{
MWARNING("Address not found");
return false;
}
}
else
{
auto &addr = this_ref.template as_mutable<ipv4_network_address>();
if (!epee::serialization::selector<is_store>::serialize(addr, stg, hparent_section, "addr"))
return false;
}
break;
}
default: MERROR("Unsupported network address type: " << (unsigned)type); return false;
}
END_KV_SERIALIZE_MAP()
};
inline bool operator==(const network_address& lhs, const network_address& rhs)
{ return lhs.equal(rhs); }
inline bool operator!=(const network_address& lhs, const network_address& rhs)
{ return !lhs.equal(rhs); }
inline bool operator<(const network_address& lhs, const network_address& rhs)
{ return lhs.less(rhs); }
inline bool operator<=(const network_address& lhs, const network_address& rhs)
{ return !rhs.less(lhs); }
inline bool operator>(const network_address& lhs, const network_address& rhs)
{ return rhs.less(lhs); }
inline bool operator>=(const network_address& lhs, const network_address& rhs)
{ return !lhs.less(rhs); }
bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0);
/************************************************************************/
/* */
/************************************************************************/
struct connection_context_base
{
const boost::uuids::uuid m_connection_id;
const uint32_t m_remote_ip;
const uint32_t m_remote_port;
const network_address m_remote_address;
const bool m_is_income;
const time_t m_started;
time_t m_last_recv;
@@ -59,12 +230,11 @@ namespace net_utils
double m_current_speed_up;
connection_context_base(boost::uuids::uuid connection_id,
long remote_ip, int remote_port, bool is_income,
const network_address &remote_address, bool is_income,
time_t last_recv = 0, time_t last_send = 0,
uint64_t recv_cnt = 0, uint64_t send_cnt = 0):
m_connection_id(connection_id),
m_remote_ip(remote_ip),
m_remote_port(remote_port),
m_remote_address(remote_address),
m_is_income(is_income),
m_started(time(NULL)),
m_last_recv(last_recv),
@@ -76,8 +246,7 @@ namespace net_utils
{}
connection_context_base(): m_connection_id(),
m_remote_ip(0),
m_remote_port(0),
m_remote_address(ipv4_network_address{0,0}),
m_is_income(false),
m_started(time(NULL)),
m_last_recv(0),
@@ -90,17 +259,17 @@ namespace net_utils
connection_context_base& operator=(const connection_context_base& a)
{
set_details(a.m_connection_id, a.m_remote_ip, a.m_remote_port, a.m_is_income);
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income);
return *this;
}
private:
template<class t_protocol_handler>
friend class connection;
void set_details(boost::uuids::uuid connection_id, long remote_ip, int remote_port, bool is_income)
void set_details(boost::uuids::uuid connection_id, const network_address &remote_address, bool is_income)
{
this->~connection_context_base();
new(this) connection_context_base(connection_id, remote_ip, remote_port, is_income);
new(this) connection_context_base(connection_id, remote_address, is_income);
}
};
@@ -112,6 +281,7 @@ namespace net_utils
{
virtual bool do_send(const void* ptr, size_t cb)=0;
virtual bool close()=0;
virtual bool send_done()=0;
virtual bool call_run_once_service_io()=0;
virtual bool request_callback()=0;
virtual boost::asio::io_service& get_io_service()=0;
@@ -126,36 +296,27 @@ namespace net_utils
//some helpers
inline
std::string print_connection_context(const connection_context_base& ctx)
{
std::stringstream ss;
ss << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}
std::string print_connection_context(const connection_context_base& ctx);
std::string print_connection_context_short(const connection_context_base& ctx);
inline
std::string print_connection_context_short(const connection_context_base& ctx)
{
std::stringstream ss;
ss << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}
inline MAKE_LOGGABLE(connection_context_base, ct, os)
{
os << "[" << epee::net_utils::print_connection_context_short(ct) << "] ";
return os;
}
#define LOG_PRINT_CC(ct, message, log_level) LOG_PRINT("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_GREEN(ct, message, log_level) LOG_PRINT_GREEN("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_RED(ct, message, log_level) LOG_PRINT_RED("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_BLUE(ct, message, log_level) LOG_PRINT_BLUE("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_YELLOW(ct, message, log_level) LOG_PRINT_YELLOW("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_CYAN(ct, message, log_level) LOG_PRINT_CYAN("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_MAGENTA(ct, message, log_level) LOG_PRINT_MAGENTA("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_ERROR_CC(ct, message) LOG_PRINT_RED("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, LOG_LEVEL_2)
#define LOG_ERROR_CC(ct, message) MERROR(ct << message)
#define LOG_WARNING_CC(ct, message) MWARNING(ct << message)
#define LOG_INFO_CC(ct, message) MINFO(ct << message)
#define LOG_DEBUG_CC(ct, message) MDEBUG(ct << message)
#define LOG_TRACE_CC(ct, message) MTRACE(ct << message)
#define LOG_CC(level, ct, message) MLOG(level, ct << message)
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L2(ct, message) LOG_PRINT_L2("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L3(ct, message) LOG_PRINT_L3("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L4(ct, message) LOG_PRINT_L4("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0(ct << message)
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1(ct << message)
#define LOG_PRINT_CC_L2(ct, message) LOG_PRINT_L2(ct << message)
#define LOG_PRINT_CC_L3(ct, message) LOG_PRINT_L3(ct << message)
#define LOG_PRINT_CC_L4(ct, message) LOG_PRINT_L4(ct << message)
#define LOG_PRINT_CCONTEXT_L0(message) LOG_PRINT_CC_L0(context, message)
#define LOG_PRINT_CCONTEXT_L1(message) LOG_PRINT_CC_L1(context, message)
@@ -163,13 +324,6 @@ namespace net_utils
#define LOG_PRINT_CCONTEXT_L3(message) LOG_PRINT_CC_L3(context, message)
#define LOG_ERROR_CCONTEXT(message) LOG_ERROR_CC(context, message)
#define LOG_PRINT_CCONTEXT_GREEN(message, log_level) LOG_PRINT_CC_GREEN(context, message, log_level)
#define LOG_PRINT_CCONTEXT_RED(message, log_level) LOG_PRINT_CC_RED(context, message, log_level)
#define LOG_PRINT_CCONTEXT_BLUE(message, log_level) LOG_PRINT_CC_BLUE(context, message, log_level)
#define LOG_PRINT_CCONTEXT_YELLOW(message, log_level) LOG_PRINT_CC_YELLOW(context, message, log_level)
#define LOG_PRINT_CCONTEXT_CYAN(message, log_level) LOG_PRINT_CC_CYAN(context, message, log_level)
#define LOG_PRINT_CCONTEXT_MAGENTA(message, log_level) LOG_PRINT_CC_MAGENTA(context, message, log_level)
#define CHECK_AND_ASSERT_MES_CC(condition, return_val, err_message) CHECK_AND_ASSERT_MES(condition, return_val, "[" << epee::net_utils::print_connection_context_short(context) << "]" << err_message)
}

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief implementaion for throttling of connection (count and rate-limit speed etc)
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
@@ -33,10 +33,10 @@
/* rfree: throttle details, implementing rate limiting */
#ifndef INCLUDED_src_p2p_throttle_detail_hpp
#define INCLUDED_src_p2p_throttle_detail_hpp
#ifndef INCLUDED_throttle_detail_hpp
#define INCLUDED_throttle_detail_hpp
#include "../../src/p2p/network_throttle.hpp"
#include "network_throttle.hpp"
namespace epee
{
@@ -52,8 +52,7 @@ class network_throttle : public i_network_throttle {
};
network_speed_kbps m_target_speed;
network_speed_kbps m_real_target_speed;
network_speed_bps m_target_speed;
size_t m_network_add_cost; // estimated add cost of headers
size_t m_network_minimal_segment; // estimated minimal cost of sending 1 byte to round up to
size_t m_network_max_segment; // recommended max size of 1 TCP transmission
@@ -67,9 +66,6 @@ class network_throttle : public i_network_throttle {
network_time_seconds m_start_time; // when we were created
bool m_any_packet_yet; // did we yet got any packet to count
double m_overheat; // last overheat
double m_overheat_time; // time in seconds after epoch
std::string m_name; // my name for debug and logs
std::string m_nameshort; // my name for debug and logs (used in log file name)
@@ -79,7 +75,6 @@ class network_throttle : public i_network_throttle {
virtual ~network_throttle();
virtual void set_name(const std::string &name);
virtual void set_target_speed( network_speed_kbps target );
virtual void set_real_target_speed( network_speed_kbps real_target ); // only for throttle_out
virtual network_speed_kbps get_target_speed();
// add information about events:

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief interface for throttling of connection (count and rate-limit speed etc)
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
@@ -34,8 +34,8 @@
/* rfree: also includes the manager for singeton/global such objects */
#ifndef INCLUDED_p2p_network_throttle_hpp
#define INCLUDED_p2p_network_throttle_hpp
#ifndef INCLUDED_network_throttle_hpp
#define INCLUDED_network_throttle_hpp
#include <boost/asio.hpp>
#include <string>
@@ -54,10 +54,9 @@
#include "syncobj.h"
#include "../../contrib/epee/include/net/net_utils_base.h"
#include "../../contrib/epee/include/misc_log_ex.h"
#include "net/net_utils_base.h"
#include "misc_log_ex.h"
#include <boost/lambda/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/chrono.hpp>
@@ -81,7 +80,8 @@ namespace net_utils
{
// just typedefs to in code define the units used. TODO later it will be enforced that casts to other numericals are only explicit to avoid mistakes? use boost::chrono?
typedef double network_speed_kbps;
typedef double network_speed_kbps; // externally, for parameters and return values, all defined in kilobytes per second
typedef double network_speed_bps; // throttle-internally, bytes per second
typedef double network_time_seconds;
typedef double network_MB;
@@ -99,8 +99,6 @@ struct calculate_times_struct {
typedef calculate_times_struct calculate_times_struct;
namespace cryptonote { class cryptonote_protocol_handler_base; } // a friend class // TODO friend not working
/***
@brief Access to simple throttles, with singlton to access global network limits
*/
@@ -112,24 +110,14 @@ class network_throttle_manager {
//protected:
public: // XXX
// [[note1]]
static boost::once_flag m_once_get_global_throttle_in;
static boost::once_flag m_once_get_global_throttle_inreq; // [[note2]]
static boost::once_flag m_once_get_global_throttle_out;
static std::unique_ptr<i_network_throttle> m_obj_get_global_throttle_in;
static std::unique_ptr<i_network_throttle> m_obj_get_global_throttle_inreq;
static std::unique_ptr<i_network_throttle> m_obj_get_global_throttle_out;
static boost::mutex m_lock_get_global_throttle_in;
static boost::mutex m_lock_get_global_throttle_inreq;
static boost::mutex m_lock_get_global_throttle_out;
friend class cryptonote::cryptonote_protocol_handler_base; // FRIEND - to directly access global throttle-s. !! REMEMBER TO USE LOCKS!
friend class connection_basic; // FRIEND - to directly access global throttle-s. !! REMEMBER TO USE LOCKS!
friend class connection_basic_pimpl; // ditto
static int xxx;
public:
static i_network_throttle & get_global_throttle_in(); ///< singleton ; for friend class ; caller MUST use proper locks! like m_lock_get_global_throttle_in
static i_network_throttle & get_global_throttle_inreq(); ///< ditto ; use lock ... use m_lock_get_global_throttle_inreq obviously
@@ -145,7 +133,6 @@ class i_network_throttle {
public:
virtual void set_name(const std::string &name)=0;
virtual void set_target_speed( network_speed_kbps target )=0;
virtual void set_real_target_speed(network_speed_kbps real_target)=0;
virtual network_speed_kbps get_target_speed()=0;
virtual void handle_trafic_exact(size_t packet_size) =0; // count the new traffic/packet; the size is exact considering all network costs

View File

@@ -28,6 +28,8 @@
#ifndef _PROFILE_TOOLS_H_
#define _PROFILE_TOOLS_H_
#include "misc_os_dependent.h"
namespace epee
{
@@ -52,13 +54,20 @@ namespace epee
#endif
#define START_WAY_POINTS() uint64_t _____way_point_time = epee::misc_utils::get_tick_count();
#define WAY_POINT(name) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; LOG_PRINT("Way point " << name << ": " << delta, LOG_LEVEL_2);_____way_point_time = misc_utils::get_tick_count();}
#define WAY_POINT2(name, avrg_obj) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; avrg_obj.push(delta); LOG_PRINT("Way point " << name << ": " << delta, LOG_LEVEL_2);_____way_point_time = misc_utils::get_tick_count();}
#define WAY_POINT(name) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; MDEBUG("Way point " << name << ": " << delta);_____way_point_time = misc_utils::get_tick_count();}
#define WAY_POINT2(name, avrg_obj) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; avrg_obj.push(delta); MDEBUG("Way point " << name << ": " << delta);_____way_point_time = misc_utils::get_tick_count();}
#define TIME_MEASURE_START(var_name) uint64_t var_name = epee::misc_utils::get_tick_count();
#define TIME_MEASURE_PAUSE(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
#define TIME_MEASURE_RESTART(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
#define TIME_MEASURE_FINISH(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
#define TIME_MEASURE_NS_START(var_name) uint64_t var_name = epee::misc_utils::get_ns_count();
#define TIME_MEASURE_NS_PAUSE(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
#define TIME_MEASURE_NS_RESTART(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
#define TIME_MEASURE_NS_FINISH(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
namespace profile_tools
{
struct local_call_account
@@ -67,7 +76,7 @@ namespace profile_tools
{}
~local_call_account()
{
LOG_PRINT2("profile_details.log", "PROFILE "<<m_pname<<":av_time:\t" << (m_count_of_call ? (m_summary_time_used/m_count_of_call):0) <<" sum_time:\t"<<m_summary_time_used<<" call_count:\t" << m_count_of_call, LOG_LEVEL_0);
MINFO("PROFILE "<<m_pname<<":av_time:\t" << (m_count_of_call ? (m_summary_time_used/m_count_of_call):0) <<" sum_time:\t"<<m_summary_time_used<<" call_count:\t" << m_count_of_call);
}
size_t m_count_of_call;

View File

@@ -0,0 +1,43 @@
#pragma once
#include <streambuf>
#include <sstream>
#include <vector>
namespace rdln
{
typedef enum { empty, partial, full } linestatus;
class readline_buffer : public std::stringbuf
{
public:
readline_buffer();
void start();
void stop();
bool is_running() const
{
return m_cout_buf != NULL;
}
linestatus get_line(std::string& line) const;
void set_prompt(const std::string& prompt);
static void add_completion(const std::string& command);
static const std::vector<std::string>& get_completions();
protected:
virtual int sync();
private:
std::streambuf* m_cout_buf;
static std::vector<std::string>& completion_commands();
};
class suspend_readline
{
public:
suspend_readline();
~suspend_readline();
private:
readline_buffer* m_buffer;
bool m_restart;
};
}

View File

@@ -29,7 +29,7 @@
#define _REG_EXP_DEFINER_H_
#include <boost/interprocess/detail/atomic.hpp>
#include "syncobj.h"
namespace epee
{

View File

@@ -31,7 +31,6 @@
#include "misc_log_ex.h"
#include "enableable.h"
#include "keyvalue_serialization_overloads.h"
#include "serialization/serialization.h"
namespace epee
{
@@ -70,6 +69,15 @@ public: \
#define KV_SERIALIZE_N(varialble, val_name) \
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
template<typename T> inline void serialize_default(const T &t, T v) { }
template<typename T> inline void serialize_default(T &t, T v) { t = v; }
#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \
do { \
if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \
epee::serialize_default(this_ref.variable, default_value); \
} while (0);
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \
epee::serialization::selector<is_store>::serialize_t_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
@@ -86,6 +94,7 @@ public: \
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
#define KV_SERIALIZE_OPT(variable,default_value) KV_SERIALIZE_OPT_N(variable, #variable, default_value)
}

View File

@@ -26,6 +26,13 @@
#pragma once
#include <set>
#include <list>
#include <vector>
#include <deque>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/contains_fwd.hpp>
namespace epee
{
namespace serialization
@@ -73,7 +80,7 @@ namespace epee
template<class serializible_type, class t_storage>
static bool unserialize_t_obj(serializible_type& obj, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
typename t_storage::hsection hchild_section = stg.open_section(pname, hparent_section, true);
typename t_storage::hsection hchild_section = stg.open_section(pname, hparent_section, false);
if(!hchild_section) return false;
return obj._load(stg, hchild_section);
}
@@ -90,7 +97,7 @@ namespace epee
static bool unserialize_t_obj(enableable<serializible_type>& obj, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
obj.enabled = false;
typename t_storage::hsection hchild_section = stg.open_section(pname, hparent_section, true);
typename t_storage::hsection hchild_section = stg.open_section(pname, hparent_section, false);
if(!hchild_section) return false;
obj.enabled = true;
return obj.v._load(stg, hchild_section);
@@ -117,16 +124,15 @@ namespace epee
typename stl_container::value_type exchange_val;
typename t_storage::harray hval_array = stg.get_first_value(pname, exchange_val, hparent_section);
if(!hval_array) return false;
container.push_back(std::move(exchange_val));
container.insert(container.end(), std::move(exchange_val));
while(stg.get_next_value(hval_array, exchange_val))
container.push_back(std::move(exchange_val));
container.insert(container.end(), std::move(exchange_val));
return true;
}//--------------------------------------------------------------------------------------------------------------------
template<class stl_container, class t_storage>
static bool serialize_stl_container_pod_val_as_blob(const stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
if(!container.size()) return true;
typename stl_container::const_iterator it = container.begin();
std::string mb;
mb.resize(sizeof(typename stl_container::value_type)*container.size());
typename stl_container::value_type* p_elem = (typename stl_container::value_type*)mb.data();
@@ -153,7 +159,7 @@ namespace epee
"size in blob " << loaded_size << " not have not zero modulo for sizeof(value_type) = " << sizeof(typename stl_container::value_type));
size_t count = (loaded_size/sizeof(typename stl_container::value_type));
for(size_t i = 0; i < count; i++)
container.push_back(*(pelem++));
container.insert(container.end(), *(pelem++));
}
return res;
}
@@ -187,12 +193,12 @@ namespace epee
typename t_storage::harray hsec_array = stg.get_first_section(pname, hchild_section, hparent_section);
if(!hsec_array || !hchild_section) return false;
res = val._load(stg, hchild_section);
container.push_back(val);
container.insert(container.end(), val);
while(stg.get_next_section(hsec_array, hchild_section))
{
typename stl_container::value_type val_l = typename stl_container::value_type();
res |= val_l._load(stg, hchild_section);
container.push_back(std::move(val_l));
container.insert(container.end(), std::move(val_l));
}
return res;
}
@@ -228,6 +234,18 @@ namespace epee
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_serialize(const std::deque<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return serialize_stl_container_t_val(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_unserialize(std::deque<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return unserialize_stl_container_t_val(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_serialize(const std::list<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return serialize_stl_container_t_val(d, stg, hparent_section, pname);
@@ -239,6 +257,18 @@ namespace epee
return unserialize_stl_container_t_val(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_serialize(const std::set<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return serialize_stl_container_t_val(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_unserialize(std::set<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return unserialize_stl_container_t_val(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
};
template<>
struct kv_serialization_overloads_impl_is_base_serializable_types<false>
@@ -269,6 +299,18 @@ namespace epee
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_serialize(const std::deque<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return serialize_stl_container_t_obj(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_unserialize(std::deque<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return unserialize_stl_container_t_obj(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_serialize(const std::list<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return serialize_stl_container_t_obj(d, stg, hparent_section, pname);
@@ -279,6 +321,18 @@ namespace epee
{
return unserialize_stl_container_t_obj(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_serialize(const std::set<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return serialize_stl_container_t_obj(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
static bool kv_unserialize(std::set<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return unserialize_stl_container_t_obj(d, stg, hparent_section, pname);
}
};
template<class t_storage>
struct base_serializable_types: public boost::mpl::vector<uint64_t, uint32_t, uint16_t, uint8_t, int64_t, int32_t, int16_t, int8_t, double, bool, std::string, typename t_storage::meta_entry>::type
@@ -354,6 +408,18 @@ namespace epee
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
bool kv_serialize(const std::deque<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_serialize(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
bool kv_unserialize(std::deque<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_unserialize(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
bool kv_serialize(const std::list<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_serialize(d, stg, hparent_section, pname);
@@ -364,5 +430,17 @@ namespace epee
{
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_unserialize(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
bool kv_serialize(const std::set<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_serialize(d, stg, hparent_section, pname);
}
//-------------------------------------------------------------------------------------------------------------------
template<class t_type, class t_storage>
bool kv_unserialize(std::set<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_unserialize(d, stg, hparent_section, pname);
}
}
}

130
contrib/epee/include/span.h Normal file
View File

@@ -0,0 +1,130 @@
// Copyright (c) 2017-2018, 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.
#pragma once
#include <cstdint>
#include <memory>
#include <type_traits>
namespace epee
{
/*!
\brief Non-owning sequence of data. Does not deep copy
Inspired by `gsl::span` and/or `boost::iterator_range`. This class is
intended to be used as a parameter type for functions that need to take a
writable or read-only sequence of data. Most common cases are `span<char>`
and `span<std::uint8_t>`. Using as a class member is only recommended if
clearly documented as not doing a deep-copy. C-arrays are easily convertible
to this type.
\note Conversion from C string literal to `span<const char>` will include
the NULL-terminator.
\note Never allows derived-to-base pointer conversion; an array of derived
types is not an array of base types.
*/
template<typename T>
class span
{
/* Supporting class types is tricky - the {ptr,len} constructor will allow
derived-to-base conversions. This is NOT desireable because an array of
derived types is not an array of base types. It is possible to handle
this case, implement when/if needed. */
static_assert(!std::is_class<T>(), "no class types are currently allowed");
public:
using value_type = T;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using iterator = pointer;
using const_iterator = const_pointer;
constexpr span() noexcept : ptr(nullptr), len(0) {}
constexpr span(std::nullptr_t) noexcept : span() {}
constexpr span(T* const src_ptr, const std::size_t count) noexcept
: ptr(src_ptr), len(count) {}
//! Conversion from C-array. Prevents common bugs with sizeof + arrays.
template<std::size_t N>
constexpr span(T (&src)[N]) noexcept : span(src, N) {}
constexpr span(const span&) noexcept = default;
span& operator=(const span&) noexcept = default;
constexpr iterator begin() const noexcept { return ptr; }
constexpr const_iterator cbegin() const noexcept { return ptr; }
constexpr iterator end() const noexcept { return begin() + size(); }
constexpr const_iterator cend() const noexcept { return cbegin() + size(); }
constexpr bool empty() const noexcept { return size() == 0; }
constexpr pointer data() const noexcept { return ptr; }
constexpr std::size_t size() const noexcept { return len; }
constexpr std::size_t size_bytes() const noexcept { return size() * sizeof(value_type); }
private:
T* ptr;
std::size_t len;
};
//! \return `span<const T::value_type>` from a STL compatible `src`.
template<typename T>
constexpr span<const typename T::value_type> to_span(const T& src)
{
// compiler provides diagnostic if size() is not size_t.
return {src.data(), src.size()};
}
template<typename T>
constexpr bool has_padding() noexcept
{
return !std::is_standard_layout<T>() || alignof(T) != 1;
}
//! \return Cast data from `src` as `span<const std::uint8_t>`.
template<typename T>
span<const std::uint8_t> to_byte_span(const span<const T> src) noexcept
{
static_assert(!has_padding<T>(), "source type may have padding");
return {reinterpret_cast<const std::uint8_t*>(src.data()), src.size_bytes()};
}
//! \return `span<const std::uint8_t>` which represents the bytes at `&src`.
template<typename T>
span<const std::uint8_t> as_byte_span(const T& src) noexcept
{
static_assert(!std::is_empty<T>(), "empty types will not work -> sizeof == 1");
static_assert(!has_padding<T>(), "source type may have padding");
return {reinterpret_cast<const std::uint8_t*>(std::addressof(src)), sizeof(T)};
}
}

View File

@@ -1,132 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#pragma once
#include "inmemtoxml.h"
//#include "levin/levin_server.h"
namespace epee
{
class activity_printer_base
{
public:
activity_printer_base(){}
virtual ~activity_printer_base(){}
};
template<class A>
class notify_activity_printer: public activity_printer_base
{
public:
notify_activity_printer(int level, A& arg, bool is_notify_mode = true):m_ref_arg(arg), m_level(level), m_is_notify_mode(is_notify_mode)
{
m_command_name = typeid(m_ref_arg).name();
m_command_name.erase(0, 7);
m_command_name.erase(m_command_name.size()-10, m_command_name.size()-1);
if(level == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(m_command_name, level);
}
else if(level+1 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" -->>" << m_command_name, level);
}
else if(level+2 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" -->>" << m_command_name << "\n" << StorageNamed::xml::get_t_as_xml(m_ref_arg), level);
}
}
virtual ~notify_activity_printer()
{
if(m_is_notify_mode)
{
if(m_level+1 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" <<--" << m_command_name, m_level);
}
}
}
protected:
std::string m_command_name;
A& m_ref_arg;
int m_level;
bool m_is_notify_mode;
};
template<class A, class R>
class command_activity_printer: public notify_activity_printer<A>
{
public:
command_activity_printer(int level, A& arg, R& rsp):notify_activity_printer(level, arg, false), m_ref_rsp(rsp)
{
}
virtual ~command_activity_printer()
{
if(m_level+1 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" <<--" << m_command_name, m_level);
}
else if(m_level+2 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" <<--" << m_command_name << "\n" << StorageNamed::trace_as_xml(m_ref_rsp), m_level);
}
}
private:
R& m_ref_rsp;
};
template<class A, class R>
activity_printer_base* create_activity_printer(int level, A& arg, R& rsp)
{
return new command_activity_printer<A, R>(level, arg, rsp);
}
template<class A>
activity_printer_base* create_activity_printer(int level, A& arg)
{
return new notify_activity_printer<A>(level, arg);
}
}
#define PRINT_COMMAND_ACTIVITY(level) boost::shared_ptr<activity_printer_base> local_activity_printer(create_activity_printer(level, in_struct, out_struct));
#define PRINT_NOTIFY_ACTIVITY(level) boost::shared_ptr<activity_printer_base> local_activity_printer(create_activity_printer(level, in_struct));
#define PRINT_ACTIVITY(level) \
{std::string some_str = typeid(in_struct).name(); \
some_str.erase(0, 7); \
some_str.erase(some_str.size()-10, some_str.size()-1); \
LOG_PRINT(some_str, level);}
}

View File

@@ -26,6 +26,9 @@
//
#pragma once
#include <boost/utility/string_ref.hpp>
#include <chrono>
#include <string>
#include "portable_storage_template_helper.h"
#include "net/http_base.h"
#include "net/http_server_handlers_map2.h"
@@ -35,28 +38,31 @@ namespace epee
namespace net_utils
{
template<class t_request, class t_response, class t_transport>
bool invoke_http_json_remote_command2(const std::string& url, t_request& out_struct, t_response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
bool invoke_http_json(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 = "GET")
{
std::string req_param;
if(!serialization::store_t_to_json(out_struct, req_param))
return false;
http::fields_list additional_params;
additional_params.push_back(std::make_pair("Content-Type","application/json; charset=utf-8"));
const http::http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
if(!transport.invoke(uri, method, req_param, timeout, std::addressof(pri), std::move(additional_params)))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
LOG_PRINT_L1("Failed to invoke http request to " << uri);
return false;
}
if(!pri->m_response_code)
if(!pri)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", wrong response code: " << pri->m_response_code);
return false;
}
@@ -66,28 +72,28 @@ namespace epee
template<class t_request, class t_response, class t_transport>
bool invoke_http_bin_remote_command2(const std::string& url, t_request& out_struct, t_response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
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 = "GET")
{
std::string req_param;
if(!serialization::store_t_to_binary(out_struct, req_param))
return false;
const http::http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
if(!transport.invoke(uri, method, req_param, timeout, std::addressof(pri)))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
LOG_PRINT_L1("Failed to invoke http request to " << uri);
return false;
}
if(!pri->m_response_code)
if(!pri)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", wrong response code: " << pri->m_response_code);
return false;
}
@@ -95,21 +101,21 @@ namespace epee
}
template<class t_request, class t_response, class t_transport>
bool invoke_http_json_rpc(const std::string& url, const std::string& method_name, t_request& out_struct, t_response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& http_method = "GET", const std::string& req_id = "0")
bool invoke_http_json_rpc(const boost::string_ref uri, std::string method_name, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
{
epee::json_rpc::request<t_request> req_t = AUTO_VAL_INIT(req_t);
req_t.jsonrpc = "2.0";
req_t.id = req_id;
req_t.method = method_name;
req_t.method = std::move(method_name);
req_t.params = out_struct;
epee::json_rpc::response<t_response, epee::json_rpc::error> resp_t = AUTO_VAL_INIT(resp_t);
if(!epee::net_utils::invoke_http_json_remote_command2(url, req_t, resp_t, transport, timeout, http_method))
if(!epee::net_utils::invoke_http_json(uri, req_t, resp_t, transport, timeout, http_method))
{
return false;
}
if(resp_t.error.code || resp_t.error.message.size())
{
LOG_ERROR("RPC call of \"" << method_name << "\" returned error: " << resp_t.error.code << ", message: " << resp_t.error.message);
LOG_ERROR("RPC call of \"" << req_t.method << "\" returned error: " << resp_t.error.code << ", message: " << resp_t.error.message);
return false;
}
result_struct = resp_t.result;
@@ -117,9 +123,9 @@ namespace epee
}
template<class t_command, class t_transport>
bool invoke_http_json_rpc(const std::string& url, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& http_method = "GET", const std::string& req_id = "0")
bool invoke_http_json_rpc(const boost::string_ref uri, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
{
return invoke_http_json_rpc(url, t_command::methodname(), out_struct, result_struct, transport, timeout, http_method, req_id);
return invoke_http_json_rpc(uri, t_command::methodname(), out_struct, result_struct, transport, timeout, http_method, req_id);
}
}

View File

@@ -30,6 +30,9 @@
#include <boost/utility/value_init.hpp>
#include "net/levin_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace net_utils
@@ -48,7 +51,7 @@ namespace epee
int res = transport.invoke(command, buff_to_send, buff_to_recv);
if( res <=0 )
{
LOG_PRINT_RED("Failed to invoke command " << command << " return code " << res, LOG_LEVEL_1);
MERROR("Failed to invoke command " << command << " return code " << res);
return false;
}
serialization::portable_storage stg_ret;
@@ -57,8 +60,7 @@ namespace epee
LOG_ERROR("Failed to load_from_binary on command " << command);
return false;
}
result_struct.load(stg_ret);
return true;
return result_struct.load(stg_ret);
}
template<class t_arg, class t_transport>
@@ -102,17 +104,15 @@ namespace epee
LOG_ERROR("Failed to load_from_binary on command " << command);
return false;
}
result_struct.load(stg_ret);
return true;
return result_struct.load(stg_ret);
}
template<class t_result, class t_arg, class callback_t, class t_transport>
bool async_invoke_remote_command2(boost::uuids::uuid conn_id, int command, const t_arg& out_struct, t_transport& transport, callback_t cb, size_t inv_timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
bool async_invoke_remote_command2(boost::uuids::uuid conn_id, int command, const t_arg& out_struct, t_transport& transport, const callback_t &cb, size_t inv_timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
{
typename serialization::portable_storage stg;
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
std::string buff_to_send, buff_to_recv;
std::string buff_to_send;
stg.store_to_binary(buff_to_send);
int res = transport.invoke_async(command, buff_to_send, conn_id, [cb, command](int code, const std::string& buff, typename t_transport::connection_context& context)->bool
{
@@ -130,7 +130,12 @@ namespace epee
cb(LEVIN_ERROR_FORMAT, result_struct, context);
return false;
}
result_struct.load(stg_ret);
if (!result_struct.load(stg_ret))
{
LOG_ERROR("Failed to load result struct on command " << command);
cb(LEVIN_ERROR_FORMAT, result_struct, context);
return false;
}
cb(code, result_struct, context);
return true;
}, inv_timeout);
@@ -148,13 +153,13 @@ namespace epee
serialization::portable_storage stg;
out_struct.store(stg);
std::string buff_to_send, buff_to_recv;
std::string buff_to_send;
stg.store_to_binary(buff_to_send);
int res = transport.notify(command, buff_to_send, conn_id);
if(res <=0 )
{
LOG_PRINT_RED_L0("Failed to notify command " << command << " return code " << res);
MERROR("Failed to notify command " << command << " return code " << res);
return false;
}
return true;
@@ -173,7 +178,11 @@ namespace epee
boost::value_initialized<t_in_type> in_struct;
boost::value_initialized<t_out_type> out_struct;
static_cast<t_in_type&>(in_struct).load(strg);
if (!static_cast<t_in_type&>(in_struct).load(strg))
{
LOG_ERROR("Failed to load in_struct in command " << command);
return -1;
}
int res = cb(command, static_cast<t_in_type&>(in_struct), static_cast<t_out_type&>(out_struct), context);
serialization::portable_storage strg_out;
static_cast<t_out_type&>(out_struct).store(strg_out);
@@ -197,7 +206,11 @@ namespace epee
return -1;
}
boost::value_initialized<t_in_type> in_struct;
static_cast<t_in_type&>(in_struct).load(strg);
if (!static_cast<t_in_type&>(in_struct).load(strg))
{
LOG_ERROR("Failed to load in_struct in notify " << command);
return -1;
}
return cb(command, in_struct, context);
}

View File

@@ -158,7 +158,7 @@ namespace epee
pbuff->m_signature_b != PORTABLE_STORAGE_SIGNATUREB
)
{
LOG_ERROR("portable_storage: wrong binary format - signature missmatch");
LOG_ERROR("portable_storage: wrong binary format - signature mismatch");
return false;
}
if(pbuff->m_ver != PORTABLE_STORAGE_FORMAT_VER)

View File

@@ -25,6 +25,8 @@
//
#pragma once
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "parserse_base_utils.h"
#include "file_io_utils.h"
@@ -365,12 +367,12 @@ namespace epee
}
catch(const std::exception& ex)
{
LOG_PRINT_RED_L0("Failed to parse json, what: " << ex.what());
MERROR("Failed to parse json, what: " << ex.what());
return false;
}
catch(...)
{
LOG_PRINT_RED_L0("Failed to parse json");
MERROR("Failed to parse json");
return false;
}
}

View File

@@ -28,6 +28,7 @@
#pragma once
#include "pragma_comp_defs.h"
#include "misc_language.h"
#include "portable_storage_base.h"
@@ -47,6 +48,9 @@ namespace epee
PRAGMA_WARNING_PUSH
PRAGMA_GCC("GCC diagnostic ignored \"-Wstrict-aliasing\"")
#ifdef __clang__
PRAGMA_GCC("GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"")
#endif
template<class t_stream>
size_t pack_varint(t_stream& strm, size_t val)
{ //the first two bits always reserved for size information

View File

@@ -28,6 +28,9 @@
#pragma once
#include <time.h>
#include <boost/regex.hpp>
#include "misc_language.h"
#include "portable_storage_base.h"
#include "warnings.h"
@@ -131,6 +134,36 @@ POP_WARNINGS
}
};
// For MyMonero/OpenMonero backend compatibility
// MyMonero backend sends amount, fees and timestamp values as strings.
// Until MM backend is updated, this is needed for compatibility between OpenMonero and MyMonero.
template<>
struct convert_to_integral<std::string, uint64_t, false>
{
static void convert(const std::string& from, uint64_t& to)
{
MTRACE("Converting std::string to uint64_t. Source: " << from);
// String only contains digits
if(std::all_of(from.begin(), from.end(), ::isdigit))
to = boost::lexical_cast<uint64_t>(from);
// MyMonero ISO 8061 timestamp (2017-05-06T16:27:06Z)
else if (boost::regex_match (from, boost::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ")))
{
// Convert to unix timestamp
#ifdef HAVE_STRPTIME
struct tm tm;
if (strptime(from.c_str(), "%Y-%m-%dT%H:%M:%S", &tm))
#else
std::tm tm = {};
std::istringstream ss(from);
if (ss >> std::get_time(&tm, "%Y-%m-%dT%H:%M:%S"))
#endif
to = std::mktime(&tm);
} else
ASSERT_AND_THROW_WRONG_CONVERSION();
}
};
template<class from_type, class to_type>
struct is_convertable: std::integral_constant<bool,
std::is_integral<to_type>::value &&

View File

@@ -29,7 +29,7 @@
#define _STRING_CODING_H_
#include <string>
//#include "md5_l.h"
namespace epee
{
namespace string_encoding
@@ -62,23 +62,6 @@ namespace string_encoding
(char*)str_trgt.data(), (int)str_trgt.size(), 0, 0);
return str_trgt;*/
}
#ifdef WINDOWS_PLATFORM_EX
inline std::string convert_to_ansii_win(const std::wstring& str_from)
{
int code_page = CP_ACP;
std::string str_trgt;
if(!str_from.size())
return str_trgt;
int cb = ::WideCharToMultiByte( code_page, 0, str_from.data(), (__int32)str_from.size(), 0, 0, 0, 0 );
if(!cb)
return str_trgt;
str_trgt.resize(cb);
::WideCharToMultiByte( code_page, 0, str_from.data(), (int)str_from.size(),
(char*)str_trgt.data(), (int)str_trgt.size(), 0, 0);
return str_trgt;
}
#endif
inline std::string convert_to_ansii(const std::string& str_from)
{
@@ -254,41 +237,6 @@ namespace string_encoding
return ret;
}
//md5
#ifdef MD5_H
inline
std::string get_buf_as_hex_string(const void* pbuf, size_t len)
{
std::ostringstream result;
const unsigned char* p_buff = (const unsigned char*)pbuf;
for(unsigned int i=0;i<len;i++)
{ // convert md to hex-represented string (hex-letters in upper case!)
result << std::setw(2) << std::setfill('0')
<< std::setbase(16) << std::nouppercase
<< (int)*p_buff++;
}
return result.str();
}
inline
std::string get_md5_as_hexstring(const void* pbuff, size_t len)
{
unsigned char output[16] = {0};
md5::md5((unsigned char*)pbuff, static_cast<unsigned int>(len), output);
return get_buf_as_hex_string(output, sizeof(output));
}
inline
std::string get_md5_as_hexstring(const std::string& src)
{
return get_md5_as_hexstring(src.data(), src.size());
}
#endif
}
}

View File

@@ -29,18 +29,24 @@
#ifndef _STRING_TOOLS_H_
#define _STRING_TOOLS_H_
//#include <objbase.h>
// Previously pulled in by ASIO, further cleanup still required ...
#ifdef _WIN32
# include <winsock2.h>
# include <windows.h>
#endif
#include <string.h>
#include <locale>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <type_traits>
//#include <strsafe.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "hex.h"
#include "memwipe.h"
#include "span.h"
#include "warnings.h"
@@ -56,38 +62,12 @@ namespace epee
{
namespace string_tools
{
inline std::wstring get_str_from_guid(const boost::uuids::uuid& rid)
{
return boost::lexical_cast<std::wstring>(rid);
}
//----------------------------------------------------------------------------
inline std::string get_str_from_guid_a(const boost::uuids::uuid& rid)
{
return boost::lexical_cast<std::string>(rid);
}
//----------------------------------------------------------------------------
inline bool get_guid_from_string( boost::uuids::uuid& inetifer, std::wstring str_id)
{
if(str_id.size() < 36)
return false;
if('{' == *str_id.begin())
str_id.erase(0, 1);
if('}' == *(--str_id.end()))
str_id.erase(--str_id.end());
try
{
inetifer = boost::lexical_cast<boost::uuids::uuid>(str_id);
return true;
}
catch(...)
{
return false;
}
}
//----------------------------------------------------------------------------
inline bool get_guid_from_string(OUT boost::uuids::uuid& inetifer, const std::string& str_id)
{
std::string local_str_id = str_id;
@@ -110,33 +90,10 @@ namespace string_tools
return false;
}
}
//----------------------------------------------------------------------------
template<class CharT>
std::basic_string<CharT> buff_to_hex(const std::basic_string<CharT>& s)
{
using namespace std;
basic_stringstream<CharT> hexStream;
hexStream << hex << noshowbase << setw(2);
for(typename std::basic_string<CharT>::const_iterator it = s.begin(); it != s.end(); it++)
{
hexStream << "0x"<< static_cast<unsigned int>(static_cast<unsigned char>(*it)) << " ";
}
return hexStream.str();
}
//----------------------------------------------------------------------------
template<class CharT>
std::basic_string<CharT> buff_to_hex_nodelimer(const std::basic_string<CharT>& s)
inline std::string buff_to_hex_nodelimer(const std::string& src)
{
using namespace std;
basic_stringstream<CharT> hexStream;
hexStream << hex << noshowbase;
for(typename std::basic_string<CharT>::const_iterator it = s.begin(); it != s.end(); it++)
{
hexStream << setw(2) << setfill('0') << static_cast<unsigned int>(static_cast<unsigned char>(*it));
}
return hexStream.str();
return to_hex::string(to_byte_span(to_span(src)));
}
//----------------------------------------------------------------------------
template<class CharT>
@@ -205,7 +162,7 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
val = boost::lexical_cast<XType>(str_id);
return true;
}
catch(std::exception& /*e*/)
catch(const std::exception& /*e*/)
{
//const char* pmsg = e.what();
return false;
@@ -218,22 +175,6 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
return true;
}
POP_WARNINGS
//---------------------------------------------------
template<typename int_t>
bool get_xnum_from_hex_string(const std::string str, int_t& res )
{
try
{
std::stringstream ss;
ss << std::hex << str;
ss >> res;
return true;
}
catch(...)
{
return false;
}
}
//----------------------------------------------------------------------------
template<class XType>
inline bool xtype_to_string(const XType& val, std::string& str)
@@ -249,106 +190,12 @@ POP_WARNINGS
return true;
}
typedef std::map<std::string, std::string> command_line_params_a;
typedef std::map<std::wstring, std::wstring> command_line_params_w;
template<class t_string>
bool parse_commandline(std::map<t_string, t_string>& res, int argc, char** argv)
{
t_string key;
for(int i = 1; i < argc; i++)
{
if(!argv[i])
break;
t_string s = argv[i];
std::string::size_type p = s.find('=');
if(std::string::npos == p)
{
res[s] = "";
}else
{
std::string ss;
t_string nm = s.substr(0, p);
t_string vl = s.substr(p+1, s.size());
res[nm] = vl;
}
}
return true;
}
/* template<typename t_type>
bool get_xparam_from_command_line(const std::map<std::string, std::string>& res, const std::basic_string<typename t_string::value_type> & key, t_type& val)
{
}
*/
template<class t_string, typename t_type>
bool get_xparam_from_command_line(const std::map<t_string, t_string>& res, const t_string & key, t_type& val)
{
typename std::map<t_string, t_string>::const_iterator it = res.find(key);
if(it == res.end())
return false;
if(it->second.size())
{
return get_xtype_from_string(val, it->second);
}
return true;
}
template<class t_string, typename t_type>
t_type get_xparam_from_command_line(const std::map<t_string, t_string>& res, const t_string & key, const t_type& default_value)
{
typename std::map<t_string, t_string>::const_iterator it = res.find(key);
if(it == res.end())
return default_value;
if(it->second.size())
{
t_type s;
get_xtype_from_string(s, it->second);
return s;
}
return default_value;
}
template<class t_string>
bool have_in_command_line(const std::map<t_string, t_string>& res, const std::basic_string<typename t_string::value_type>& key)
{
typename std::map<t_string, t_string>::const_iterator it = res.find(key);
if(it == res.end())
return false;
return true;
}
//----------------------------------------------------------------------------
//#ifdef _WINSOCK2API_
inline std::string get_ip_string_from_int32(uint32_t ip)
{
in_addr adr;
adr.s_addr = ip;
const char* pbuf = inet_ntoa(adr);
if(pbuf)
return pbuf;
else
return "[failed]";
}
std::string get_ip_string_from_int32(uint32_t ip);
//----------------------------------------------------------------------------
inline bool get_ip_int32_from_string(uint32_t& ip, const std::string& ip_str)
{
ip = inet_addr(ip_str.c_str());
if(INADDR_NONE == ip)
return false;
return true;
}
bool get_ip_int32_from_string(uint32_t& ip, const std::string& ip_str);
//----------------------------------------------------------------------------
inline bool parse_peer_from_string(uint32_t& ip, uint32_t& port, const std::string& addres)
inline bool parse_peer_from_string(uint32_t& ip, uint16_t& port, const std::string& addres)
{
//parse ip and address
std::string::size_type p = addres.find(':');
@@ -376,17 +223,6 @@ POP_WARNINGS
return true;
}
//#endif
//----------------------------------------------------------------------------
template<typename t>
inline std::string get_t_as_hex_nwidth(const t& v, std::streamsize w = 8)
{
std::stringstream ss;
ss << std::setfill ('0') << std::setw (w) << std::hex << std::noshowbase;
ss << v;
return ss.str();
}
inline std::string num_to_string_fast(int64_t val)
{
/*
@@ -396,68 +232,6 @@ POP_WARNINGS
return boost::lexical_cast<std::string>(val);
}
//----------------------------------------------------------------------------
inline bool string_to_num_fast(const std::string& buff, int64_t& val)
{
//return get_xtype_from_string(val, buff);
#if (defined _MSC_VER)
val = _atoi64(buff.c_str());
#else
val = atoll(buff.c_str());
#endif
/*
* val = atoi64(buff.c_str());
*/
if(buff != "0" && val == 0)
return false;
return true;
}
//----------------------------------------------------------------------------
inline bool string_to_num_fast(const std::string& buff, int& val)
{
val = atoi(buff.c_str());
if(buff != "0" && val == 0)
return false;
return true;
}
//----------------------------------------------------------------------------
#ifdef WINDOWS_PLATFORM
inline std::string system_time_to_string(const SYSTEMTIME& st)
{
/*
TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);
SystemTimeToTzSpecificLocalTime(&tzi, &stUTC, &stLocal);
*/
char szTime[25], szDate[25];
::GetTimeFormatA(
LOCALE_USER_DEFAULT, // locale
TIME_FORCE24HOURFORMAT, // options
&st, // time
NULL, // time format string
szTime, // formatted string buffer
25 // size of string buffer
);
::GetDateFormatA(
LOCALE_USER_DEFAULT, // locale
NULL, // options
&st, // date
NULL, // date format
szDate, // formatted string buffer
25 // size of buffer
);
szTime[24] = szDate[24] = 0; //be happy :)
std::string res = szDate;
(res += " " )+= szTime;
return res;
}
#endif
//----------------------------------------------------------------------------
inline bool compare_no_case(const std::string& str1, const std::string& str2)
{
@@ -465,33 +239,6 @@ POP_WARNINGS
return !boost::iequals(str1, str2);
}
//----------------------------------------------------------------------------
inline bool compare_no_case(const std::wstring& str1, const std::wstring& str2)
{
return !boost::iequals(str1, str2);
}
//----------------------------------------------------------------------------
inline bool is_match_prefix(const std::wstring& str1, const std::wstring& prefix)
{
if(prefix.size()>str1.size())
return false;
if(!compare_no_case(str1.substr(0, prefix.size()), prefix))
return true;
else
return false;
}
//----------------------------------------------------------------------------
inline bool is_match_prefix(const std::string& str1, const std::string& prefix)
{
if(prefix.size()>str1.size())
return false;
if(!compare_no_case(str1.substr(0, prefix.size()), prefix))
return true;
else
return false;
}
//----------------------------------------------------------------------------
inline std::string& get_current_module_name()
{
static std::string module_name;
@@ -569,13 +316,23 @@ POP_WARNINGS
return str;
}
//----------------------------------------------------------------------------
inline std::string pad_string(std::string s, size_t n, char c = ' ', bool prepend = false)
{
if (s.size() < n)
{
if (prepend)
s = std::string(n - s.size(), c) + s;
else
s.append(n - s.size(), c);
}
return s;
}
//----------------------------------------------------------------------------
template<class t_pod_type>
std::string pod_to_hex(const t_pod_type& s)
{
static_assert(std::is_pod<t_pod_type>::value, "expected pod type");
std::string buff;
buff.assign(reinterpret_cast<const char*>(&s), sizeof(s));
return buff_to_hex_nodelimer(buff);
static_assert(std::is_standard_layout<t_pod_type>(), "expected standard layout type");
return to_hex::string(as_byte_span(s));
}
//----------------------------------------------------------------------------
template<class t_pod_type>
@@ -594,6 +351,14 @@ POP_WARNINGS
s = *(t_pod_type*)bin_buff.data();
return true;
}
//----------------------------------------------------------------------------
template<class t_pod_type>
bool hex_to_pod(const std::string& hex_str, tools::scrubbed<t_pod_type>& s)
{
return hex_to_pod(hex_str, unwrap(s));
}
//----------------------------------------------------------------------------
bool validate_hex(uint64_t length, const std::string& str);
//----------------------------------------------------------------------------
inline std::string get_extension(const std::string& str)
{
@@ -606,20 +371,6 @@ POP_WARNINGS
return res;
}
//----------------------------------------------------------------------------
inline std::string get_filename_from_path(const std::string& str)
{
std::string res;
std::string::size_type pos = str.rfind('\\');
if(std::string::npos == pos)
return str;
res = str.substr(pos+1, str.size()-pos);
return res;
}
//----------------------------------------------------------------------------
inline std::string cut_off_extension(const std::string& str)
{
std::string res;
@@ -630,126 +381,40 @@ POP_WARNINGS
res = str.substr(0, pos);
return res;
}
//----------------------------------------------------------------------------
#ifdef _WININET_
inline std::string get_string_from_systemtime(const SYSTEMTIME& sys_time)
{
std::string result_string;
char buff[100] = {0};
BOOL res = ::InternetTimeFromSystemTimeA(&sys_time, INTERNET_RFC1123_FORMAT, buff, 99);
if(!res)
{
LOG_ERROR("Failed to load SytemTime to string");
}
result_string = buff;
return result_string;
}
//-------------------------------------------------------------------------------------
inline SYSTEMTIME get_systemtime_from_string(const std::string& buff)
{
SYSTEMTIME result_time = {0};
BOOL res = ::InternetTimeToSystemTimeA(buff.c_str(), &result_time, NULL);
if(!res)
{
LOG_ERROR("Failed to load SytemTime from string " << buff << "interval set to 15 minutes");
}
return result_time;
}
#endif
#ifdef WINDOWS_PLATFORM
static const DWORD INFO_BUFFER_SIZE = 10000;
static const wchar_t* get_pc_name()
{
static wchar_t info[INFO_BUFFER_SIZE];
static DWORD bufCharCount = INFO_BUFFER_SIZE;
static bool init = false;
if (!init) {
if (!GetComputerNameW( info, &bufCharCount ))
info[0] = 0;
else
init = true;
}
return info;
}
static const wchar_t* get_user_name()
{
static wchar_t info[INFO_BUFFER_SIZE];
static DWORD bufCharCount = INFO_BUFFER_SIZE;
static bool init = false;
if (!init) {
if (!GetUserNameW( info, &bufCharCount ))
info[0] = 0;
else
init = true;
}
return info;
}
#endif
#ifdef _LM_
static const wchar_t* get_domain_name()
{
static wchar_t info[INFO_BUFFER_SIZE];
static DWORD bufCharCount = 0;
static bool init = false;
if (!init) {
LPWSTR domain( NULL );
NETSETUP_JOIN_STATUS status;
info[0] = 0;
if (NET_API_STATUS result = NetGetJoinInformation( NULL, &domain, &status ))
{
LOG_ERROR("get_domain_name error: " << log_space::get_win32_err_descr(result));
} else
{
StringCchCopyW( info, sizeof(info)/sizeof( info[0] ), domain );
NetApiBufferFree((void*)domain);
init = true;
}
}
return info;
}
#endif
#ifdef WINDOWS_PLATFORM
inline
std::string load_resource_string_a(int id, const char* pmodule_name = NULL)
{
//slow realization
HMODULE h = ::GetModuleHandleA( pmodule_name );
char buff[2000] = {0};
::LoadStringA( h, id, buff, sizeof(buff));
buff[sizeof(buff)-1] = 0; //be happy :)
return buff;
}
inline
std::wstring load_resource_string_w(int id, const char* pmodule_name = NULL)
{
//slow realization
HMODULE h = ::GetModuleHandleA( pmodule_name );
wchar_t buff[2000] = {0};
::LoadStringW( h, id, buff, sizeof(buff) / sizeof( buff[0] ) );
buff[(sizeof(buff)/sizeof(buff[0]))-1] = 0; //be happy :)
return buff;
}
//----------------------------------------------------------------------------
#ifdef _WIN32
inline std::wstring utf8_to_utf16(const std::string& str)
{
if (str.empty())
return {};
int wstr_size = MultiByteToWideChar(CP_UTF8, 0, &str[0], str.size(), NULL, 0);
if (wstr_size == 0)
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
std::wstring wstr(wstr_size, wchar_t{});
if (!MultiByteToWideChar(CP_UTF8, 0, &str[0], str.size(), &wstr[0], wstr_size))
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
return wstr;
}
inline std::string utf16_to_utf8(const std::wstring& wstr)
{
if (wstr.empty())
return {};
int str_size = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], wstr.size(), NULL, 0, NULL, NULL);
if (str_size == 0)
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
std::string str(str_size, char{});
if (!WideCharToMultiByte(CP_UTF8, 0, &wstr[0], wstr.size(), &str[0], str_size, NULL, NULL))
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
return str;
}
#endif
}
}

View File

@@ -31,10 +31,11 @@
#define __WINH_OBJ_H__
#include <boost/chrono/duration.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/v2/thread.hpp>
#include <boost/thread/thread.hpp>
namespace epee
{

View File

@@ -0,0 +1,67 @@
// Copyright (c) 2017-2018, 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.
#pragma once
#include <stddef.h>
#include <vector>
#include <string>
namespace epee
{
class wipeable_string
{
public:
wipeable_string() {}
wipeable_string(const wipeable_string &other);
wipeable_string(wipeable_string &&other);
wipeable_string(const std::string &other);
wipeable_string(std::string &&other);
wipeable_string(const char *s);
~wipeable_string();
void wipe();
void push_back(char c);
void pop_back();
const char *data() const noexcept { return buffer.data(); }
size_t size() const noexcept { return buffer.size(); }
bool empty() const noexcept { return buffer.empty(); }
void resize(size_t sz);
void reserve(size_t sz);
void clear();
bool operator==(const wipeable_string &other) const noexcept { return buffer == other.buffer; }
bool operator!=(const wipeable_string &other) const noexcept { return buffer != other.buffer; }
wipeable_string &operator=(wipeable_string &&other);
wipeable_string &operator=(const wipeable_string &other);
private:
void grow(size_t sz, size_t reserved = 0);
private:
std::vector<char> buffer;
};
}

View File

@@ -0,0 +1,68 @@
# Copyright (c) 2014-2018, 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.
add_library(epee STATIC hex.cpp http_auth.cpp mlog.cpp net_utils_base.cpp string_tools.cpp wipeable_string.cpp memwipe.c
connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp)
if (USE_READLINE AND GNU_READLINE_FOUND)
add_library(epee_readline STATIC readline_buffer.cpp)
endif()
if(HAVE_C11)
SET_PROPERTY(SOURCE memwipe.c PROPERTY COMPILE_FLAGS -std=c11)
endif()
# Build and install libepee if we're building for GUI
if (BUILD_GUI_DEPS)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS epee
ARCHIVE DESTINATION ${lib_folder})
if (USE_READLINE AND GNU_READLINE_FOUND)
install(TARGETS epee_readline
ARCHIVE DESTINATION ${lib_folder})
endif()
endif()
target_link_libraries(epee
PUBLIC
easylogging
${Boost_FILESYSTEM_LIBRARY}
PRIVATE
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES})
if (USE_READLINE AND GNU_READLINE_FOUND)
target_link_libraries(epee_readline
PUBLIC
easylogging
PRIVATE
${GNU_READLINE_LIBRARY})
endif()

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief base for connection, contains e.g. the ratelimit hooks
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
@@ -32,7 +32,7 @@
/* rfree: implementation for the non-template base, can be used by connection<> template class in abstract_tcp_server2 file */
#include "connection_basic.hpp"
#include "net/connection_basic.hpp"
#include <boost/asio.hpp>
#include <string>
@@ -53,10 +53,9 @@
#include "syncobj.h"
#include "../../contrib/epee/include/net/net_utils_base.h"
#include "../../contrib/epee/include/misc_log_ex.h"
#include "net/net_utils_base.h"
#include "misc_log_ex.h"
#include <boost/lambda/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/chrono.hpp>
@@ -75,15 +74,13 @@
#include <boost/asio/basic_socket.hpp>
#include <boost/asio/ip/unicast.hpp>
#include "../../contrib/epee/include/net/abstract_tcp_server2.h"
#include "../../contrib/otshell_utils/utils.hpp"
#include "data_logger.hpp"
using namespace nOT::nUtils;
#include "net/abstract_tcp_server2.h"
// TODO:
#include "../../src/p2p/network_throttle-detail.hpp"
#include "../../src/cryptonote_core/cryptonote_core.h"
#include "net/network_throttle-detail.hpp"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
// ################################################################################################
// local (TU local) headers
@@ -160,7 +157,7 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
++ref_sock_count; // increase the global counter
mI->m_peer_number = sock_number.fetch_add(1); // use, and increase the generated number
string remote_addr_str = "?";
std::string remote_addr_str = "?";
try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Spawned connection p2p#"<<mI->m_peer_number<<" to " << remote_addr_str << " currently we have sockets count:" << m_ref_sock_count);
@@ -168,21 +165,16 @@ connection_basic::connection_basic(boost::asio::io_service& io_service, std::ato
}
connection_basic::~connection_basic() noexcept(false) {
string remote_addr_str = "?";
std::string remote_addr_str = "?";
m_ref_sock_count--;
try { boost::system::error_code e; remote_addr_str = socket_.remote_endpoint(e).address().to_string(); } catch(...){} ;
_note("Destructing connection p2p#"<<mI->m_peer_number << " to " << remote_addr_str);
}
void connection_basic::set_rate_up_limit(uint64_t limit) {
// TODO remove __SCALING_FACTOR...
const double SCALING_FACTOR = 2.1; // to acheve the best performance
limit *= SCALING_FACTOR;
{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
network_throttle_manager::get_global_throttle_out().set_target_speed(limit);
network_throttle_manager::get_global_throttle_out().set_real_target_speed(limit / SCALING_FACTOR);
}
save_limit_to_file(limit);
}
@@ -219,19 +211,6 @@ uint64_t connection_basic::get_rate_down_limit() {
}
void connection_basic::save_limit_to_file(int limit) {
// saving limit to file
if (!epee::net_utils::data_logger::m_save_graph)
return;
{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
epee::net_utils::data_logger::get_instance().add_data("upload_limit", network_throttle_manager::get_global_throttle_out().get_target_speed() / 1024);
}
{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_in );
epee::net_utils::data_logger::get_instance().add_data("download_limit", network_throttle_manager::get_global_throttle_in().get_target_speed() / 1024);
}
}
void connection_basic::set_tos_flag(int tos) {
@@ -253,15 +232,13 @@ void connection_basic::sleep_before_packet(size_t packet_size, int phase, int q
{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
delay = network_throttle_manager::get_global_throttle_out().get_sleep_time_after_tick( packet_size ); // decission from global
delay = network_throttle_manager::get_global_throttle_out().get_sleep_time_after_tick( packet_size );
}
delay *= 0.50;
if (delay > 0) {
long int ms = (long int)(delay * 1000);
_info_c("net/sleep", "Sleeping in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<packet_size); // debug sleep
_dbg1("sleep in sleep_before_packet");
epee::net_utils::data_logger::get_instance().add_data("sleep_up", ms);
MTRACE("Sleeping in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<packet_size); // debug sleep
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
}
} while(delay > 0);
@@ -269,7 +246,7 @@ void connection_basic::sleep_before_packet(size_t packet_size, int phase, int q
// XXX LATER XXX
{
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
network_throttle_manager::get_global_throttle_out().handle_trafic_exact( packet_size * 700); // increase counter - global
network_throttle_manager::get_global_throttle_out().handle_trafic_exact( packet_size ); // increase counter - global
}
}
@@ -279,26 +256,22 @@ void connection_basic::set_start_time() {
}
void connection_basic::do_send_handler_write(const void* ptr , size_t cb ) {
sleep_before_packet(cb,1,-1);
_info_c("net/out/size", "handler_write (direct) - before ASIO write, for packet="<<cb<<" B (after sleep)");
// No sleeping here; sleeping is done once and for all in connection<t_protocol_handler>::handle_write
MTRACE("handler_write (direct) - before ASIO write, for packet="<<cb<<" B (after sleep)");
set_start_time();
}
void connection_basic::do_send_handler_write_from_queue( const boost::system::error_code& e, size_t cb, int q_len ) {
sleep_before_packet(cb,2,q_len);
_info_c("net/out/size", "handler_write (after write, from queue="<<q_len<<") - before ASIO write, for packet="<<cb<<" B (after sleep)");
// No sleeping here; sleeping is done once and for all in connection<t_protocol_handler>::handle_write
MTRACE("handler_write (after write, from queue="<<q_len<<") - before ASIO write, for packet="<<cb<<" B (after sleep)");
set_start_time();
}
void connection_basic::logger_handle_net_read(size_t size) { // network data read
size /= 1024;
epee::net_utils::data_logger::get_instance().add_data("download", size);
}
void connection_basic::logger_handle_net_write(size_t size) {
size /= 1024;
epee::net_utils::data_logger::get_instance().add_data("upload", size);
}
double connection_basic::get_sleep_time(size_t cb) {
@@ -308,7 +281,6 @@ double connection_basic::get_sleep_time(size_t cb) {
}
void connection_basic::set_save_graph(bool save_graph) {
epee::net_utils::data_logger::m_save_graph = save_graph;
}

82
contrib/epee/src/hex.cpp Normal file
View File

@@ -0,0 +1,82 @@
// Copyright (c) 2017-2018, 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.
#include "hex.h"
#include <iterator>
#include <limits>
#include <ostream>
#include <stdexcept>
namespace epee
{
namespace
{
template<typename T>
void write_hex(T&& out, const span<const std::uint8_t> src)
{
static constexpr const char hex[] = u8"0123456789abcdef";
static_assert(sizeof(hex) == 17, "bad string size");
for (const std::uint8_t byte : src)
{
*out = hex[byte >> 4];
++out;
*out = hex[byte & 0x0F];
++out;
}
}
}
std::string to_hex::string(const span<const std::uint8_t> src)
{
if (std::numeric_limits<std::size_t>::max() / 2 < src.size())
throw std::range_error("hex_view::to_string exceeded maximum size");
std::string out{};
out.resize(src.size() * 2);
buffer_unchecked(std::addressof(out[0]), src);
return out;
}
void to_hex::buffer(std::ostream& out, const span<const std::uint8_t> src)
{
write_hex(std::ostreambuf_iterator<char>{out}, src);
}
void to_hex::formatted(std::ostream& out, const span<const std::uint8_t> src)
{
out.put('<');
buffer(out, src);
out.put('>');
}
void to_hex::buffer_unchecked(char* out, const span<const std::uint8_t> src) noexcept
{
return write_hex(out, src);
}
}

View File

@@ -0,0 +1,785 @@
// Copyright (c) 2014-2018, 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.
#include "net/http_auth.h"
#include <array>
#include <boost/algorithm/string/find_iterator.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/algorithm/iteration/iter_fold.hpp>
#include <boost/fusion/algorithm/query/any.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/algorithm/find_if.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/range/join.hpp>
#include <boost/spirit/include/karma_generate.hpp>
#include <boost/spirit/include/karma_uint.hpp>
#include <boost/spirit/include/qi_alternative.hpp>
#include <boost/spirit/include/qi_and_predicate.hpp>
#include <boost/spirit/include/qi_char.hpp>
#include <boost/spirit/include/qi_char_class.hpp>
#include <boost/spirit/include/qi_difference.hpp>
#include <boost/spirit/include/qi_kleene.hpp>
#include <boost/spirit/include/qi_parse.hpp>
#include <boost/spirit/include/qi_plus.hpp>
#include <boost/spirit/include/qi_no_case.hpp>
#include <boost/spirit/include/qi_not_predicate.hpp>
#include <boost/spirit/include/qi_raw.hpp>
#include <boost/spirit/include/qi_rule.hpp>
#include <boost/spirit/include/qi_sequence.hpp>
#include <boost/spirit/include/qi_string.hpp>
#include <boost/spirit/include/qi_symbols.hpp>
#include <boost/spirit/include/qi_uint.hpp>
#include <cassert>
#include <iterator>
#include <limits>
#include <tuple>
#include <type_traits>
#include "hex.h"
#include "md5_l.h"
#include "string_coding.h"
/* This file uses the `u8` prefix and specifies all chars by ASCII numeric
value. This is for maximum portability - C++ does not actually specify ASCII
as the encoding type for unprefixed string literals, etc. Although rare, the
effort required to support rare compiler encoding types is low.
Also be careful of qi::ascii character classes (`qi::asci::alpha`, etc.) -
non-ASCII characters will cause undefined behavior in the table lookup until
boost 1.60. The expression `&qi::ascii::char_` will fail on non-ASCII
characters without "consuming" the input character. */
namespace
{
namespace http = epee::net_utils::http;
// string_ref is only constexpr if length is given
template<std::size_t N>
constexpr boost::string_ref ceref(const char (&arg)[N])
{
return boost::string_ref(arg, N - 1);
}
constexpr const auto client_auth_field = ceref(u8"Authorization");
constexpr const auto server_auth_field = ceref(u8"WWW-authenticate");
constexpr const auto auth_realm = ceref(u8"monero-rpc");
constexpr const char comma = 44;
constexpr const char equal_sign = 61;
constexpr const char quote = 34;
constexpr const char zero = 48;
constexpr const auto sess_algo = ceref(u8"-sess");
constexpr const unsigned client_reserve_size = 512; //!< std::string::reserve size for clients
//// Digest Algorithms
struct md5_
{
static constexpr const boost::string_ref name = ceref(u8"MD5");
struct update
{
template<typename T>
void operator()(const T& arg) const
{
const boost::iterator_range<const char*> data(boost::as_literal(arg));
md5::MD5Update(
std::addressof(ctx),
reinterpret_cast<const std::uint8_t*>(data.begin()),
data.size()
);
}
void operator()(const std::string& arg) const
{
(*this)(boost::string_ref(arg));
}
void operator()(const epee::wipeable_string& arg) const
{
md5::MD5Update(
std::addressof(ctx),
reinterpret_cast<const std::uint8_t*>(arg.data()),
arg.size()
);
}
md5::MD5_CTX& ctx;
};
template<typename... T>
std::array<char, 32> operator()(const T&... args) const
{
md5::MD5_CTX ctx{};
md5::MD5Init(std::addressof(ctx));
boost::fusion::for_each(std::tie(args...), update{ctx});
std::array<std::uint8_t, 16> digest{{}};
md5::MD5Final(digest.data(), std::addressof(ctx));
return epee::to_hex::array(digest);
}
};
constexpr const boost::string_ref md5_::name;
//! Digest Algorithms available for HTTP Digest Auth. Sort better algos to the left
constexpr const std::tuple<md5_> digest_algorithms{};
//// Various String Utilities
struct ascii_tolower_
{
template<typename Char>
constexpr Char operator()(Char value) const noexcept
{
static_assert(std::is_integral<Char>::value, "only integral types supported");
return (65 <= value && value <= 90) ? (value + 32) : value;
}
};
constexpr const ascii_tolower_ ascii_tolower{};
struct ascii_iequal_
{
template<typename Char>
constexpr bool operator()(Char left, Char right) const noexcept
{
return ascii_tolower(left) == ascii_tolower(right);
}
};
constexpr const ascii_iequal_ ascii_iequal{};
struct http_list_separator_
{
template<typename Char>
bool operator()(Char value) const noexcept
{
static_assert(std::is_integral<Char>::value, "only integral types supported");
return boost::spirit::char_encoding::ascii::isascii_(value) &&
(value == comma || boost::spirit::char_encoding::ascii::isspace(value));
}
};
constexpr const http_list_separator_ http_list_separator{};
std::string to_string(boost::iterator_range<const char*> source)
{
return {source.begin(), source.size()};
}
template<typename T>
void add_first_field(std::string& str, const char* const name, const T& value)
{
str.append(name);
str.push_back(equal_sign);
boost::copy(value, std::back_inserter(str));
}
template<typename T>
void add_field(std::string& str, const char* const name, const T& value)
{
str.push_back(comma);
add_first_field(str, name, value);
}
template<typename T>
using quoted_result = boost::joined_range<
const boost::joined_range<const boost::string_ref, const T>, const boost::string_ref
>;
template<typename T>
quoted_result<T> quoted(const T& arg)
{
return boost::range::join(boost::range::join(ceref(u8"\""), arg), ceref(u8"\""));
}
//// Digest Authentication
template<typename Digest>
typename std::result_of<Digest()>::type generate_a1(
Digest digest, const http::login& creds, const boost::string_ref realm)
{
return digest(creds.username, u8":", realm, u8":", creds.password);
}
template<typename Digest>
typename std::result_of<Digest()>::type generate_a1(
Digest digest, const http::http_client_auth::session& user)
{
return generate_a1(std::move(digest), user.credentials, user.server.realm);
}
template<typename T>
void init_client_value(std::string& str,
const boost::string_ref algorithm, const http::http_client_auth::session& user,
const boost::string_ref uri, const T& response)
{
str.append(u8"Digest ");
add_first_field(str, u8"algorithm", algorithm);
add_field(str, u8"nonce", quoted(user.server.nonce));
add_field(str, u8"realm", quoted(user.server.realm));
add_field(str, u8"response", quoted(response));
add_field(str, u8"uri", quoted(uri));
add_field(str, u8"username", quoted(user.credentials.username));
if (!user.server.opaque.empty())
add_field(str, u8"opaque", quoted(user.server.opaque));
}
//! Implements superseded algorithm specified in RFC 2069
template<typename Digest>
struct old_algorithm
{
explicit old_algorithm(Digest digest_) : digest(std::move(digest_)) {}
std::string operator()(const http::http_client_auth::session& user,
const boost::string_ref method, const boost::string_ref uri) const
{
const auto response = digest(
generate_a1(digest, user), u8":", user.server.nonce, u8":", digest(method, u8":", uri)
);
std::string out{};
out.reserve(client_reserve_size);
init_client_value(out, Digest::name, user, uri, response);
return out;
}
private:
Digest digest;
};
//! Implements the `qop=auth` algorithm specified in RFC 2617
template<typename Digest>
struct auth_algorithm
{
explicit auth_algorithm(Digest digest_) : digest(std::move(digest_)) {}
std::string operator()(const http::http_client_auth::session& user,
const boost::string_ref method, const boost::string_ref uri) const
{
namespace karma = boost::spirit::karma;
using counter_type = decltype(user.counter);
static_assert(
std::numeric_limits<counter_type>::radix == 2, "unexpected radix for counter"
);
static_assert(
std::numeric_limits<counter_type>::digits <= 32,
"number of digits will cause underflow on padding below"
);
std::string out{};
out.reserve(client_reserve_size);
karma::generate(std::back_inserter(out), karma::hex(user.counter));
out.insert(out.begin(), 8 - out.size(), zero); // zero left pad
if (out.size() != 8)
return {};
std::array<char, 8> nc{{}};
boost::copy(out, nc.data());
const auto response = digest(
generate_a1(digest, user), u8":", user.server.nonce, u8":", nc, u8"::auth:", digest(method, u8":", uri)
);
out.clear();
init_client_value(out, Digest::name, user, uri, response);
add_field(out, u8"qop", ceref(u8"auth"));
add_field(out, u8"nc", nc);
return out;
}
private:
Digest digest;
};
//! Processes client "Authorization" and server "WWW-authenticate" HTTP fields
struct auth_message
{
using iterator = const char*;
enum status{ kFail = 0, kStale, kPass };
//! \return Status of the `response` field from the client
static status verify(const boost::string_ref method, const boost::string_ref request,
const http::http_server_auth::session& user)
{
const auto parsed = parse(request);
if (parsed &&
boost::equals(parsed->username, user.credentials.username) &&
boost::fusion::any(digest_algorithms, has_valid_response{*parsed, user, method}))
{
if (boost::equals(parsed->nonce, user.nonce))
{
// RFC 2069 format does not verify nc value - allow just once
if (user.counter == 1 || (!parsed->qop.empty() && parsed->counter() == user.counter))
{
return kPass;
}
}
return kStale;
}
return kFail;
}
//! \return Information needed to generate client authentication `response`s.
static http::http_client_auth::session::keys extract(
const http::http_response_info& response, const bool is_first)
{
using field = std::pair<std::string, std::string>;
server_parameters best{};
const std::list<field>& fields = response.m_header_info.m_etc_fields;
auto current = fields.begin();
const auto end = fields.end();
while (true)
{
current = std::find_if(current, end, [] (const field& value) {
return boost::equals(server_auth_field, value.first, ascii_iequal);
});
if (current == end)
break;
const auto parsed = parse(current->second);
if (parsed)
{
server_parameters local_best = parsed->algorithm.empty() ?
server_parameters{*parsed, boost::fusion::find<md5_>(digest_algorithms)} :
boost::fusion::iter_fold(digest_algorithms, server_parameters{}, matches_algorithm{*parsed});
if (local_best.index < best.index)
best = std::move(local_best);
}
++current;
}
if (is_first || boost::equals(best.stale, ceref(u8"true"), ascii_iequal))
return best.take();
return {}; // authentication failed with bad user/pass
}
private:
explicit auth_message()
: algorithm()
, cnonce()
, nc()
, nonce()
, qop()
, realm()
, response()
, stale()
, uri()
, username() {
}
static boost::optional<auth_message> parse(const boost::string_ref request)
{
struct parser
{
using field_parser = std::function<bool(const parser&, iterator&, iterator, auth_message&)>;
explicit parser() : field_table(), skip_whitespace(), header(), quoted_string(), token(), fields() {
using namespace std::placeholders;
namespace qi = boost::spirit::qi;
struct parse_nc
{
bool operator()(const parser&, iterator& current, const iterator end, auth_message& result) const
{
return qi::parse(
current, end,
(qi::raw[qi::uint_parser<std::uint32_t, 16, 8, 8>{}]),
result.nc
);
}
};
struct parse_token
{
bool operator()(const parser& parse, iterator& current, const iterator end,
boost::iterator_range<iterator>& result) const
{
return qi::parse(current, end, parse.token, result);
}
};
struct parse_string
{
bool operator()(const parser& parse, iterator& current, const iterator end,
boost::iterator_range<iterator>& result) const
{
return qi::parse(current, end, parse.quoted_string, result);
}
bool operator()(const parser& parse, iterator& current, const iterator end) const
{
return qi::parse(current, end, parse.quoted_string);
}
};
struct parse_response
{
bool operator()(const parser&, iterator& current, const iterator end, auth_message& result) const
{
using byte = qi::uint_parser<std::uint8_t, 16, 2, 2>;
return qi::parse(
current, end,
(qi::lit(quote) >> qi::raw[+(byte{})] >> qi::lit(quote)),
result.response
);
}
};
field_table.add
(u8"algorithm", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::algorithm, _4)))
(u8"cnonce", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::cnonce, _4)))
(u8"domain", std::bind(parse_string{}, _1, _2, _3)) // ignore field
(u8"nc", parse_nc{})
(u8"nonce", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::nonce, _4)))
(u8"opaque", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::opaque, _4)))
(u8"qop", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::qop, _4)))
(u8"realm", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::realm, _4)))
(u8"response", parse_response{})
(u8"stale", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::stale, _4)))
(u8"uri", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::uri, _4)))
(u8"username", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::username, _4)));
skip_whitespace = *(&qi::ascii::char_ >> qi::ascii::space);
header = skip_whitespace >> qi::ascii::no_case[u8"digest"] >> skip_whitespace;
quoted_string = (qi::lit(quote) >> qi::raw[+(u8"\\\"" | (qi::ascii::char_ - quote))] >> qi::lit(quote));
token =
(!qi::lit(quote) >> qi::raw[+(&qi::ascii::char_ >> (qi::ascii::graph - qi::ascii::char_(u8"()<>@,;:\\\"/[]?={}")))]) |
quoted_string;
fields = field_table >> skip_whitespace >> equal_sign >> skip_whitespace;
}
boost::optional<auth_message> operator()(const boost::string_ref request) const
{
namespace qi = boost::spirit::qi;
iterator current = request.begin();
const iterator end = request.end();
if (!qi::parse(current, end, header))
{
return boost::none;
}
auth_message info{};
field_parser null_parser{};
std::reference_wrapper<const field_parser> field = null_parser;
do // require at least one field; require field after `,` character
{
if (!qi::parse(current, end, fields, field) || !field(*this, current, end, info))
{
return boost::none;
}
qi::parse(current, end, skip_whitespace);
} while (qi::parse(current, end, qi::char_(comma) >> skip_whitespace));
return boost::make_optional(current == end, info);
}
private:
boost::spirit::qi::symbols<
char, field_parser, boost::spirit::qi::tst<char, field_parser>, ascii_tolower_
> field_table;
boost::spirit::qi::rule<iterator> skip_whitespace;
boost::spirit::qi::rule<iterator> header;
boost::spirit::qi::rule<iterator, boost::iterator_range<iterator>()> quoted_string;
boost::spirit::qi::rule<iterator, boost::iterator_range<iterator>()> token;
boost::spirit::qi::rule<iterator, std::reference_wrapper<const field_parser>()> fields;
}; // parser
static const parser parse_;
return parse_(request);
}
struct has_valid_response
{
template<typename Digest, typename Result>
Result generate_old_response(Digest digest, const Result& key, const Result& auth) const
{
return digest(key, u8":", request.nonce, u8":", auth);
}
template<typename Digest, typename Result>
Result generate_new_response(Digest digest, const Result& key, const Result& auth) const
{
return digest(
key, u8":", request.nonce, u8":", request.nc, u8":", request.cnonce, u8":", request.qop, u8":", auth
);
}
template<typename Result>
bool check(const Result& result) const
{
return boost::equals(request.response, result, ascii_iequal);
}
template<typename Digest>
bool operator()(const Digest& digest) const
{
if (boost::starts_with(request.algorithm, Digest::name, ascii_iequal) ||
(request.algorithm.empty() && std::is_same<md5_, Digest>::value))
{
auto key = generate_a1(digest, user.credentials, auth_realm);
if (boost::ends_with(request.algorithm, sess_algo, ascii_iequal))
{
key = digest(key, u8":", request.nonce, u8":", request.cnonce);
}
auto auth = digest(method, u8":", request.uri);
if (request.qop.empty())
{
return check(generate_old_response(std::move(digest), std::move(key), std::move(auth)));
}
else if (boost::equals(ceref(u8"auth"), request.qop, ascii_iequal))
{
return check(generate_new_response(std::move(digest), std::move(key), std::move(auth)));
}
}
return false;
}
const auth_message& request;
const http::http_server_auth::session& user;
const boost::string_ref method;
};
boost::optional<std::uint32_t> counter() const
{
namespace qi = boost::spirit::qi;
using hex = qi::uint_parser<std::uint32_t, 16>;
std::uint32_t value = 0;
const bool converted = qi::parse(nc.begin(), nc.end(), hex{}, value);
return boost::make_optional(converted, value);
}
struct server_parameters
{
server_parameters()
: nonce(), opaque(), realm(), stale(), value_generator()
, index(boost::fusion::size(digest_algorithms))
{}
template<typename DigestIter>
explicit server_parameters(const auth_message& request, const DigestIter& digest)
: nonce(request.nonce)
, opaque(request.opaque)
, stale(request.stale)
, realm(request.realm)
, value_generator()
, index(boost::fusion::distance(boost::fusion::begin(digest_algorithms), digest))
{
using digest_type = typename boost::fusion::result_of::value_of<DigestIter>::type;
// debug check internal state of the auth_message class
assert(
(std::is_same<digest_type, md5_>::value) ||
boost::equals((*digest).name, request.algorithm, ascii_iequal)
);
if (request.qop.empty())
value_generator = old_algorithm<digest_type>{*digest};
else
{
for (auto elem = boost::make_split_iterator(request.qop, boost::token_finder(http_list_separator));
!elem.eof();
++elem)
{
if (boost::equals(ceref(u8"auth"), *elem, ascii_iequal))
{
value_generator = auth_algorithm<digest_type>{*digest};
break;
}
}
if (!value_generator) // no supported qop mode
index = boost::fusion::size(digest_algorithms);
}
}
http::http_client_auth::session::keys take()
{
return {to_string(nonce), to_string(opaque), to_string(realm), std::move(value_generator)};
}
boost::iterator_range<iterator> nonce;
boost::iterator_range<iterator> opaque;
boost::iterator_range<iterator> realm;
boost::iterator_range<iterator> stale;
http::http_client_auth::session::keys::algorithm value_generator;
unsigned index;
};
struct matches_algorithm
{
template<typename DigestIter>
server_parameters operator()(server_parameters current, const DigestIter& digest) const
{
if (!current.value_generator)
{
if (boost::equals(response.algorithm, (*digest).name, ascii_iequal))
{
current = server_parameters{response, digest};
}
}
return current;
}
const auth_message& response;
};
boost::iterator_range<iterator> algorithm;
boost::iterator_range<iterator> cnonce;
boost::iterator_range<iterator> nc;
boost::iterator_range<iterator> nonce;
boost::iterator_range<iterator> opaque;
boost::iterator_range<iterator> qop;
boost::iterator_range<iterator> realm;
boost::iterator_range<iterator> response;
boost::iterator_range<iterator> stale;
boost::iterator_range<iterator> uri;
boost::iterator_range<iterator> username;
}; // auth_message
struct add_challenge
{
template<typename Digest>
void operator()(const Digest& digest) const
{
static constexpr const auto fvalue = ceref(u8"Digest qop=\"auth\"");
for (unsigned i = 0; i < 2; ++i)
{
std::string out(fvalue);
const auto algorithm = boost::range::join(
Digest::name, (i == 0 ? boost::string_ref{} : sess_algo)
);
add_field(out, u8"algorithm", algorithm);
add_field(out, u8"realm", quoted(auth_realm));
add_field(out, u8"nonce", quoted(nonce));
add_field(out, u8"stale", is_stale ? ceref("true") : ceref("false"));
fields.push_back(std::make_pair(std::string(server_auth_field), std::move(out)));
}
}
const boost::string_ref nonce;
std::list<std::pair<std::string, std::string>>& fields;
const bool is_stale;
};
http::http_response_info create_digest_response(const boost::string_ref nonce, const bool is_stale)
{
epee::net_utils::http::http_response_info rc{};
rc.m_response_code = 401;
rc.m_response_comment = u8"Unauthorized";
rc.m_mime_tipe = u8"text/html";
rc.m_body =
u8"<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>";
boost::fusion::for_each(
digest_algorithms, add_challenge{nonce, rc.m_additional_fields, is_stale}
);
return rc;
}
}
namespace epee
{
namespace net_utils
{
namespace http
{
http_server_auth::http_server_auth(login credentials, std::function<void(size_t, uint8_t*)> r)
: user(session{std::move(credentials)}), rng(std::move(r)) {
}
boost::optional<http_response_info> http_server_auth::do_get_response(const http_request_info& request)
{
assert(user);
using field = std::pair<std::string, std::string>;
const std::list<field>& fields = request.m_header_info.m_etc_fields;
const auto auth = boost::find_if(fields, [] (const field& value) {
return boost::equals(client_auth_field, value.first, ascii_iequal);
});
bool is_stale = false;
if (auth != fields.end())
{
++(user->counter);
switch (auth_message::verify(request.m_http_method_str, auth->second, *user))
{
case auth_message::kPass:
return boost::none;
case auth_message::kStale:
is_stale = true;
break;
default:
case auth_message::kFail:
break;
}
}
user->counter = 0;
{
std::array<std::uint8_t, 16> rand_128bit{{}};
rng(rand_128bit.size(), rand_128bit.data());
user->nonce = string_encoding::base64_encode(rand_128bit.data(), rand_128bit.size());
}
return create_digest_response(user->nonce, is_stale);
}
http_client_auth::http_client_auth(login credentials)
: user(session{std::move(credentials)}) {
}
http_client_auth::status http_client_auth::do_handle_401(const http_response_info& response)
{
assert(user);
const bool first_auth = (user->counter == 0);
user->server = auth_message::extract(response, first_auth);
if (user->server.generator)
{
user->counter = 0;
return kSuccess;
}
return first_auth ? kParseFailure : kBadPassword;
}
boost::optional<std::pair<std::string, std::string>> http_client_auth::do_get_auth_field(
const boost::string_ref method, const boost::string_ref uri)
{
assert(user);
if (user->server.generator)
{
++(user->counter);
return std::make_pair(std::string(client_auth_field), user->server.generator(*user, method, uri));
}
return boost::none;
}
}
}
}

113
contrib/epee/src/memwipe.c Normal file
View File

@@ -0,0 +1,113 @@
// Copyright (c) 2017-2018, 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.
//
// Parts of this file Copyright (c) 2009-2015 The Bitcoin Core developers
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#ifdef HAVE_EXPLICIT_BZERO
#include <strings.h>
#endif
#include "memwipe.h"
#if defined(_MSC_VER)
#define SCARECROW \
__asm;
#else
#define SCARECROW \
__asm__ __volatile__("" : : "r"(ptr) : "memory");
#endif
#ifdef HAVE_MEMSET_S
void *memwipe(void *ptr, size_t n)
{
if (memset_s(ptr, n, 0, n))
{
#ifdef NDEBUG
fprintf(stderr, "Error: memset_s failed\n");
_exit(1);
#else
abort();
#endif
}
SCARECROW // might as well...
return ptr;
}
#elif defined HAVE_EXPLICIT_BZERO
void *memwipe(void *ptr, size_t n)
{
explicit_bzero(ptr, n);
SCARECROW
return ptr;
}
#else
/* The memory_cleanse implementation is taken from Bitcoin */
/* Compilers have a bad habit of removing "superfluous" memset calls that
* are trying to zero memory. For example, when memset()ing a buffer and
* then free()ing it, the compiler might decide that the memset is
* unobservable and thus can be removed.
*
* Previously we used OpenSSL which tried to stop this by a) implementing
* memset in assembly on x86 and b) putting the function in its own file
* for other platforms.
*
* This change removes those tricks in favour of using asm directives to
* scare the compiler away. As best as our compiler folks can tell, this is
* sufficient and will continue to be so.
*
* Adam Langley <agl@google.com>
* Commit: ad1907fe73334d6c696c8539646c21b11178f20f
* BoringSSL (LICENSE: ISC)
*/
static void memory_cleanse(void *ptr, size_t len)
{
memset(ptr, 0, len);
/* As best as we can tell, this is sufficient to break any optimisations that
might try to eliminate "superfluous" memsets. If there's an easy way to
detect memset_s, it would be better to use that. */
SCARECROW
}
void *memwipe(void *ptr, size_t n)
{
memory_cleanse(ptr, n);
SCARECROW
return ptr;
}
#endif

388
contrib/epee/src/mlog.cpp Normal file
View File

@@ -0,0 +1,388 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#ifndef _MLOG_H_
#define _MLOG_H_
#include <time.h>
#include <atomic>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "string_tools.h"
#include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "logging"
#define MLOG_BASE_FORMAT "%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg"
#define MLOG_LOG(x) CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << x
using namespace epee;
static std::string generate_log_filename(const char *base)
{
std::string filename(base);
static unsigned int fallback_counter = 0;
char tmp[200];
struct tm tm;
time_t now = time(NULL);
if
#ifdef WIN32
(!gmtime_s(&tm, &now))
#else
(!gmtime_r(&now, &tm))
#endif
snprintf(tmp, sizeof(tmp), "part-%u", ++fallback_counter);
else
strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm);
tmp[sizeof(tmp) - 1] = 0;
filename += "-";
filename += tmp;
return filename;
}
std::string mlog_get_default_log_path(const char *default_filename)
{
std::string process_name = epee::string_tools::get_current_module_name();
std::string default_log_folder = epee::string_tools::get_current_module_folder();
std::string default_log_file = process_name;
std::string::size_type a = default_log_file.rfind('.');
if ( a != std::string::npos )
default_log_file.erase( a, default_log_file.size());
if ( ! default_log_file.empty() )
default_log_file += ".log";
else
default_log_file = default_filename;
return (boost::filesystem::path(default_log_folder) / boost::filesystem::path(default_log_file)).string();
}
static void mlog_set_common_prefix()
{
static const char * const expected_filename = "contrib/epee/src/mlog.cpp";
const char *path = __FILE__, *expected_ptr = strstr(path, expected_filename);
if (!expected_ptr)
return;
el::Loggers::setFilenameCommonPrefix(std::string(path, expected_ptr - path));
}
static const char *get_default_categories(int level)
{
const char *categories = "";
switch (level)
{
case 0:
categories = "*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO";
break;
case 1:
categories = "*:INFO,global:INFO,stacktrace:INFO,logging:INFO,msgwriter:INFO";
break;
case 2:
categories = "*:DEBUG";
break;
case 3:
categories = "*:TRACE";
break;
case 4:
categories = "*:TRACE";
break;
default:
break;
}
return categories;
}
void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size)
{
el::Configurations c;
c.setGlobally(el::ConfigurationType::Filename, filename_base);
c.setGlobally(el::ConfigurationType::ToFile, "true");
const char *log_format = getenv("MONERO_LOG_FORMAT");
if (!log_format)
log_format = MLOG_BASE_FORMAT;
c.setGlobally(el::ConfigurationType::Format, log_format);
c.setGlobally(el::ConfigurationType::ToStandardOutput, console ? "true" : "false");
c.setGlobally(el::ConfigurationType::MaxLogFileSize, std::to_string(max_log_file_size));
el::Loggers::setDefaultConfigurations(c, true);
el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging);
el::Loggers::addFlag(el::LoggingFlag::CreateLoggerAutomatically);
el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
el::Helpers::installPreRollOutCallback([filename_base](const char *name, size_t){
std::string rname = generate_log_filename(filename_base.c_str());
rename(name, rname.c_str());
});
mlog_set_common_prefix();
const char *monero_log = getenv("MONERO_LOGS");
if (!monero_log)
{
monero_log = get_default_categories(0);
}
mlog_set_log(monero_log);
}
void mlog_set_categories(const char *categories)
{
std::string new_categories;
if (*categories)
{
if (*categories == '+')
{
++categories;
new_categories = mlog_get_categories();
if (*categories)
{
if (!new_categories.empty())
new_categories += ",";
new_categories += categories;
}
}
else if (*categories == '-')
{
++categories;
new_categories = mlog_get_categories();
std::vector<std::string> single_categories;
boost::split(single_categories, categories, boost::is_any_of(","), boost::token_compress_on);
for (const std::string &s: single_categories)
{
size_t pos = new_categories.find(s);
if (pos != std::string::npos)
new_categories = new_categories.erase(pos, s.size());
}
}
else
{
new_categories = categories;
}
}
el::Loggers::setCategories(new_categories.c_str(), true);
MLOG_LOG("New log categories: " << el::Loggers::getCategories());
}
std::string mlog_get_categories()
{
return el::Loggers::getCategories();
}
// maps epee style log level to new logging system
void mlog_set_log_level(int level)
{
const char *categories = get_default_categories(level);
mlog_set_categories(categories);
}
void mlog_set_log(const char *log)
{
long level;
char *ptr = NULL;
if (!*log)
{
mlog_set_categories(log);
return;
}
level = strtol(log, &ptr, 10);
if (ptr && *ptr)
{
// we can have a default level, eg, 2,foo:ERROR
if (*ptr == ',') {
std::string new_categories = std::string(get_default_categories(level)) + ptr;
mlog_set_categories(new_categories.c_str());
}
else {
mlog_set_categories(log);
}
}
else if (level >= 0 && level <= 4)
{
mlog_set_log_level(level);
}
else
{
MERROR("Invalid numerical log level: " << log);
}
}
namespace epee
{
bool is_stdout_a_tty()
{
static std::atomic<bool> initialized(false);
static std::atomic<bool> is_a_tty(false);
if (!initialized.load(std::memory_order_acquire))
{
#if defined(WIN32)
is_a_tty.store(0 != _isatty(_fileno(stdout)), std::memory_order_relaxed);
#else
is_a_tty.store(0 != isatty(fileno(stdout)), std::memory_order_relaxed);
#endif
initialized.store(true, std::memory_order_release);
}
return is_a_tty.load(std::memory_order_relaxed);
}
void set_console_color(int color, bool bright)
{
if (!is_stdout_a_tty())
return;
switch(color)
{
case console_color_default:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE| (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;37m";
else
std::cout << "\033[0m";
#endif
}
break;
case console_color_white:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;37m";
else
std::cout << "\033[0;37m";
#endif
}
break;
case console_color_red:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;31m";
else
std::cout << "\033[0;31m";
#endif
}
break;
case console_color_green:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;32m";
else
std::cout << "\033[0;32m";
#endif
}
break;
case console_color_blue:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE | FOREGROUND_INTENSITY);//(bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;34m";
else
std::cout << "\033[0;34m";
#endif
}
break;
case console_color_cyan:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_BLUE | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;36m";
else
std::cout << "\033[0;36m";
#endif
}
break;
case console_color_magenta:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE | FOREGROUND_RED | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;35m";
else
std::cout << "\033[0;35m";
#endif
}
break;
case console_color_yellow:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;33m";
else
std::cout << "\033[0;33m";
#endif
}
break;
}
}
void reset_console_color() {
if (!is_stdout_a_tty())
return;
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
#else
std::cout << "\033[0m";
std::cout.flush();
#endif
}
}
#endif //_MLOG_H_

View File

@@ -0,0 +1,90 @@
#include "net/net_utils_base.h"
#include "string_tools.h"
#include <cstring>
#include <typeindex>
#include "net/local_ip.h"
namespace epee { namespace net_utils
{
const uint8_t ipv4_network_address::ID;
bool ipv4_network_address::equal(const ipv4_network_address& other) const noexcept
{ return is_same_host(other) && port() == other.port(); }
bool ipv4_network_address::less(const ipv4_network_address& other) const noexcept
{ return is_same_host(other) ? port() < other.port() : ip() < other.ip(); }
std::string ipv4_network_address::str() const
{ return string_tools::get_ip_string_from_int32(ip()) + ":" + std::to_string(port()); }
std::string ipv4_network_address::host_str() const { return string_tools::get_ip_string_from_int32(ip()); }
bool ipv4_network_address::is_loopback() const { return net_utils::is_ip_loopback(ip()); }
bool ipv4_network_address::is_local() const { return net_utils::is_ip_local(ip()); }
bool network_address::equal(const network_address& other) const
{
// clang typeid workaround
network_address::interface const* const self_ = self.get();
network_address::interface const* const other_self = other.self.get();
if (self_ == other_self) return true;
if (!self_ || !other_self) return false;
if (typeid(*self_) != typeid(*other_self)) return false;
return self_->equal(*other_self);
}
bool network_address::less(const network_address& other) const
{
// clang typeid workaround
network_address::interface const* const self_ = self.get();
network_address::interface const* const other_self = other.self.get();
if (self_ == other_self) return false;
if (!self_ || !other_self) return self == nullptr;
if (typeid(*self_) != typeid(*other_self))
return self_->get_type_id() < other_self->get_type_id();
return self_->less(*other_self);
}
bool network_address::is_same_host(const network_address& other) const
{
// clang typeid workaround
network_address::interface const* const self_ = self.get();
network_address::interface const* const other_self = other.self.get();
if (self_ == other_self) return true;
if (!self_ || !other_self) return false;
if (typeid(*self_) != typeid(*other_self)) return false;
return self_->is_same_host(*other_self);
}
bool create_network_address(network_address &address, const std::string &string, uint16_t default_port)
{
uint32_t ip;
uint16_t port;
if (epee::string_tools::parse_peer_from_string(ip, port, string))
{
if (default_port && !port)
port = default_port;
address = ipv4_network_address{ip, port};
return true;
}
return false;
}
std::string print_connection_context(const connection_context_base& ctx)
{
std::stringstream ss;
ss << ctx.m_remote_address.str() << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}
std::string print_connection_context_short(const connection_context_base& ctx)
{
std::stringstream ss;
ss << ctx.m_remote_address.str() << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}
}}

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project)
/// @brief implementaion for throttling of connection (count and rate-limit speed etc)
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
@@ -51,10 +51,9 @@
#include "syncobj.h"
#include "../../contrib/epee/include/net/net_utils_base.h"
#include "../../contrib/epee/include/misc_log_ex.h"
#include "net/net_utils_base.h"
#include "misc_log_ex.h"
#include <boost/lambda/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/chrono.hpp>
@@ -72,14 +71,13 @@
#include <boost/asio/basic_socket.hpp>
#include <boost/asio/ip/unicast.hpp>
#include "../../contrib/epee/include/net/abstract_tcp_server2.h"
#include "net/abstract_tcp_server2.h"
// TODO:
#include "../../src/p2p/network_throttle-detail.hpp"
#include "net/network_throttle-detail.hpp"
#include "../../contrib/otshell_utils/utils.hpp"
#include "data_logger.hpp"
using namespace nOT::nUtils;
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.throttle"
// ################################################################################################
// ################################################################################################
@@ -89,8 +87,6 @@ using namespace nOT::nUtils;
// ################################################################################################
// ################################################################################################
using namespace nOT::nUtils;
namespace epee
{
namespace net_utils
@@ -163,18 +159,12 @@ void network_throttle::set_name(const std::string &name)
void network_throttle::set_target_speed( network_speed_kbps target )
{
m_target_speed = target * 1024;
_note_c("net/"+m_nameshort, "Setting LIMIT: " << target << " kbps");
set_real_target_speed(target);
}
void network_throttle::set_real_target_speed( network_speed_kbps real_target )
{
m_real_target_speed = real_target * 1024;
MINFO("Setting LIMIT: " << target << " kbps");
}
network_speed_kbps network_throttle::get_target_speed()
{
return m_real_target_speed / 1024;
return m_target_speed / 1024;
}
void network_throttle::tick()
@@ -220,7 +210,7 @@ void network_throttle::_handle_trafic_exact(size_t packet_size, size_t orginal_s
std::ostringstream oss; oss << "["; for (auto sample: m_history) oss << sample.m_size << " "; oss << "]" << std::ends;
std::string history_str = oss.str();
_dbg2_c( "net/" + m_nameshort , "Throttle " << m_name << ": packet of ~"<<packet_size<<"b " << " (from "<<orginal_size<<" b)"
MTRACE("Throttle " << m_name << ": packet of ~"<<packet_size<<"b " << " (from "<<orginal_size<<" b)"
<< " Speed AVG=" << std::setw(4) << ((long int)(cts .average/1024)) <<"[w="<<cts .window<<"]"
<< " " << std::setw(4) << ((long int)(cts2.average/1024)) <<"[w="<<cts2.window<<"]"
<<" / " << " Limit="<< ((long int)(m_target_speed/1024)) <<" KiB/sec "
@@ -241,10 +231,10 @@ network_time_seconds network_throttle::get_sleep_time_after_tick(size_t packet_s
}
void network_throttle::logger_handle_net(const std::string &filename, double time, size_t size) {
if (! epee::net_utils::data_logger::m_save_graph)
return;
boost::mutex mutex;
mutex.lock(); {
static boost::mutex mutex;
boost::lock_guard<boost::mutex> lock(mutex);
{
std::fstream file;
file.open(filename.c_str(), std::ios::app | std::ios::out );
file.precision(6);
@@ -252,7 +242,7 @@ void network_throttle::logger_handle_net(const std::string &filename, double tim
_warn("Can't open file " << filename);
file << static_cast<int>(time) << " " << static_cast<double>(size/1024) << "\n";
file.close();
} mutex.unlock();
}
}
// fine tune this to decide about sending speed:
@@ -312,8 +302,7 @@ void network_throttle::calculate_times(size_t packet_size, calculate_times_struc
if (dbg) {
std::ostringstream oss; oss << "["; for (auto sample: m_history) oss << sample.m_size << " "; oss << "]" << std::ends;
std::string history_str = oss.str();
_dbg1_c( "net/"+m_nameshort+"_c" ,
(cts.delay > 0 ? "SLEEP" : "")
MTRACE((cts.delay > 0 ? "SLEEP" : "")
<< "dbg " << m_name << ": "
<< "speed is A=" << std::setw(8) <<cts.average<<" vs "
<< "Max=" << std::setw(8) <<M<<" "

View File

@@ -26,7 +26,7 @@ Throttling work by:
*/
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
@@ -54,7 +54,7 @@ Throttling work by:
// 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 "../../src/p2p/network_throttle-detail.hpp"
#include "net/network_throttle-detail.hpp"
namespace epee
{
@@ -71,34 +71,25 @@ boost::mutex network_throttle_manager::m_lock_get_global_throttle_in;
boost::mutex network_throttle_manager::m_lock_get_global_throttle_inreq;
boost::mutex network_throttle_manager::m_lock_get_global_throttle_out;
int network_throttle_manager::xxx;
// ================================================================================================
// methods:
i_network_throttle & network_throttle_manager::get_global_throttle_in() {
boost::call_once(m_once_get_global_throttle_in, [] { m_obj_get_global_throttle_in.reset(new network_throttle("in/all","<<< global-IN",10)); } );
return * m_obj_get_global_throttle_in;
static network_throttle obj_get_global_throttle_in("in/all","<<< global-IN",10);
return obj_get_global_throttle_in;
}
boost::once_flag network_throttle_manager::m_once_get_global_throttle_in;
std::unique_ptr<i_network_throttle> network_throttle_manager::m_obj_get_global_throttle_in;
i_network_throttle & network_throttle_manager::get_global_throttle_inreq() {
boost::call_once(m_once_get_global_throttle_inreq, [] { m_obj_get_global_throttle_inreq.reset(new network_throttle("inreq/all", "<== global-IN-REQ",10)); } );
return * m_obj_get_global_throttle_inreq;
static network_throttle obj_get_global_throttle_inreq("inreq/all", "<== global-IN-REQ",10);
return obj_get_global_throttle_inreq;
}
boost::once_flag network_throttle_manager::m_once_get_global_throttle_inreq;
std::unique_ptr<i_network_throttle> network_throttle_manager::m_obj_get_global_throttle_inreq;
i_network_throttle & network_throttle_manager::get_global_throttle_out() {
boost::call_once(m_once_get_global_throttle_out, [] { m_obj_get_global_throttle_out.reset(new network_throttle("out/all", ">>> global-OUT",10)); } );
return * m_obj_get_global_throttle_out;
static network_throttle obj_get_global_throttle_out("out/all", ">>> global-OUT",10);
return obj_get_global_throttle_out;
}
boost::once_flag network_throttle_manager::m_once_get_global_throttle_out;
std::unique_ptr<i_network_throttle> network_throttle_manager::m_obj_get_global_throttle_out;

View File

@@ -0,0 +1,223 @@
#include "readline_buffer.h"
#include <readline/readline.h>
#include <readline/history.h>
#include <unistd.h>
#include <iostream>
#include <boost/thread.hpp>
#include <boost/algorithm/string.hpp>
static void install_line_handler();
static void remove_line_handler();
static boost::mutex sync_mutex;
static rdln::linestatus line_stat;
static char *the_line;
namespace
{
rdln::readline_buffer* current = NULL;
}
rdln::suspend_readline::suspend_readline()
: m_buffer(NULL), m_restart(false)
{
m_buffer = current;
if(!m_buffer)
return;
m_restart = m_buffer->is_running();
if(m_restart)
m_buffer->stop();
}
rdln::suspend_readline::~suspend_readline()
{
if(!m_buffer)
return;
if(m_restart)
m_buffer->start();
}
std::vector<std::string>& rdln::readline_buffer::completion_commands()
{
static std::vector<std::string> commands = {"exit"};
return commands;
}
rdln::readline_buffer::readline_buffer()
: std::stringbuf(), m_cout_buf(NULL)
{
current = this;
}
void rdln::readline_buffer::start()
{
if(m_cout_buf != NULL)
return;
m_cout_buf = std::cout.rdbuf();
std::cout.rdbuf(this);
install_line_handler();
}
void rdln::readline_buffer::stop()
{
if(m_cout_buf == NULL)
return;
std::cout.rdbuf(m_cout_buf);
m_cout_buf = NULL;
remove_line_handler();
}
rdln::linestatus rdln::readline_buffer::get_line(std::string& line) const
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
line_stat = rdln::partial;
rl_callback_read_char();
if (line_stat == rdln::full)
{
line = the_line;
free(the_line);
the_line = NULL;
}
return line_stat;
}
void rdln::readline_buffer::set_prompt(const std::string& prompt)
{
if(m_cout_buf == NULL)
return;
boost::lock_guard<boost::mutex> lock(sync_mutex);
rl_set_prompt(prompt.c_str());
rl_redisplay();
}
void rdln::readline_buffer::add_completion(const std::string& command)
{
if(std::find(completion_commands().begin(), completion_commands().end(), command) != completion_commands().end())
return;
completion_commands().push_back(command);
}
const std::vector<std::string>& rdln::readline_buffer::get_completions()
{
return completion_commands();
}
int rdln::readline_buffer::sync()
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
#if RL_READLINE_VERSION < 0x0700
char lbuf[2] = {0,0};
char *line = NULL;
int end = 0, point = 0;
#endif
if (rl_end || *rl_prompt)
{
#if RL_READLINE_VERSION >= 0x0700
rl_clear_visible_line();
#else
line = rl_line_buffer;
end = rl_end;
point = rl_point;
rl_line_buffer = lbuf;
rl_end = 0;
rl_point = 0;
rl_save_prompt();
rl_redisplay();
#endif
}
do
{
m_cout_buf->sputc( this->sgetc() );
}
while ( this->snextc() != EOF );
#if RL_READLINE_VERSION < 0x0700
if (end || *rl_prompt)
{
rl_restore_prompt();
rl_line_buffer = line;
rl_end = end;
rl_point = point;
}
#endif
rl_on_new_line();
rl_redisplay();
return 0;
}
static void handle_line(char* line)
{
bool exit = false;
if (line)
{
line_stat = rdln::full;
the_line = line;
std::string test_line = line;
boost::trim_right(test_line);
if(!test_line.empty())
{
add_history(test_line.c_str());
history_set_pos(history_length);
if (test_line == "exit" || test_line == "q")
exit = true;
}
} else
/* EOF */
{
line_stat = rdln::empty;
exit = true;
}
rl_done = 1;
if (exit)
rl_set_prompt("");
return;
}
static char* completion_matches(const char* text, int state)
{
static size_t list_index;
static size_t len;
if(state == 0)
{
list_index = 0;
len = strlen(text);
}
const std::vector<std::string>& completions = rdln::readline_buffer::get_completions();
for(; list_index<completions.size(); )
{
const std::string& cmd = completions[list_index++];
if(cmd.compare(0, len, text) == 0)
{
return strdup(cmd.c_str());
}
}
return NULL;
}
static char** attempted_completion(const char* text, int start, int end)
{
rl_attempted_completion_over = 1;
return rl_completion_matches(text, completion_matches);
}
static void install_line_handler()
{
rl_attempted_completion_function = attempted_completion;
rl_callback_handler_install("", handle_line);
stifle_history(500);
}
static void remove_line_handler()
{
rl_replace_line("", 0);
rl_set_prompt("");
rl_redisplay();
rl_callback_handler_remove();
}

View File

@@ -0,0 +1,73 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * 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.
// * Neither the name of the Andrey N. Sabelnikov 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 OWNER 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.
//
#include "string_tools.h"
#include <ctype.h>
#ifdef _WIN32
# include <winsock2.h>
#else
# include <arpa/inet.h>
# include <netinet/in.h>
#endif
namespace epee
{
namespace string_tools
{
std::string get_ip_string_from_int32(uint32_t ip)
{
in_addr adr;
adr.s_addr = ip;
const char* pbuf = inet_ntoa(adr);
if(pbuf)
return pbuf;
else
return "[failed]";
}
//----------------------------------------------------------------------------
bool get_ip_int32_from_string(uint32_t& ip, const std::string& ip_str)
{
ip = inet_addr(ip_str.c_str());
if(INADDR_NONE == ip)
return false;
return true;
}
//----------------------------------------------------------------------------
bool validate_hex(uint64_t length, const std::string& str)
{
if (str.size() != length)
return false;
for (char c: str)
if (!isxdigit(c))
return false;
return true;
}
}
}

View File

@@ -0,0 +1,146 @@
// Copyright (c) 2017-2018, 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.
#include <string.h>
#include "memwipe.h"
#include "misc_log_ex.h"
#include "wipeable_string.h"
namespace epee
{
wipeable_string::wipeable_string(const wipeable_string &other):
buffer(other.buffer)
{
}
wipeable_string::wipeable_string(wipeable_string &&other)
{
if (&other == this)
return;
buffer = std::move(other.buffer);
}
wipeable_string::wipeable_string(const std::string &other)
{
grow(other.size());
memcpy(buffer.data(), other.c_str(), size());
}
wipeable_string::wipeable_string(std::string &&other)
{
grow(other.size());
memcpy(buffer.data(), other.c_str(), size());
if (!other.empty())
{
memwipe(&other[0], other.size()); // we're kinda left with this again aren't we
other = std::string();
}
}
wipeable_string::wipeable_string(const char *s)
{
grow(strlen(s));
memcpy(buffer.data(), s, size());
}
wipeable_string::~wipeable_string()
{
wipe();
}
void wipeable_string::wipe()
{
if (!buffer.empty())
memwipe(buffer.data(), buffer.size() * sizeof(char));
}
void wipeable_string::grow(size_t sz, size_t reserved)
{
if (reserved < sz)
reserved = sz;
if (reserved <= buffer.capacity())
{
if (sz < buffer.size())
memwipe(buffer.data() + sz, buffer.size() - sz);
buffer.resize(sz);
return;
}
size_t old_sz = buffer.size();
std::unique_ptr<char[]> tmp{new char[old_sz]};
memcpy(tmp.get(), buffer.data(), old_sz * sizeof(char));
if (old_sz > 0)
memwipe(buffer.data(), old_sz * sizeof(char));
buffer.reserve(reserved);
buffer.resize(sz);
memcpy(buffer.data(), tmp.get(), old_sz * sizeof(char));
if (old_sz > 0)
memwipe(tmp.get(), old_sz * sizeof(char));
}
void wipeable_string::push_back(char c)
{
grow(size() + 1);
buffer.back() = c;
}
void wipeable_string::pop_back()
{
resize(size() - 1);
}
void wipeable_string::resize(size_t sz)
{
grow(sz);
}
void wipeable_string::reserve(size_t sz)
{
grow(size(), sz);
}
void wipeable_string::clear()
{
resize(0);
}
wipeable_string &wipeable_string::operator=(wipeable_string &&other)
{
if (&other != this)
buffer = std::move(other.buffer);
return *this;
}
wipeable_string &wipeable_string::operator=(const wipeable_string &other)
{
if (&other != this)
buffer = other.buffer;
return *this;
}
}

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