Compare commits

...

362 Commits

Author SHA1 Message Date
luigi1111
ab18fea350 Merge pull request #8096
7430b9e Fix Android OpenSSL build (Howard Chu)
2021-11-30 17:07:33 -05:00
luigi1111
36e94231e8 Merge pull request #8094
6b881af cmake: set 3.5 as minimum version (selsta)
2021-11-30 17:07:05 -05:00
Howard Chu
7430b9e7dc Fix Android OpenSSL build
depends didn't have target-specific overrides for _build_env
so ANDROID_NDK_HOME wasn't being set at build time.
This fix supersedes the manual edit of Configuration/15-android.conf.
Resolves #8095
2021-11-30 04:16:19 +00:00
selsta
6b881af1ac cmake: set 3.5 as minimum version 2021-11-29 15:08:48 +01:00
luigi1111
0ea5cc9bd2 Merge pull request #7977
fc4e574 Add simple script for running gitian-build (Howard Chu)
2021-11-29 00:52:50 -06:00
luigi1111
6a3902b9a5 Merge pull request #8085
39bb22a blocks: update checkpoints.dat (selsta)
2021-11-26 23:06:34 -06:00
luigi1111
dfb818a01b Merge pull request #8084
a4954a9 rpc: fix DoS vector in get_output_distribution (moneromooo-monero)
2021-11-26 23:05:52 -06:00
luigi1111
a96fd84502 Merge pull request #8075
6f80a46 Add python method (Howard Chu)
c09054b Add calcpow RPC (Howard Chu)
2021-11-26 23:04:57 -06:00
luigi1111
bf54ddd048 Merge pull request #8072
7a21487 Update RandomX (Jethro Grassie)
2021-11-26 23:03:50 -06:00
luigi1111
0de147644a Merge pull request #8056
9d6ba37 hidapi: bump hidapi to 0.11.0 (selsta)
2021-11-26 22:59:55 -06:00
selsta
39bb22a114 blocks: update checkpoints.dat 2021-11-26 18:58:17 +01:00
Howard Chu
6f80a46afa Add python method 2021-11-21 01:25:42 +00:00
Howard Chu
c09054bbf9 Add calcpow RPC
Calculate PoW hash for a block candidate
2021-11-20 18:51:45 +00:00
Jethro Grassie
7a2148744c Update RandomX 2021-11-20 00:08:36 -05:00
luigi1111
72e778a04c Merge pull request #8049
782e8a3 Update RandomX to v1.1.10 (tevador)
2021-11-09 22:55:54 -06:00
luigi1111
331c3e4ba3 Merge pull request #8039
c942c2c device: fix ledger error strings, add human friendly messages (selsta)
99b97dc device: Ledger - update status codes (xiphon)
2021-11-09 22:54:50 -06:00
luigi1111
369853979a Merge pull request #8037
df79eb1 depends: openssl 1.1.1k -> 1.1.1l (selsta)
2021-11-09 22:53:18 -06:00
luigi1111
c803f6727a Merge pull request #8032
c9f73f1 slow_hash: don't blow out Mac stack on ARM64 (Howard Chu)
2021-11-09 22:51:03 -06:00
luigi1111
85653bcd83 Merge pull request #8023
3cb7fda build: prepare v0.17.3.0 (selsta)
2021-11-09 22:49:19 -06:00
luigi1111
e4376eed9e Merge pull request #7997
29c03e2 wallet_api: enable set_strict_default_file_permissions (tobtoht)
1c26d34 epee: add missing header (selsta)
1d451a6 depends: update zeromq package to 4.3.4 (selsta)
5180610 cmake: use CMAKE_CURRENT_LIST_DIR for git version (selsta)
5aae00a epee: avoid ADL selecting C++14 std::quoted (selsta)
cf31136 cmake: set cpp14 standard (selsta)
945665f fix median overflow bug (koe)
908ecb3 LMDB: fix deadlock in resized detection (Howard Chu)
a492c4e blockchain: fix pedantic assert (selsta)
1e663e8 Increase timeout for the mining test 4 times (to 240s) (mj-xmr)
4760f8b Wallet2: Update 'approximate_testnet_rolled_back_blocks' (rbrunner7)
76b6120 cmake: set required C/C++ standard to 11 (selsta)
3067987 Fix parallel make of OpenSSL (Howard Chu)
1219c74 add singapore.node.xmr.pm to seed nodes (lza_menace)
689dd52 net_node: add seed node (selsta)
95936a3 depends: update unwind, fix build with ubuntu 21.04 (selsta)
e2c802f Only INFO log for short seed words with ALLOW_SHORT_WORDS active (rbrunner7)
14df8ad epee: don't log raw packet data (moneromooo-monero)
5fa7208 Mac: Enable on ARM, by not enforcing x86_64 (mj-xmr)
fe6ab93 daemon: allow proxy configuration (anon)
52dcc03 bootstrap_daemon: proxy configuration support (xiphon)
a6df656 wallet2: chunk get_outs.bin calls to avoid sanity limits (moneromooo-monero)
2021-11-09 22:47:33 -06:00
selsta
9d6ba37ad4 hidapi: bump hidapi to 0.11.0 2021-11-10 03:16:39 +01:00
tevador
782e8a3c08 Update RandomX to v1.1.10 2021-11-08 21:33:11 +01:00
selsta
c942c2c97b device: fix ledger error strings, add human friendly messages 2021-11-03 00:14:10 +01:00
xiphon
99b97dc389 device: Ledger - update status codes 2021-11-03 00:05:03 +01:00
selsta
df79eb15e2 depends: openssl 1.1.1k -> 1.1.1l 2021-11-02 19:08:18 +01:00
luigi1111
97b7a41bfa Merge pull request #8030
89a0b31 crypto: fix typo in ifdef (selsta)
2021-11-01 12:32:49 -05:00
luigi1111
f68e72b2a2 Merge pull request #8014
103c973 wallet2: fix key encryption when changing ask-password from 0/1 to 2 (moneromooo-monero)
2021-11-01 12:26:41 -05:00
Howard Chu
c9f73f1c7a slow_hash: don't blow out Mac stack on ARM64 2021-10-30 22:28:32 +01:00
selsta
3cb7fda428 build: prepare v0.17.3.0 2021-10-29 22:26:59 +02:00
selsta
89a0b31380 crypto: fix typo in ifdef 2021-10-29 17:58:53 +02:00
luigi1111
fce167d7cc Merge pull request #8022
6c084e1 protocol: fix spurious rejection of downloaded blocks (moneromooo-monero)
2021-10-25 19:03:13 -05:00
luigi1111
b2185fe512 Merge pull request #8007
8bc414b Add README to release archives (Howard Chu)
840cd25 README v12 fork occurred on 2019-11-30 as expected (Howard Chu)
2021-10-25 19:01:24 -05:00
luigi1111
2ac8f5b58e Merge pull request #7996
423b655 socks: ignore any exceptions in shutdown/close (selsta)
2021-10-25 18:58:20 -05:00
moneromooo-monero
a4954a9eeb rpc: fix DoS vector in get_output_distribution
This will prevent people spending old pre-rct outputs using a
stranger's node, which may be a good thing
2021-10-24 17:17:05 +00:00
moneromooo-monero
6c084e1fa3 protocol: fix spurious rejection of downloaded blocks
when kicking a peer for inactivity, clear the set of requested blocks,
or next time we requests blocks from it, we'll probably reject the
incoming blocks due to missing the previous requested blocks
2021-10-23 11:51:30 +00:00
selsta
423b6553a1 socks: ignore any exceptions in shutdown/close 2021-10-22 22:01:01 +02:00
tobtoht
29c03e2d90 wallet_api: enable set_strict_default_file_permissions 2021-10-22 05:51:57 +02:00
selsta
1c26d34a2a epee: add missing header 2021-10-22 04:51:49 +02:00
selsta
1d451a6855 depends: update zeromq package to 4.3.4 2021-10-21 20:02:53 +02:00
selsta
5180610c4b cmake: use CMAKE_CURRENT_LIST_DIR for git version 2021-10-21 20:02:30 +02:00
selsta
5aae00ac79 epee: avoid ADL selecting C++14 std::quoted 2021-10-20 19:35:17 +02:00
moneromooo-monero
103c9733b3 wallet2: fix key encryption when changing ask-password from 0/1 to 2
we reuse the wallet_keys_unlocker object, which does the right thing
in conjunction with other users of decrypt/encrypt (ie, refresh).
2021-10-19 22:00:18 +00:00
selsta
cf31136617 cmake: set cpp14 standard
It's 2021, we can easily switch to C++14 without any troubles.
2021-10-18 07:33:17 +02:00
luigi1111
61e16307cd Merge pull request #8005
3a3fbc3 ARMv8: detect AES support dynamically (Howard Chu)
2021-10-17 23:41:08 -05:00
luigi1111
7ab32cf13a Merge pull request #7993
c599b56 Decrease the 'recent spend window' in gamma re-select to 15 blocks (j-berman)
2021-10-17 23:37:39 -05:00
luigi1111
0ad56647d3 Merge pull request #7870
56589dd UB: virtual methods in destructor at Trezor (mj-xmr)
2021-10-17 23:28:38 -05:00
luigi1111
1aad001d96 Merge pull request #7868
36527c0 UB: virtual method in destructor of WalletImpl v0.17 (mj-xmr)
2021-10-17 23:27:23 -05:00
luigi1111
33fe0e8003 Merge pull request #7861
cf65e5b LMDB: protection against UB, by not calling virtual methods from destructor - v0.17 (mj-xmr)
2021-10-17 23:26:12 -05:00
luigi1111
b8ed1cbbc9 Merge pull request #7798
3d9f348 Fix precision of average_output_time (j-berman)
2021-10-17 23:21:58 -05:00
Howard Chu
8bc414bb55 Add README to release archives
Also add ANONYMITY_NETWORKS.md
2021-10-14 15:40:29 +01:00
Howard Chu
840cd25d27 README v12 fork occurred on 2019-11-30 as expected
Not just an estimated date.
Also fix whitespace alignment.
Note for future: always use backslash-asterisk if adding this
notation, otherwise it screws up rendering on some MD formatters
2021-10-14 15:38:41 +01:00
koe
945665ff70 fix median overflow bug 2021-10-14 02:43:57 +02:00
Howard Chu
908ecb3cee LMDB: fix deadlock in resized detection 2021-10-14 02:42:47 +02:00
selsta
a492c4e3ab blockchain: fix pedantic assert 2021-10-14 02:42:02 +02:00
Howard Chu
3a3fbc3347 ARMv8: detect AES support dynamically 2021-10-11 19:51:11 +01:00
luigi1111
88b80583b8 Merge pull request #7978
4d224de Quicker resource cleanup on p2p socks timeout (Lee *!* Clagett)
2021-10-11 13:03:40 -05:00
luigi1111
532d382d56 Merge pull request #7976
f508612 gitian: cleanup more unused packages (Howard Chu)
b8685bc gitian: omit ccache from gitian builds (Howard Chu)
2021-10-11 13:01:28 -05:00
luigi1111
e6f07c0379 Merge pull request #7959
209c031 rpc: Fix get_transactions failing when not found (Nathan Dorfman)
2021-10-11 12:58:42 -05:00
luigi1111
6f2ebee8ff Merge pull request #7873
d4c7549 node_server: fix race condition (anon)
2909bd1 node_server: add race condition demo (anon)
2021-10-11 12:55:31 -05:00
mj-xmr
1e663e8488 Increase timeout for the mining test 4 times (to 240s) 2021-10-10 12:34:07 +02:00
rbrunner7
4760f8b49b Wallet2: Update 'approximate_testnet_rolled_back_blocks' 2021-10-07 04:54:03 +02:00
luigi1111
123c46d331 Merge pull request #7985
2481333 workflows: add missing dependency, fix mac build (selsta)
2021-10-05 21:45:19 -05:00
selsta
76b61204d1 cmake: set required C/C++ standard to 11
Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
2021-10-06 01:58:51 +02:00
Howard Chu
306798746e Fix parallel make of OpenSSL 2021-10-06 01:58:51 +02:00
lza_menace
1219c74e80 add singapore.node.xmr.pm to seed nodes 2021-10-06 01:58:51 +02:00
selsta
689dd52a9d net_node: add seed node 2021-10-06 01:58:51 +02:00
selsta
95936a3fc3 depends: update unwind, fix build with ubuntu 21.04 2021-10-06 01:58:51 +02:00
rbrunner7
e2c802f6b2 Only INFO log for short seed words with ALLOW_SHORT_WORDS active 2021-10-06 01:58:50 +02:00
moneromooo-monero
14df8ad7a6 epee: don't log raw packet data 2021-10-06 01:58:50 +02:00
mj-xmr
5fa7208ef0 Mac: Enable on ARM, by not enforcing x86_64 2021-10-06 01:58:50 +02:00
anon
fe6ab93fb0 daemon: allow proxy configuration
Co-authored-by: selsta <selsta@sent.at>
Co-authored-by: tobtoht <thotbot@protonmail.com>
2021-10-06 01:58:50 +02:00
xiphon
52dcc03068 bootstrap_daemon: proxy configuration support 2021-10-06 01:58:46 +02:00
moneromooo-monero
a6df656b4e wallet2: chunk get_outs.bin calls to avoid sanity limits 2021-10-06 01:56:27 +02:00
j-berman
c599b56f2c Decrease the "recent spend window" in gamma re-select to 15 blocks
- combined with patching integer truncation (#7798), this gets the algorithm marginally closer to mirroring empirically observed output ages
- 50 was originally chosen assuming integer truncation would remain in the client for that client release version. But patching integer truncation causes the client to select more outputs in the 10-100 block range, and therefore the benefit of choosing a larger recent spend window of 50 has less merit
- 15 seems well-suited to cover the somewhat sizable observable gap in the early window of blocks
2021-10-04 20:12:23 -07:00
selsta
24813330ec workflows: add missing dependency, fix mac build 2021-09-30 22:11:48 +02:00
Howard Chu
fc4e5741ae Add simple script for running gitian-build
This shell script creates a docker image for running the gitian-build.py
script, to avoid version incompatibilities. The builds may be signed
automatically after manually reviewing the build hashes.

Only docker.io and apt-cacher-ng are required to be installed on the
host. The MacOSX SDK should also be present in this directory if Mac
builds are desired. A container named "gitrun" is used to launch
the builds, and all output will reside in this container as well.
2021-09-27 18:03:03 +01:00
Howard Chu
f5086126ca gitian: cleanup more unused packages
These appear to be leftovers inherited from Bitcoin's builder
2021-09-27 17:59:59 +01:00
Howard Chu
b8685bcf24 gitian: omit ccache from gitian builds
It's just wasted overhead since the build VMs are always deleted
and recreated fresh for each run.
2021-09-27 17:59:46 +01:00
Lee *!* Clagett
4d224de6e5 Quicker resource cleanup on p2p socks timeout 2021-09-27 13:47:51 +00:00
luigi1111
2243318000 Merge pull request #7964
d51e3f2 RPC and ZeroMQ APIs to support p2pool (SChernykh)
2021-09-23 22:24:48 -05:00
luigi1111
240cd780fe Merge pull request #7961
24f3e4c simplewallet: don't truncate integ. address in export_transfers (selsta)
2021-09-23 22:23:58 -05:00
luigi1111
0e6b12de78 Merge pull request #7952
8a7f692 support cors wildcard (woodser)
2021-09-23 22:23:17 -05:00
luigi1111
728409ec6d Merge pull request #7929
f4a745d easylogging++: fix missing logs (moneromooo-monero)
2021-09-23 22:18:38 -05:00
moneromooo-monero
f4a745d3b1 easylogging++: fix missing logs 2021-09-23 20:29:50 +00:00
SChernykh
d51e3f21f7 RPC and ZeroMQ APIs to support p2pool
Adds the following:

- "get_miner_data" to RPC API
- "json-miner-data" to ZeroMQ subscriber contexts

Both provide the necessary data to create a custom block template. They are used by p2pool.

Data provided:

- major fork version
- current height
- previous block id
- RandomX seed hash
- network difficulty
- median block weight
- coins mined by the network so far
- mineable mempool transactions
2021-09-21 20:28:11 +02:00
Nathan Dorfman
209c031b93 rpc: Fix get_transactions failing when not found 2021-09-20 17:22:16 -06:00
anon
d4c754923e node_server: fix race condition 2021-09-20 20:58:24 +00:00
anon
2909bd199d node_server: add race condition demo 2021-09-20 20:58:23 +00:00
woodser
8a7f692aab support cors wildcard 2021-09-17 21:24:37 -04:00
j-berman
3d9f34875c Fix precision of average_output_time
The fix as suggested by <jberman> on IRC. Before the fix, it would truncate 1.9 to 1 skewing the output selection.
2021-09-12 10:04:25 +02:00
selsta
24f3e4c72e simplewallet: don't truncate integ. address in export_transfers 2021-09-10 12:27:41 -06:00
luigi1111
665bd8933a Merge pull request #7906
58892be miniupnp: set submodule to upstream, disable install (selsta)
2021-09-09 15:21:50 -04:00
mj-xmr
cf65e5b41b LMDB: protection against UB, by not calling virtual methods from destructor - v0.17 2021-09-09 08:18:21 +02:00
mj-xmr
56589ddab8 UB: virtual methods in destructor at Trezor 2021-09-08 16:19:26 +02:00
mj-xmr
36527c05bd UB: virtual method in destructor of WalletImpl v0.17 2021-09-08 15:33:07 +02:00
luigi1111
2222bea92f Merge pull request #7902
0ae1cd2 v0.17: Fix Boost-1.77: Add missing algorithm header to i18n.cpp (mj-xmr)
2021-08-29 12:30:57 -04:00
luigi1111
f12e75b5e4 Merge pull request #7888
3c15eb8 python-rpc: add missing python api for new freeze/thaw/frozen RPC (moneromooo-monero)
2021-08-29 12:29:57 -04:00
selsta
58892be4ad miniupnp: set submodule to upstream, disable install 2021-08-29 18:17:41 +02:00
mj-xmr
0ae1cd2413 v0.17: Fix Boost-1.77: Add missing algorithm header to i18n.cpp 2021-08-28 15:32:50 +02:00
luigi1111
317eceb725 Merge pull request #7894
c0ce4d5 Wallet2: fix optimize-coinbase for p2pool payouts (SChernykh)
2021-08-26 21:14:12 -04:00
luigi1111
d98787eb1b Merge pull request #7825
ccfed60 cmake: test is a reserved keyword (selsta)
f0fa959 cmake: fix ccache detection (anon)
8dbe2e5 Daemon: Update average block size table (rbrunner7)
94bad34 wallet2: Don't auto lock device on process parsed blocks (tobtoht)
3c23aca ledger: don't lock for software device (tobtoht)
49beb8d ledger: use software device if we have view key (tobtoht)
d188b5f wallet_api: getPassword (tobtoht)
a395f36 depends, docker: fix bintray links (selsta)
0fecd7e blocks: fix cmake syntax (selsta)
76824bf Stop adding more outputs than bulletproof allows (Alex Opie)
67ba733 unit_tests: fix wipeable_string parse_hexstr test with latest gtest (xiphon)
402ba04 cmake: use CMAKE_CURRENT_LIST_DIR in FindLibUSB (selsta)
1565bcb epee: include public openssl header in cmake (selsta)
2e9af2a cmake: treat warnings as error in compiler flag tests (selsta)
db564ef wallet_api: fix typo in exportKeyImages (selsta)
8507917 depends: add getmonero package mirror (selsta)
8716d2a cmake: fix non portable code (selsta)
2021-08-26 21:10:56 -04:00
luigi1111
ca1b1b7332 Merge pull request #7822
99bee1c Apply gamma distr from chain tip when selecting decoys (j-berman)
2021-08-26 21:08:56 -04:00
luigi1111
27c5013acd Merge pull request #7805
1e037d3 build: prepare v0.17.2.3 (selsta)
2021-08-26 21:08:04 -04:00
SChernykh
c0ce4d5089 Wallet2: fix optimize-coinbase for p2pool payouts
RefreshOptimizeCoinbase was an optimization to speed up scanning of coinbase transactions before RingCT (tx version 2) where they split miner reward into multiple denominations, all to the same wallet.

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

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

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

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

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

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

This decreases the expected stem length from 10 to 5. The embargo
timeout was therefore lowered to 39s; the fifth node in a stem is
expected to have a 90% chance of being the first to timeout, which is
the same probability we currently have with an expected stem length of
10 nodes.
2020-10-21 13:11:07 +00:00
Lee Clagett
e8468c5dcf Fix timeout checks for forwarded and Dandelion++ stem txes 2020-10-21 00:02:11 +00:00
Lee Clagett
37bb59485f Do not use peer_id tracking method over i2p/tor 2020-10-11 13:19:25 +00:00
202 changed files with 5755 additions and 1760 deletions

View File

@@ -10,7 +10,7 @@ jobs:
with:
submodules: recursive
- name: update brew and install dependencies
run: brew update && brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf
run: brew update && brew install boost hidapi openssl zmq libpgm miniupnpc ldns expat libunwind-headers protobuf
- name: build
run: make -j3
@@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: eine/setup-msys2@v1
- uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git

3
.gitmodules vendored
View File

@@ -4,8 +4,7 @@
branch = monero
[submodule "external/miniupnp"]
path = external/miniupnp
url = https://github.com/monero-project/miniupnp
branch = monero
url = https://github.com/miniupnp/miniupnp
[submodule "external/rapidjson"]
path = external/rapidjson
url = https://github.com/Tencent/rapidjson

View File

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

View File

@@ -43,7 +43,7 @@ if (IOS)
INCLUDE(CmakeLists_IOS.txt)
endif()
cmake_minimum_required(VERSION 2.8.7)
cmake_minimum_required(VERSION 3.5)
message(STATUS "CMake version ${CMAKE_VERSION}")
project(monero)
@@ -57,6 +57,14 @@ endif()
enable_language(C ASM)
# Require C11/C++11 and disable extensions for all targets
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
function (die msg)
if (NOT WIN32)
string(ASCII 27 Esc)
@@ -71,16 +79,18 @@ function (die msg)
endfunction ()
function (add_c_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_c)
check_c_compiler_flag(${flag} ${supported})
set(TMP "-Werror ${flag}")
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c)
check_c_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
endfunction()
function (add_cxx_flag_if_supported flag var)
string(REPLACE "-" "_" supported ${flag}_cxx)
check_cxx_compiler_flag(${flag} ${supported})
set(TMP "-Werror ${flag}")
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx)
check_cxx_compiler_flag(${TMP} ${supported})
if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif()
@@ -111,6 +121,66 @@ function (add_definition_if_library_exists library function header var)
endif()
endfunction()
# Function to forbid undefined symbols and also verify
# 1) Test project with all types of libraries and without undefined symbols can compile successfully
# 2) Test project with all types of libraries and undefined symbols can not compile successfully
function(forbid_undefined_symbols)
unset(TMP)
# https://www.unix.com/man-page/linux/1/ld, --no-undefined, Report unresolved symbol references from regular object files.
add_linker_flag_if_supported(-Wl,--no-undefined TMP)
# https://www.unix.com/man-page/osx/1/ld/, -undefined, Specifies how undefined symbols are to be treated.
add_linker_flag_if_supported(-Wl,-undefined,error TMP)
string(APPEND CMAKE_SHARED_LINKER_FLAGS ${TMP})
string(APPEND CMAKE_MODULE_LINKER_FLAGS ${TMP})
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} PARENT_SCOPE)
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_project")
foreach(EXPECT IN ITEMS TRUE FALSE)
file(REMOVE_RECURSE "${TEST_PROJECT}")
file(MAKE_DIRECTORY "${TEST_PROJECT}")
file(WRITE "${TEST_PROJECT}/CMakeLists.txt"
[=[
cmake_minimum_required(VERSION 3.1)
project(test)
option(EXPECT_SUCCESS "" ON)
file(WRITE "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" "void undefined_symbol(); void symbol() { undefined_symbol(); }")
if (EXPECT_SUCCESS)
file(APPEND "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" " void undefined_symbol() {}; ")
endif()
add_library(l0 SHARED incorrect_source.cpp)
add_library(l1 MODULE incorrect_source.cpp)
add_library(l2 STATIC incorrect_source.cpp)
add_library(l3 OBJECT incorrect_source.cpp)
]=]
)
try_compile(SUCCESS "${TEST_PROJECT}/build" "${TEST_PROJECT}" test
CMAKE_FLAGS
"-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}"
"-DCMAKE_MODULE_LINKER_FLAGS=${CMAKE_MODULE_LINKER_FLAGS}"
"-DEXPECT_SUCCESS=${EXPECT}"
)
if (NOT ${SUCCESS} STREQUAL ${EXPECT})
message(FATAL_ERROR "Undefined symbols test failure: expect(${EXPECT}), success(${SUCCESS})")
endif()
file(REMOVE_RECURSE "${TEST_PROJECT}")
endforeach()
endfunction()
if (NOT (CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*"))
forbid_undefined_symbols()
endif()
if (MINGW)
function(export_all_symbols)
unset(TMP)
add_linker_flag_if_supported(-Wl,--export-all-symbols TMP)
string(APPEND CMAKE_SHARED_LINKER_FLAGS ${TMP})
string(APPEND CMAKE_MODULE_LINKER_FLAGS ${TMP})
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} PARENT_SCOPE)
endfunction()
export_all_symbols()
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
@@ -431,7 +501,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
endif ()
if (APPLE AND NOT IOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default")
if (NOT OPENSSL_ROOT_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
@@ -449,6 +519,10 @@ if(STATIC AND NOT IOS)
endif()
endif()
if (WIN32)
list(APPEND OPENSSL_LIBRARIES ws2_32 crypt32)
endif()
find_package(HIDAPI)
add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S)
@@ -501,6 +575,17 @@ endif()
# Trezor support check
include(CheckTrezor)
# As of OpenBSD 6.8, -march=<anything> breaks the build
function(set_default_arch)
if (OPENBSD)
set(ARCH default)
else()
set(ARCH native)
endif()
set(ARCH ${ARCH} CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endfunction()
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -514,7 +599,7 @@ if(MSVC)
else()
include(TestCXXAcceptsFlag)
if (NOT ARCH)
set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
set_default_arch()
endif()
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default")
@@ -577,7 +662,7 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAG}")
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(ARM)
set(WARNINGS "${WARNINGS} -Wno-error=inline-asm")
endif()
@@ -598,14 +683,14 @@ else()
endif()
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.c" COMPILE_DEFINITIONS "-std=c11")
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.c" CMAKE_FLAGS -DCMAKE_C_STANDARD=11)
if(STATIC_ASSERT_RES)
set(STATIC_ASSERT_FLAG "")
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")
try_compile(STATIC_ASSERT_CPP_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.cpp" CMAKE_FLAGS -DCMAKE_CXX_STANDARD=11)
if(STATIC_ASSERT_CPP_RES)
set(STATIC_ASSERT_CPP_FLAG "")
else()
@@ -694,8 +779,8 @@ else()
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${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} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${LD_BACKCOMPAT_FLAGS}")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
@@ -813,7 +898,7 @@ else()
endif()
set(USE_LTO ${USE_LTO_DEFAULT} CACHE BOOL "Use Link-Time Optimization (Release mode only)")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable
set(USE_LTO false)
endif()
@@ -920,10 +1005,12 @@ list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
if (APPLE)
if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework AppKit -framework IOKit")
else()
find_library(COREFOUNDATION CoreFoundation)
find_library(APPKIT AppKit)
find_library(IOKIT IOKit)
list(APPEND EXTRA_LIBRARIES ${APPKIT})
list(APPEND EXTRA_LIBRARIES ${IOKIT})
list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION})
endif()
@@ -958,7 +1045,7 @@ if(ANDROID)
set(ATOMIC libatomic.a)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=user-defined-warnings")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD)
find_library(ATOMIC atomic)
if (ATOMIC_FOUND)
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
@@ -1043,8 +1130,6 @@ 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)
find_package(PythonInterp)
find_program(iwyu_tool_path NAMES iwyu_tool.py iwyu_tool)
if (iwyu_tool_path AND PYTHONINTERP_FOUND)

View File

@@ -46,7 +46,7 @@ ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
RUN set -ex \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \

View File

@@ -133,9 +133,9 @@ Dates are provided in the format YYYY-MM-DD.
| 1686275 | 2018-10-19 | v9 | v0.13.0.0 | v0.13.0.4 | bulletproofs required
| 1788000 | 2019-03-09 | v10 | v0.14.0.0 | v0.14.1.2 | New PoW based on Cryptonight-R, new block weight algorithm, slightly more efficient RingCT format
| 1788720 | 2019-03-10 | v11 | v0.14.0.0 | v0.14.1.2 | forbid old RingCT transaction format
| 1978433 | 2019-11-30* | v12 | v0.15.0.0 | v0.16.0.0 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs
| 2210000 | 2020-10-17 | v13 | v0.17.0.0 | v0.17.1.2 | New CLSAG transaction format
| 2210720 | 2020-10-18 | v14 | v0.17.1.1 | v0.17.1.2 | forbid old MLSAG transaction format
| 1978433 | 2019-11-30 | v12 | v0.15.0.0 | v0.16.0.0 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs
| 2210000 | 2020-10-17 | v13 | v0.17.0.0 | v0.17.3.0 | New CLSAG transaction format
| 2210720 | 2020-10-18 | v14 | v0.17.1.1 | v0.17.3.0 | forbid old MLSAG transaction format
| XXXXXXX | XXX-XX-XX | XXX | vX.XX.X.X | vX.XX.X.X | XXX |
X's indicate that these details have not been determined as of commit date.
@@ -161,7 +161,7 @@ library archives (`.a`).
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Void pkg | Fedora pkg | Optional | Purpose |
| ------------ | ------------- | -------- | -------------------- | ------------ | ------------------ | ------------------- | -------- | --------------- |
| GCC | 4.7.3 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
| GCC | 5 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
@@ -295,7 +295,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
```bash
git clone https://github.com/monero-project/monero.git
cd monero
git checkout tags/v0.17.1.2
git checkout tags/v0.17.3.0
```
* Build:
@@ -412,10 +412,10 @@ application.
cd monero
```
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.17.1.2'. If you don't care about the version and just want binaries from master, skip this step:
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.17.3.0'. If you don't care about the version and just want binaries from master, skip this step:
```bash
git checkout v0.17.1.2
git checkout v0.17.3.0
```
* If you are on a 64-bit system, run:

2
ZMQ.md
View File

@@ -25,6 +25,8 @@ allows for filtering on: (1) format, (2) context, and (3) event.
Includes previously unseen transactions in a block but _not_ the
`miner_tx`. Does not "re-publish" after a reorg. Includes `do_not_relay`
transactions.
* `miner_data` - provides the necessary data to create a custom block template
Available only in the `full` context.
The subscription topics are formatted as `format-context-event`, with prefix
matching supported by both Monero and ZMQ. The `format`, `context` and `event`

View File

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

View File

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

View File

@@ -32,7 +32,7 @@
function (get_version_tag_from_git GIT)
execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE RET
OUTPUT_VARIABLE COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -48,29 +48,21 @@ function (get_version_tag_from_git GIT)
message(STATUS "You are currently on commit ${COMMIT}")
# Get all the tags
execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
execute_process(COMMAND "${GIT}" tag -l --points-at HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE RET
OUTPUT_VARIABLE TAGGEDCOMMIT
OUTPUT_VARIABLE TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT TAGGEDCOMMIT)
message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
# Check if we're building that tagged commit or a different one
if(TAG)
message(STATUS "You are building a tagged release")
set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true")
else()
message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
else()
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
# Check if we're building that tagged commit or a different one
if(COMMIT STREQUAL TAGGEDCOMMIT)
message(STATUS "You are building a tagged release")
set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true")
else()
message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
endif()
endif()
endif()

View File

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

View File

@@ -32,7 +32,7 @@ endef
define fetch_file
( test -f $$($(1)_source_dir)/$(4) || \
( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(4),$(4),$(5))))
endef
define int_get_build_recipe_hash
@@ -133,6 +133,11 @@ $(1)_config_env+=$($(1)_config_env_$(host_arch)) $($(1)_config_env_$(host_arch)_
$(1)_config_env+=$($(1)_config_env_$(host_os)) $($(1)_config_env_$(host_os)_$(release_type))
$(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(host_arch)_$(host_os)_$(release_type))
$(1)_build_env+=$$($(1)_build_env_$(release_type))
$(1)_build_env+=$($(1)_build_env_$(host_arch)) $($(1)_build_env_$(host_arch)_$(release_type))
$(1)_build_env+=$($(1)_build_env_$(host_os)) $($(1)_build_env_$(host_os)_$(release_type))
$(1)_build_env+=$($(1)_build_env_$(host_arch)_$(host_os)) $($(1)_build_env_$(host_arch)_$(host_os)_$(release_type))
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
$(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)"

View File

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

View File

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

View File

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

View File

@@ -1,9 +1,10 @@
package=hidapi
$(package)_version=0.9.0
$(package)_version=0.11.0
$(package)_download_path=https://github.com/libusb/hidapi/archive
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=630ee1834bdd5c5761ab079fd04f463a89585df8fcae51a7bfe4229b1e02a652
$(package)_sha256_hash=391d8e52f2d6a5cf76e2b0c079cfefe25497ba1d4659131297081fc0cd744632
$(package)_linux_dependencies=libusb eudev
$(package)_patches=missing_win_include.patch
define $(package)_set_vars
$(package)_config_opts=--enable-static --disable-shared
@@ -16,6 +17,10 @@ $(package)_config_opts_linux+=libusb_CFLAGS=-I$(host_prefix)/include/libusb-1.0
$(package)_config_opts_linux+=--with-pic
endef
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/missing_win_include.patch
endef
define $(package)_config_cmds
./bootstrap &&\
$($(package)_autoconf) $($(package)_config_opts) AR_FLAGS=$($(package)_arflags)

View File

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

View File

@@ -1,36 +1,30 @@
package=openssl
$(package)_version=1.0.2r
$(package)_download_path=https://ftp.openssl.org/source/old/1.0.2
$(package)_version=1.1.1l
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=ae51d08bba8a83958e894946f15303ff894d75c2b8bbd44a852b64e3fe11d0d6
$(package)_patches=fix_arflags.patch
$(package)_sha256_hash=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
$(package)_patches=fix_darwin.patch
define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
$(package)_config_env_android=ANDROID_NDK_HOME="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib
$(package)_build_env_android=ANDROID_NDK_HOME="$(host_prefix)/native"
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl
$(package)_config_opts+=no-capieng
$(package)_config_opts+=no-dso
$(package)_config_opts+=no-dtls1
$(package)_config_opts+=no-ec_nistp_64_gcc_128
$(package)_config_opts+=no-gost
$(package)_config_opts+=no-gmp
$(package)_config_opts+=no-heartbeats
$(package)_config_opts+=no-jpake
$(package)_config_opts+=no-krb5
$(package)_config_opts+=no-libunbound
$(package)_config_opts+=no-md2
$(package)_config_opts+=no-rc5
$(package)_config_opts+=no-rdrand
$(package)_config_opts+=no-rfc3779
$(package)_config_opts+=no-rsax
$(package)_config_opts+=no-sctp
$(package)_config_opts+=no-sha0
$(package)_config_opts+=no-shared
$(package)_config_opts+=no-ssl-trace
$(package)_config_opts+=no-ssl2
$(package)_config_opts+=no-ssl3
$(package)_config_opts+=no-static_engine
$(package)_config_opts+=no-store
$(package)_config_opts+=no-unit-test
$(package)_config_opts+=no-weak-ssl-ciphers
$(package)_config_opts+=no-zlib
@@ -42,8 +36,8 @@ $(package)_config_opts_x86_64_linux=linux-x86_64
$(package)_config_opts_i686_linux=linux-generic32
$(package)_config_opts_arm_linux=linux-generic32
$(package)_config_opts_aarch64_linux=linux-generic64
$(package)_config_opts_arm_android=--static android-armv7 no-asm
$(package)_config_opts_aarch64_android=--static android no-asm
$(package)_config_opts_arm_android=--static android-arm
$(package)_config_opts_aarch64_android=--static android-arm64
$(package)_config_opts_riscv64_linux=linux-generic64
$(package)_config_opts_mipsel_linux=linux-generic32
$(package)_config_opts_mips_linux=linux-generic32
@@ -55,10 +49,8 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64
endef
define $(package)_preprocess_cmds
sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
sed -i.old "s|engines apps test|engines|" Makefile.org && \
sed -i -e "s/-mandroid //" Configure && \
patch < $($(package)_patch_dir)/fix_arflags.patch
sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure && \
patch -p1 < $($(package)_patch_dir)/fix_darwin.patch
endef
define $(package)_config_cmds
@@ -66,11 +58,11 @@ define $(package)_config_cmds
endef
define $(package)_build_cmds
$(MAKE) -j1 build_libs libcrypto.pc libssl.pc openssl.pc
$(MAKE) build_libs
endef
define $(package)_stage_cmds
$(MAKE) INSTALL_PREFIX=$($(package)_staging_dir) -j1 install_sw
$(MAKE) DESTDIR=$($(package)_staging_dir) install_sw
endef
define $(package)_postprocess_cmds

View File

@@ -1,6 +1,9 @@
packages:=boost openssl zeromq libiconv
# ccache is useless in gitian builds
ifneq ($(GITIAN),1)
native_packages := native_ccache
endif
hardware_packages := hidapi protobuf libusb
hardware_native_packages := native_protobuf
@@ -8,8 +11,8 @@ hardware_native_packages := native_protobuf
android_native_packages = android_ndk
android_packages = ncurses readline sodium
darwin_native_packages = native_biplist native_ds_store native_mac_alias $(hardware_native_packages)
darwin_packages = sodium ncurses readline $(hardware_packages)
darwin_native_packages = $(hardware_native_packages)
darwin_packages = ncurses readline sodium $(hardware_packages)
# not really native...
freebsd_native_packages = freebsd_base
@@ -31,6 +34,6 @@ mingw32_packages = icu4c sodium $(hardware_packages)
mingw32_native_packages = $(hardware_native_packages)
ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus
darwin_native_packages += native_cctools
endif

View File

@@ -1,18 +1,18 @@
PACKAGE=qt
$(package)_version=5.7.1
$(package)_download_path=http://linorg.usp.br/Qt/archive/qt/5.7/5.7.1/submodules
$(package)_suffix=opensource-src-$($(package)_version).tar.gz
$(package)_version=5.15.1
$(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules
$(package)_suffix=everywhere-src-$($(package)_version).tar.xz
$(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=95f83e532d23b3ddbde7973f380ecae1bac13230340557276f75f2e37984e410
$(package)_sha256_hash=33960404d579675b7210de103ed06a72613bfc4305443e278e2d32a3eb1f3d8c
$(package)_build_subdir=qtbase
$(package)_qt_libs=corelib
$(package)_patches=pidlist_absolute.patch fix_qt_pkgconfig.patch qfixed-coretext.patch
$(package)_patches=fix_qt_pkgconfig.patch fix_no_printer.patch fix_rcc_determinism.patch no-xlib.patch
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=3a15aebd523c6d89fb97b2d3df866c94149653a26d27a00aac9b6d3020bc5a1d
$(package)_qttranslations_sha256_hash=46e0c0e3a511fbcc803a4146204062e47f6ed43b34d98a3c27372a03b8746bd8
$(package)_qttools_file_name=qttools-$($(package)_suffix)
$(package)_qttools_sha256_hash=22d67de915cb8cd93e16fdd38fa006224ad9170bd217c2be1e53045a8dd02f0f
$(package)_qttools_sha256_hash=c98ee5f0f980bf68cbf0c94d62434816a92441733de50bd9adbe9b9055f03498
$(package)_extra_sources = $($(package)_qttranslations_file_name)
$(package)_extra_sources += $($(package)_qttools_file_name)
@@ -24,28 +24,26 @@ $(package)_config_opts += -bindir $(build_prefix)/bin
$(package)_config_opts += -c++std c++11
$(package)_config_opts += -confirm-license
$(package)_config_opts += -dbus-runtime
$(package)_config_opts += -no-alsa
$(package)_config_opts += -no-audio-backend
$(package)_config_opts += -hostprefix $(build_prefix)
$(package)_config_opts += -no-compile-examples
$(package)_config_opts += -no-cups
$(package)_config_opts += -no-egl
$(package)_config_opts += -no-eglfs
$(package)_config_opts += -no-feature-style-windowsmobile
$(package)_config_opts += -no-feature-style-windowsce
$(package)_config_opts += -no-evdev
$(package)_config_opts += -no-gui
$(package)_config_opts += -no-freetype
$(package)_config_opts += -no-gif
$(package)_config_opts += -no-glib
$(package)_config_opts += -no-gstreamer
$(package)_config_opts += -no-icu
$(package)_config_opts += -no-ico
$(package)_config_opts += -no-iconv
$(package)_config_opts += -no-kms
$(package)_config_opts += -no-linuxfb
$(package)_config_opts += -no-libjpeg
$(package)_config_opts += -no-libudev
$(package)_config_opts += -no-mitshm
$(package)_config_opts += -no-mtdev
$(package)_config_opts += -no-pulseaudio
$(package)_config_opts += -no-openvg
$(package)_config_opts += -no-reduce-relocations
$(package)_config_opts += -no-qml-debug
$(package)_config_opts += -no-sql-db2
$(package)_config_opts += -no-sql-ibase
$(package)_config_opts += -no-sql-oci
@@ -56,8 +54,6 @@ $(package)_config_opts += -no-sql-psql
$(package)_config_opts += -no-sql-sqlite
$(package)_config_opts += -no-sql-sqlite2
$(package)_config_opts += -no-use-gold-linker
$(package)_config_opts += -no-xinput2
$(package)_config_opts += -no-xrender
$(package)_config_opts += -nomake examples
$(package)_config_opts += -nomake tests
$(package)_config_opts += -opensource
@@ -65,25 +61,46 @@ $(package)_config_opts += -no-openssl
$(package)_config_opts += -optimized-qmake
$(package)_config_opts += -pch
$(package)_config_opts += -pkg-config
$(package)_config_opts += -prefix $(host_prefix)
$(package)_config_opts += -no-libpng
$(package)_config_opts += -no-libjpeg
$(package)_config_opts += -qt-pcre
$(package)_config_opts += -qt-harfbuzz
$(package)_config_opts += -no-zlib
$(package)_config_opts += -reduce-exports
$(package)_config_opts += -static
$(package)_config_opts += -silent
$(package)_config_opts += -v
$(package)_config_opts += -no-feature-printer
$(package)_config_opts += -no-feature-bearermanagement
$(package)_config_opts += -no-feature-colordialog
$(package)_config_opts += -no-feature-dial
$(package)_config_opts += -no-feature-filesystemwatcher
$(package)_config_opts += -no-feature-fontcombobox
$(package)_config_opts += -no-feature-ftp
$(package)_config_opts += -no-feature-image_heuristic_mask
$(package)_config_opts += -no-feature-keysequenceedit
$(package)_config_opts += -no-feature-lcdnumber
$(package)_config_opts += -no-feature-pdf
$(package)_config_opts += -no-feature-printdialog
$(package)_config_opts += -no-gui
$(package)_config_opts += -no-freetype
$(package)_config_opts += -no-sm
$(package)_config_opts += -no-fontconfig
$(package)_config_opts += -no-opengl
$(package)_config_opts += -no-xkb
$(package)_config_opts += -no-xcb
$(package)_config_opts += -no-xshape
$(package)_build_env = QT_RCC_TEST=1
$(package)_config_opts += -no-feature-printer
$(package)_config_opts += -no-feature-printpreviewdialog
$(package)_config_opts += -no-feature-printpreviewwidget
$(package)_config_opts += -no-feature-sessionmanager
$(package)_config_opts += -no-feature-sql
$(package)_config_opts += -no-feature-statemachine
$(package)_config_opts += -no-feature-syntaxhighlighter
$(package)_config_opts += -no-feature-textbrowser
$(package)_config_opts += -no-feature-textodfwriter
$(package)_config_opts += -no-feature-topleveldomain
$(package)_config_opts += -no-feature-udpsocket
$(package)_config_opts += -no-feature-undocommand
$(package)_config_opts += -no-feature-undogroup
$(package)_config_opts += -no-feature-undostack
$(package)_config_opts += -no-feature-undoview
$(package)_config_opts += -no-feature-vnc
$(package)_config_opts += -no-feature-wizard
$(package)_config_opts_linux = -no-fontconfig
$(package)_config_opts_linux += -no-opengl
$(package)_config_opts_linux += -no-xcb
$(package)_config_opts_linux += -no-feature-xlib
endef
define $(package)_fetch_cmds
@@ -108,14 +125,24 @@ endef
define $(package)_preprocess_cmds
sed -i.old "s|FT_Get_Font_Format|FT_Get_X11_Font_Format|" qtbase/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp && \
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \
patch -p1 < $($(package)_patch_dir)/pidlist_absolute.patch && \
patch -p1 < $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
patch -p1 < $($(package)_patch_dir)/qfixed-coretext.patch && \
sed -i.old "s/src_plugins.depends = src_sql src_network/src_plugins.depends = src_network/" qtbase/src/src.pro && \
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \
sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch && \
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \
echo "QMAKE_LINK_OBJECT_MAX = 10" >> qtbase/mkspecs/win32-g++/qmake.conf && \
echo "QMAKE_LINK_OBJECT_SCRIPT = object_script" >> qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "s|QMAKE_CFLAGS += |!host_build: QMAKE_CFLAGS = $($(package)_cflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "s|QMAKE_CXXFLAGS += |!host_build: QMAKE_CXXFLAGS = $($(package)_cxxflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "0,/^QMAKE_LFLAGS_/s|^QMAKE_LFLAGS_|!host_build: QMAKE_LFLAGS = $($(package)_ldflags)\n&|" qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "s/LIBRARY_PATH/(CROSS_)?\0/g" qtbase/mkspecs/features/toolchain.prf
endef
define $(package)_config_cmds

View File

@@ -1,8 +1,8 @@
package=unwind
$(package)_version=1.2
$(package)_version=1.5.0
$(package)_download_path=https://download.savannah.nongnu.org/releases/libunwind
$(package)_file_name=lib$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=1de38ffbdc88bd694d10081865871cd2bfbb02ad8ef9e1606aee18d65532b992
$(package)_sha256_hash=90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017
$(package)_patches=fix_obj_order.patch
define $(package)_preprocess_cmds
@@ -12,7 +12,7 @@ endef
define $(package)_config_cmds
cp -f $(BASEDIR)/config.guess config/config.guess &&\
cp -f $(BASEDIR)/config.sub config/config.sub &&\
$($(package)_autoconf) --disable-shared --enable-static AR_FLAGS=$($(package)_arflags)
$($(package)_autoconf) --disable-shared --enable-static --disable-tests --disable-documentation AR_FLAGS=$($(package)_arflags)
endef
define $(package)_build_cmds

View File

@@ -1,9 +1,9 @@
package=zeromq
$(package)_version=4.1.7
$(package)_download_path=https://github.com/zeromq/zeromq4-1/releases/download/v$($(package)_version)/
$(package)_version=4.3.4
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=31c383cfcd3be1dc8a66e448c403029e793687e70473b89c4cc0bd626e7da299
$(package)_patches=9114d3957725acd34aa8b8d011585812f3369411.patch 9e6745c12e0b100cd38acecc16ce7db02905e27c.patch ffe62d3398d5e0191f554f61049aa7ec9fc892ae.patch
$(package)_sha256_hash=c593001a89f5a85dd2ddf564805deb860e02471171b3f204944857336295c3e5
$(package)_patches=06aba27b04c5822cb88a69677382a0f053367143.patch
define $(package)_set_vars
$(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve
@@ -13,10 +13,7 @@ define $(package)_set_vars
endef
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/9114d3957725acd34aa8b8d011585812f3369411.patch && \
patch -p1 < $($(package)_patch_dir)/9e6745c12e0b100cd38acecc16ce7db02905e27c.patch && \
patch -p1 < $($(package)_patch_dir)/ffe62d3398d5e0191f554f61049aa7ec9fc892ae.patch && \
./autogen.sh
patch -p1 < $($(package)_patch_dir)/06aba27b04c5822cb88a69677382a0f053367143.patch
endef
define $(package)_config_cmds
@@ -24,7 +21,7 @@ define $(package)_config_cmds
endef
define $(package)_build_cmds
$(MAKE) libzmq.la
$(MAKE) src/libzmq.la
endef
define $(package)_stage_cmds

View File

@@ -0,0 +1,21 @@
From a77b066311da42ed7654e39c0356a3b951b2e296 Mon Sep 17 00:00:00 2001
From: selsta <selsta@sent.at>
Date: Wed, 10 Nov 2021 02:28:54 +0100
Subject: [PATCH] windows: add missing include for mingw32
---
windows/hid.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/windows/hid.c b/windows/hid.c
index 24756a4..6d8394c 100644
--- a/windows/hid.c
+++ b/windows/hid.c
@@ -33,6 +33,7 @@ typedef LONG NTSTATUS;
#endif
#ifdef __MINGW32__
+#include <devpropdef.h>
#include <ntdef.h>
#include <winbase.h>
#endif

View File

@@ -1,24 +0,0 @@
--- Makefile.org.O 2019-02-26 14:20:20.000000000 +0000
+++ Makefile.org 2019-11-15 13:05:54.370086856 +0000
@@ -63,8 +63,8 @@
PEX_LIBS=
EX_LIBS=
EXE_EXT=
-ARFLAGS=
-AR=ar $(ARFLAGS) r
+ARFLAGS= r
+AR=ar $(ARFLAGS)
RANLIB= ranlib
RC= windres
NM= nm
--- Configure.O 2019-02-26 14:20:20.000000000 +0000
+++ Configure 2019-11-16 07:43:14.933990774 +0000
@@ -1251,7 +1251,7 @@
my $shared_extension = $fields[$idx_shared_extension];
my $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
my $ar = $ENV{'AR'} || "ar";
-my $arflags = $fields[$idx_arflags];
+my $arflags = $ENV{'ARFLAGS'} || $fields[$idx_arflags];
my $windres = $ENV{'RC'} || $ENV{'WINDRES'} || "windres";
my $multilib = $fields[$idx_multilib];

View File

@@ -0,0 +1,60 @@
From 96ac8f13f4d0ee96baf5724d9f96c44c34b8606c Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Tue, 24 Aug 2021 22:40:14 +0100
Subject: [PATCH] Darwin platform allows to build on releases before
Yosemite/ios 8.
issue #16407 #16408
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16409)
---
crypto/rand/rand_unix.c | 5 +----
include/crypto/rand.h | 10 ++++++++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 43f1069d151d..0f4525106af7 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -34,9 +34,6 @@
#if defined(__OpenBSD__)
# include <sys/param.h>
#endif
-#if defined(__APPLE__)
-# include <CommonCrypto/CommonRandom.h>
-#endif
#if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__)
# include <sys/types.h>
@@ -381,7 +378,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
if (errno != ENOSYS)
return -1;
}
-# elif defined(__APPLE__)
+# elif defined(OPENSSL_APPLE_CRYPTO_RANDOM)
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
return (ssize_t)buflen;
diff --git a/include/crypto/rand.h b/include/crypto/rand.h
index 5350d3a93119..674f840fd13c 100644
--- a/include/crypto/rand.h
+++ b/include/crypto/rand.h
@@ -20,6 +20,16 @@
# include <openssl/rand.h>
+# if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM)
+# include <Availability.h>
+# if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || \
+ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000)
+# define OPENSSL_APPLE_CRYPTO_RANDOM 1
+# include <CommonCrypto/CommonCryptoError.h>
+# include <CommonCrypto/CommonRandom.h>
+# endif
+# endif
+
/* forward declaration */
typedef struct rand_pool_st RAND_POOL;

View File

@@ -0,0 +1,19 @@
--- x/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h
+++ y/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h
@@ -52,6 +52,7 @@
//
#include <QtCore/qglobal.h>
+#include <qpa/qplatformprintdevice.h>
#ifndef QT_NO_PRINTER
--- x/qtbase/src/plugins/plugins.pro
+++ y/qtbase/src/plugins/plugins.pro
@@ -9,6 +9,3 @@ qtHaveModule(gui) {
!android:qtConfig(library): SUBDIRS *= generic
}
qtHaveModule(widgets): SUBDIRS += styles
-
-!winrt:qtHaveModule(printsupport): \
- SUBDIRS += printsupport

View File

@@ -1,11 +1,11 @@
--- old/qtbase/mkspecs/features/qt_module.prf
+++ new/qtbase/mkspecs/features/qt_module.prf
@@ -245,7 +245,7 @@
@@ -269,7 +269,7 @@ load(qt_installs)
load(qt_targets)
# this builds on top of qt_common
-!internal_module:!lib_bundle:if(unix|mingw) {
+unix|mingw {
-!internal_module:if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) {
+if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) {
CONFIG += create_pc
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
host_build: \

View File

@@ -0,0 +1,15 @@
--- old/qtbase/src/tools/rcc/rcc.cpp
+++ new/qtbase/src/tools/rcc/rcc.cpp
@@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
if (lib.formatVersion() >= 2) {
// last modified time stamp
const QDateTime lastModified = m_fileInfo.lastModified();
- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
+ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0);
+ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong();
+ if (sourceDate != 0)
+ lastmod = sourceDate;
+ lib.writeNumber8(lastmod);
if (text || pass1)
lib.writeChar('\n');
}

View File

@@ -0,0 +1,69 @@
From 9563cef873ae82e06f60708d706d054717e801ce Mon Sep 17 00:00:00 2001
From: Carl Dong <contact@carldong.me>
Date: Thu, 18 Jul 2019 17:22:05 -0400
Subject: [PATCH] Wrap xlib related code blocks in #if's
They are not necessary to compile QT.
---
qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
index 7c62c2e2b3..c05c6c0a07 100644
--- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -49,7 +49,9 @@
#include <QtGui/QWindow>
#include <QtGui/QBitmap>
#include <QtGui/private/qguiapplication_p.h>
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
#include <X11/cursorfont.h>
+#endif
#include <xcb/xfixes.h>
#include <xcb/xcb_image.h>
@@ -391,6 +393,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window)
xcb_flush(xcb_connection());
}
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
static int cursorIdForShape(int cshape)
{
int cursorId = 0;
@@ -444,6 +447,7 @@ static int cursorIdForShape(int cshape)
}
return cursorId;
}
+#endif
xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
{
@@ -556,7 +560,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
{
xcb_connection_t *conn = xcb_connection();
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
int cursorId = cursorIdForShape(cshape);
+#endif
xcb_cursor_t cursor = XCB_NONE;
// Try Xcursor first
@@ -586,6 +592,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
// Non-standard X11 cursors are created from bitmaps
cursor = createNonStandardCursor(cshape);
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
// Create a glpyh cursor if everything else failed
if (!cursor && cursorId) {
cursor = xcb_generate_id(conn);
@@ -593,6 +600,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
cursorId, cursorId + 1,
0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0);
}
+#endif
if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) {
const char *name = cursorNames[cshape].front();
---
2.22.0

View File

@@ -1,37 +0,0 @@
diff -dur old/qtbase/src/plugins/platforms/windows/qwindowscontext.h new/qtbase/src/plugins/platforms/windows/qwindowscontext.h
--- old/qtbase/src/plugins/platforms/windows/qwindowscontext.h
+++ new/qtbase/src/plugins/platforms/windows/qwindowscontext.h
@@ -136,10 +136,18 @@
inline void init();
typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **);
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, ITEMIDLIST **);
+#else
typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *);
+#endif
typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *);
typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **);
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ typedef HRESULT (WINAPI *SHCreateItemFromIDList)(const ITEMIDLIST *, REFIID, void **);
+#else
typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **);
+#endif
SHCreateItemFromParsingName sHCreateItemFromParsingName;
SHGetKnownFolderIDList sHGetKnownFolderIDList;
diff -dur old/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp new/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
--- old/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ new/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -1016,7 +1016,11 @@
qWarning() << __FUNCTION__ << ": Invalid CLSID: " << url.path();
return Q_NULLPTR;
}
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ ITEMIDLIST *idList;
+#else
PIDLIST_ABSOLUTE idList;
+#endif
HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));

View File

@@ -1,34 +0,0 @@
From dbdd5f0ffbce52c8b789ed09f1aa3f1da6c02e23 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Date: Fri, 30 Mar 2018 11:58:16 -0700
Subject: [PATCH] QCoreTextFontEngine: Fix build with Xcode 9.3
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Error message:
.../qfontengine_coretext.mm:827:20: error: qualified reference to
'QFixed' is a constructor name rather than a type in this context
return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
Change-Id: Iebe26b3b087a16b10664208fc8851cbddb47f043
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
---
src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git old/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm new/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 25ff69d877d..98b753eff96 100644
--- old/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ new/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -824,7 +824,7 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl
QFixed QCoreTextFontEngine::emSquareSize() const
{
- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+ return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
}
QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
--
2.16.3

View File

@@ -1,9 +1,9 @@
--- config/ltmain.sh.O 2017-01-13 16:00:54.000000000 +0000
+++ config/ltmain.sh 2019-11-17 06:46:51.994402494 +0000
@@ -7957,6 +7957,8 @@
esac
done
--- config/ltmain.sh.0 2020-11-10 17:25:26.000000000 +0100
+++ config/ltmain.sh 2021-09-11 19:39:36.000000000 +0200
@@ -10768,6 +10768,8 @@
fi
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
+ oldobjs=`for obj in $oldobjs; do echo $obj; done | sort`
+ oldobjs=" `echo $oldobjs`"
eval cmds=\"$old_archive_cmds\"

View File

@@ -0,0 +1,22 @@
From 06aba27b04c5822cb88a69677382a0f053367143 Mon Sep 17 00:00:00 2001
From: sabotagebeats <27985126+sabotagebeats@users.noreply.github.com>
Date: Thu, 22 Jul 2021 21:53:19 -0700
Subject: [PATCH] fix: building libzmq fails with error src/clock.cpp:131:16:
error: unused variable 'nsecs_per_usec'
---
src/clock.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/clock.cpp b/src/clock.cpp
index 93da90a8e..63c0100a5 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -195,6 +195,7 @@ uint64_t zmq::clock_t::now_us ()
#else
+ LIBZMQ_UNUSED (nsecs_per_usec);
// Use POSIX gettimeofday function to get precise time.
struct timeval tv;
int rc = gettimeofday (&tv, NULL);

View File

@@ -1,22 +0,0 @@
From 9114d3957725acd34aa8b8d011585812f3369411 Mon Sep 17 00:00:00 2001
From: Jeroen Ooms <jeroenooms@gmail.com>
Date: Tue, 20 Oct 2015 13:10:38 +0200
Subject: [PATCH] enable static libraries on mingw
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 393505b..e92131a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,7 +265,7 @@ case "${host_os}" in
libzmq_dso_visibility="no"
if test "x$enable_static" = "xyes"; then
- AC_MSG_ERROR([Building static libraries is not supported under MinGW32])
+ CPPFLAGS="-DZMQ_STATIC"
fi
# Set FD_SETSIZE to 1024

View File

@@ -1,22 +0,0 @@
From 9e6745c12e0b100cd38acecc16ce7db02905e27c Mon Sep 17 00:00:00 2001
From: David Millard <dmillard10@gmail.com>
Date: Tue, 10 May 2016 13:53:53 -0700
Subject: [PATCH] Fix autotools for static MinGW builds
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 5a0fa14..def6ea7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -259,7 +259,7 @@ case "${host_os}" in
libzmq_dso_visibility="no"
if test "x$enable_static" = "xyes"; then
- CPPFLAGS="-DZMQ_STATIC"
+ CPPFLAGS="-DZMQ_STATIC $CPPFLAGS"
fi
# Set FD_SETSIZE to 1024

View File

@@ -1,38 +0,0 @@
From ffe62d3398d5e0191f554f61049aa7ec9fc892ae Mon Sep 17 00:00:00 2001
From: Gregory Lemercier <greglemercier@free.fr>
Date: Sun, 7 Oct 2018 18:06:54 +0200
Subject: [PATCH] Fix build on arm64 architectures with some strict compilers
This patch fixes an issue that occurs on 64-bit architetures under
strict compiler rules. The code initially checked that the received
size stored in 'uint64_t' was not bigger than the max value of a
'size_t' variable, which is legitimate on 32-bit architectures where
'size_t' variables are stored on 32 bits. On 64-bit architectures,
this test no longer makes sense since 'uint64_t' and 'size_t' types
have the same size. The issue is fixed by ignoring this portion
of code when built for arm64.
---
src/v1_decoder.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/v1_decoder.cpp b/src/v1_decoder.cpp
index b002dc9d..2c8c97a7 100644
--- a/src/v1_decoder.cpp
+++ b/src/v1_decoder.cpp
@@ -114,11 +114,13 @@ int zmq::v1_decoder_t::eight_byte_size_ready ()
return -1;
}
+#ifndef __aarch64__
// Message size must fit within range of size_t data type.
if (payload_length - 1 > std::numeric_limits <size_t>::max ()) {
errno = EMSGSIZE;
return -1;
}
+#endif
const size_t msg_size = static_cast <size_t> (payload_length - 1);
--
2.20.1

View File

@@ -80,7 +80,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF)

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)
set(Boost_USE_MULTITHREADED ON)
#set(Boost_DEBUG 1)
find_package(Boost COMPONENTS system filesystem thread date_time chrono regex )

View File

@@ -188,7 +188,7 @@ namespace epee
void put_n(const std::uint8_t ch, const std::size_t count)
{
check(count);
std::memset(tellp(), count, ch);
std::memset(tellp(), ch, count);
next_write_ += count;
}

View File

@@ -207,7 +207,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
buffer_ssl_init_fill = 0;
if (is_income && m_ssl_support != epee::net_utils::ssl_support_t::e_ssl_support_disabled)
socket().async_receive(boost::asio::buffer(buffer_),
boost::asio::socket_base::message_peek,
strand_.wrap(
std::bind(&connection<t_protocol_handler>::handle_receive, self,
std::placeholders::_1,
@@ -270,8 +269,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
//_dbg3("[sock " << socket().native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
CRITICAL_REGION_LOCAL(self->m_self_refs_lock);
//_dbg3("[sock " << socket().native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
if(m_was_shutdown)
return false;
++m_reference_count;
m_self_ref = std::move(self);
return true;
@@ -334,6 +331,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
TRY_ENTRY();
//_info("[sock " << socket().native_handle() << "] Async read calledback.");
if (m_was_shutdown)
return;
if (!e)
{
double current_speed_down;
@@ -360,6 +360,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
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 );
}
if (m_was_shutdown)
return;
delay *= 0.5;
long int ms = (long int)(delay * 100);
@@ -431,6 +434,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
std::size_t bytes_transferred)
{
TRY_ENTRY();
if (m_was_shutdown) return;
if (e)
{
// offload the error case
@@ -438,13 +444,11 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return;
}
reset_timer(get_timeout_from_bytes_read(bytes_transferred), false);
buffer_ssl_init_fill += bytes_transferred;
if (buffer_ssl_init_fill <= get_ssl_magic_size())
MTRACE("we now have " << buffer_ssl_init_fill << "/" << get_ssl_magic_size() << " bytes needed to detect SSL");
if (buffer_ssl_init_fill < get_ssl_magic_size())
{
socket().async_receive(boost::asio::buffer(buffer_.data() + buffer_ssl_init_fill, buffer_.size() - buffer_ssl_init_fill),
boost::asio::socket_base::message_peek,
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_receive, connection<t_protocol_handler>::shared_from_this(),
boost::asio::placeholders::error,
@@ -470,7 +474,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
if (m_ssl_support == epee::net_utils::ssl_support_t::e_ssl_support_enabled)
{
// Handshake
if (!handshake(boost::asio::ssl::stream_base::server))
if (!handshake(boost::asio::ssl::stream_base::server, boost::asio::const_buffer(buffer_.data(), buffer_ssl_init_fill)))
{
MERROR("SSL handshake failed");
boost::interprocess::ipcdetail::atomic_write32(&m_want_close_connection, 1);
@@ -485,6 +489,11 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return;
}
}
else
{
handle_read(e, buffer_ssl_init_fill);
return;
}
async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
@@ -551,7 +560,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{ // LOCK: chunking
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<message_size<<" B for ptr="<<message_data);
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<message_size<<" B for ptr="<<(const void*)message_data);
// 01234567890
// ^^^^ (pos=0, len=4) ; pos:=pos+len, pos=4
// ^^^^ (pos=4, len=4) ; pos:=pos+len, pos=8
@@ -564,14 +573,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
while (!message.empty()) {
byte_slice chunk = message.take_slice(chunksize_good);
MDEBUG("chunk_start="<<(void*)chunk.data()<<" ptr="<<message_data<<" pos="<<(chunk.data() - message_data));
MDEBUG("chunk_start="<<(void*)chunk.data()<<" ptr="<<(const void*)message_data<<" pos="<<(chunk.data() - message_data));
MDEBUG("part of " << message.size() << ": pos="<<(chunk.data() - message_data) << " len="<<chunk.size());
bool ok = do_send_chunk(std::move(chunk)); // <====== ***
all_ok = all_ok && ok;
if (!all_ok) {
MDEBUG("do_send() DONE ***FAILED*** from packet="<<message_size<<" B for ptr="<<message_data);
MDEBUG("do_send() DONE ***FAILED*** from packet="<<message_size<<" B for ptr="<<(const void*)message_data);
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. " << message_size);
return false; // partial failure in sending
@@ -579,7 +588,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
// (in catch block, or uniq pointer) delete buf;
} // each chunk
MDEBUG("do_send() DONE SPLIT from packet="<<message_size<<" B for ptr="<<message_data);
MDEBUG("do_send() DONE SPLIT from packet="<<message_size<<" B for ptr="<<(const void*)message_data);
MDEBUG("do_send() m_connection_type = " << m_connection_type);
@@ -651,6 +660,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
m_send_que_lock.lock();
_dbg1("sleep for queue: " << ms);
if (m_was_shutdown)
return false;
if (retry > retry_limit) {
MWARNING("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
@@ -748,7 +759,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
template<class t_protocol_handler>
void connection<t_protocol_handler>::reset_timer(boost::posix_time::milliseconds ms, bool add)
{
if (ms.total_milliseconds() < 0)
const auto tms = ms.total_milliseconds();
if (tms < 0 || (add && tms == 0))
{
MWARNING("Ignoring negative timeout " << ms);
return;

View File

@@ -132,10 +132,10 @@ class connection_basic { // not-templated base class for rapid developmet of som
ssl_support_t get_ssl_support() const { return m_ssl_support; }
void disable_ssl() { m_ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_disabled; }
bool handshake(boost::asio::ssl::stream_base::handshake_type type)
bool handshake(boost::asio::ssl::stream_base::handshake_type type, boost::asio::const_buffer buffer = {})
{
//m_state != nullptr verified in constructor
return m_state->ssl_options().handshake(socket_, type);
return m_state->ssl_options().handshake(socket_, type, buffer);
}
template<typename MutableBufferSequence, typename ReadHandler>

View File

@@ -668,7 +668,7 @@ namespace net_utils
// 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))
if (std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), "*") || 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;

View File

@@ -72,7 +72,8 @@ namespace levin
#define LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED 0
#define LEVIN_DEFAULT_MAX_PACKET_SIZE 100000000 //100MB by default
#define LEVIN_INITIAL_MAX_PACKET_SIZE 256*1024 // 256 KiB before handshake
#define LEVIN_DEFAULT_MAX_PACKET_SIZE 100000000 //100MB by default after handshake
#define LEVIN_PACKET_REQUEST 0x00000001
#define LEVIN_PACKET_RESPONSE 0x00000002

View File

@@ -84,7 +84,8 @@ class async_protocol_handler_config
public:
typedef t_connection_context connection_context;
uint64_t m_max_packet_size;
uint64_t m_initial_max_packet_size;
uint64_t m_max_packet_size;
uint64_t m_invoke_timeout;
int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, boost::uuids::uuid connection_id);
@@ -105,7 +106,7 @@ public:
size_t get_in_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_pcommands_handler_destroy(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_invoke_timeout(LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
async_protocol_handler_config():m_pcommands_handler(NULL), m_pcommands_handler_destroy(NULL), m_initial_max_packet_size(LEVIN_INITIAL_MAX_PACKET_SIZE), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_invoke_timeout(LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
{}
~async_protocol_handler_config() { set_handler(NULL, NULL); }
void del_out_connections(size_t count);
@@ -162,6 +163,7 @@ public:
net_utils::i_service_endpoint* m_pservice_endpoint;
config_type& m_config;
t_connection_context& m_connection_context;
std::atomic<uint64_t> m_max_packet_size;
net_utils::buffer m_cache_in_buffer;
stream_state m_state;
@@ -289,7 +291,8 @@ public:
m_current_head(bucket_head2()),
m_pservice_endpoint(psnd_hndlr),
m_config(config),
m_connection_context(conn_context),
m_connection_context(conn_context),
m_max_packet_size(config.m_initial_max_packet_size),
m_cache_in_buffer(4 * 1024),
m_state(stream_state_head)
{
@@ -399,13 +402,14 @@ public:
}
// these should never fail, but do runtime check for safety
CHECK_AND_ASSERT_MES(m_config.m_max_packet_size >= m_cache_in_buffer.size(), false, "Bad m_cache_in_buffer.size()");
CHECK_AND_ASSERT_MES(m_config.m_max_packet_size - m_cache_in_buffer.size() >= m_fragment_buffer.size(), false, "Bad m_cache_in_buffer.size() + m_fragment_buffer.size()");
const uint64_t max_packet_size = m_max_packet_size;
CHECK_AND_ASSERT_MES(max_packet_size >= m_cache_in_buffer.size(), false, "Bad m_cache_in_buffer.size()");
CHECK_AND_ASSERT_MES(max_packet_size - m_cache_in_buffer.size() >= m_fragment_buffer.size(), false, "Bad m_cache_in_buffer.size() + m_fragment_buffer.size()");
// flipped to subtraction; prevent overflow since m_max_packet_size is variable and public
if(cb > m_config.m_max_packet_size - m_cache_in_buffer.size() - m_fragment_buffer.size())
if(cb > max_packet_size - m_cache_in_buffer.size() - m_fragment_buffer.size())
{
MWARNING(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 = " << max_packet_size
<< ", packet received " << m_cache_in_buffer.size() + cb
<< ", connection will be closed.");
return false;
@@ -430,7 +434,7 @@ public:
//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);
MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb << ", current total " << m_cache_in_buffer.size() << "/" << m_current_head.m_cb << " (" << (100.0f * m_cache_in_buffer.size() / (m_current_head.m_cb ? m_current_head.m_cb : 1)) << "%)");
}
}
break;
@@ -465,6 +469,14 @@ public:
temp = std::move(m_fragment_buffer);
m_fragment_buffer.clear();
std::memcpy(std::addressof(m_current_head), std::addressof(temp[0]), sizeof(bucket_head2));
const size_t max_bytes = m_connection_context.get_max_bytes(m_current_head.m_command);
if(m_current_head.m_cb > std::min<size_t>(max_packet_size, max_bytes))
{
MERROR(m_connection_context << "Maximum packet size exceed!, m_max_packet_size = " << std::min<size_t>(max_packet_size, max_bytes)
<< ", packet header received " << m_current_head.m_cb << ", command " << m_current_head.m_command
<< ", connection will be closed.");
return false;
}
buff_to_invoke = {reinterpret_cast<const uint8_t*>(temp.data()) + sizeof(bucket_head2), temp.size() - sizeof(bucket_head2)};
}
@@ -519,6 +531,10 @@ public:
m_current_head.m_command, buff_to_invoke, return_buff, m_connection_context
);
// peer_id remains unset if dropped
if (m_current_head.m_command == m_connection_context.handshake_command() && m_connection_context.handshake_complete())
m_max_packet_size = m_config.m_max_packet_size;
bucket_head2 head = make_header(m_current_head.m_command, return_buff.size(), LEVIN_PACKET_RESPONSE, false);
head.m_return_code = SWAP32LE(return_code);
return_buff.insert(0, reinterpret_cast<const char*>(&head), sizeof(head));
@@ -577,10 +593,11 @@ public:
m_cache_in_buffer.erase(sizeof(bucket_head2));
m_state = stream_state_body;
m_oponent_protocol_ver = m_current_head.m_protocol_version;
if(m_current_head.m_cb > m_config.m_max_packet_size)
const size_t max_bytes = m_connection_context.get_max_bytes(m_current_head.m_command);
if(m_current_head.m_cb > std::min<size_t>(max_packet_size, max_bytes))
{
LOG_ERROR_CC(m_connection_context, "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
<< ", packet header received " << m_current_head.m_cb
LOG_ERROR_CC(m_connection_context, "Maximum packet size exceed!, m_max_packet_size = " << std::min<size_t>(max_packet_size, max_bytes)
<< ", packet header received " << m_current_head.m_cb << ", command " << m_current_head.m_command
<< ", connection will be closed.");
return false;
}
@@ -634,6 +651,9 @@ public:
boost::interprocess::ipcdetail::atomic_write32(&m_invoke_buf_ready, 0);
CRITICAL_REGION_BEGIN(m_invoke_response_handlers_lock);
if (command == m_connection_context.handshake_command())
m_max_packet_size = m_config.m_max_packet_size;
if(!send_message(command, in_buff, LEVIN_PACKET_REQUEST, true))
{
LOG_ERROR_CC(m_connection_context, "Failed to do_send");
@@ -675,6 +695,9 @@ public:
boost::interprocess::ipcdetail::atomic_write32(&m_invoke_buf_ready, 0);
if (command == m_connection_context.handshake_command())
m_max_packet_size = m_config.m_max_packet_size;
if (!send_message(command, in_buff, LEVIN_PACKET_REQUEST, true))
{
LOG_ERROR_CC(m_connection_context, "Failed to send request");
@@ -777,36 +800,32 @@ void async_protocol_handler_config<t_connection_context>::del_connection(async_p
template<class t_connection_context>
void async_protocol_handler_config<t_connection_context>::delete_connections(size_t count, bool incoming)
{
std::vector <boost::uuids::uuid> connections;
std::vector<typename connections_map::mapped_type> connections;
auto scope_exit_handler = misc_utils::create_scope_leave_handler([&connections]{
for (auto &aph: connections)
aph->finish_outer_call();
});
CRITICAL_REGION_BEGIN(m_connects_lock);
for (auto& c: m_connects)
{
if (c.second->m_connection_context.m_is_income == incoming)
connections.push_back(c.first);
if (c.second->start_outer_call())
connections.push_back(c.second);
}
// close random connections from the provided set
// TODO or better just keep removing random elements (performance)
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(connections.begin(), connections.end(), std::default_random_engine(seed));
while (count > 0 && connections.size() > 0)
{
try
{
auto i = connections.end() - 1;
async_protocol_handler<t_connection_context> *conn = m_connects.at(*i);
del_connection(conn);
conn->close();
connections.erase(i);
}
catch (const std::out_of_range &e)
{
MWARNING("Connection not found in m_connects, continuing");
}
--count;
}
for (size_t i = 0; i < connections.size() && i < count; ++i)
m_connects.erase(connections[i]->get_connection_id());
CRITICAL_REGION_END();
for (size_t i = 0; i < connections.size() && i < count; ++i)
connections[i]->close();
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
@@ -868,23 +887,35 @@ int async_protocol_handler_config<t_connection_context>::invoke_async(int comman
template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::foreach_connection(const callback_t &cb)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
for(auto& c: m_connects)
{
async_protocol_handler<t_connection_context>* aph = c.second;
if(!cb(aph->get_context_ref()))
std::vector<typename connections_map::mapped_type> conn;
auto scope_exit_handler = misc_utils::create_scope_leave_handler([&conn]{
for (auto &aph: conn)
aph->finish_outer_call();
});
CRITICAL_REGION_BEGIN(m_connects_lock);
conn.reserve(m_connects.size());
for (auto &e: m_connects)
if (e.second->start_outer_call())
conn.push_back(e.second);
CRITICAL_REGION_END()
for (auto &aph: conn)
if (!cb(aph->get_context_ref()))
return false;
}
return true;
}
//------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
async_protocol_handler<t_connection_context>* aph = nullptr;
if (find_and_lock_connection(connection_id, aph) != LEVIN_OK)
return false;
auto scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler<t_connection_context>::finish_outer_call, aph));
if(!cb(aph->get_context_ref()))
return false;
return true;
@@ -947,12 +978,14 @@ int async_protocol_handler_config<t_connection_context>::send(byte_slice message
template<class t_connection_context>
bool async_protocol_handler_config<t_connection_context>::close(boost::uuids::uuid connection_id)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
async_protocol_handler<t_connection_context>* aph = nullptr;
if (find_and_lock_connection(connection_id, aph) != LEVIN_OK)
return false;
auto scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler<t_connection_context>::finish_outer_call, aph));
if (!aph->close())
return false;
CRITICAL_REGION_LOCAL(m_connects_lock);
m_connects.erase(connection_id);
return true;
}

View File

@@ -178,7 +178,7 @@ namespace net_utils
// SSL Options
if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_enabled || m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
{
if (!m_ssl_options.handshake(*m_ssl_socket, boost::asio::ssl::stream_base::client, addr, timeout))
if (!m_ssl_options.handshake(*m_ssl_socket, boost::asio::ssl::stream_base::client, {}, addr, timeout))
{
if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
{

View File

@@ -132,6 +132,7 @@ namespace net_utils
bool handshake(
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> &socket,
boost::asio::ssl::stream_base::handshake_type type,
boost::asio::const_buffer buffer = {},
const std::string& host = {},
std::chrono::milliseconds timeout = std::chrono::seconds(15)) const;
};

View File

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

View File

@@ -141,7 +141,6 @@ public:
rolling_median_t(rolling_median_t &&m)
{
free(data);
memcpy(this, &m, sizeof(rolling_median_t));
m.data = NULL;
}

View File

@@ -1,6 +1,7 @@
#include <math.h>
#include <limits>
#include <algorithm>
#include "misc_language.h"
#include "stats.h"
enum
@@ -86,7 +87,7 @@ Tpod Stats<T, Tpod>::get_median() const
}
else
{
median = (sorted[(sorted.size() - 1) / 2] + sorted[sorted.size() / 2]) / 2;
median = epee::misc_utils::get_mid(sorted[(sorted.size() - 1) / 2], sorted[sorted.size() / 2]);
}
set_cached(bit_median);
}

View File

@@ -97,7 +97,12 @@ namespace epee
return false;
}
return serialization::load_t_from_binary(result_struct, epee::strspan<uint8_t>(pri->m_body));
static const constexpr epee::serialization::portable_storage::limits_t default_http_bin_limits = {
65536 * 3, // objects
65536 * 3, // fields
65536 * 3, // strings
};
return serialization::load_t_from_binary(result_struct, epee::strspan<uint8_t>(pri->m_body), &default_http_bin_limits);
}
template<class t_request, class t_response, class t_transport>

View File

@@ -50,6 +50,11 @@ namespace
snprintf(buf, sizeof(buf), "command-%u", command);
return on_levin_traffic(context, initiator, sent, error, bytes, buf);
}
static const constexpr epee::serialization::portable_storage::limits_t default_levin_limits = {
8192, // objects
16384, // fields
16384, // strings
};
}
namespace epee
@@ -75,7 +80,7 @@ namespace epee
return false;
}
serialization::portable_storage stg_ret;
if(!stg_ret.load_from_binary(buff_to_recv))
if(!stg_ret.load_from_binary(buff_to_recv, &default_levin_limits))
{
LOG_ERROR("Failed to load_from_binary on command " << command);
return false;
@@ -121,7 +126,7 @@ namespace epee
return false;
}
typename serialization::portable_storage stg_ret;
if(!stg_ret.load_from_binary(buff_to_recv))
if(!stg_ret.load_from_binary(buff_to_recv, &default_levin_limits))
{
on_levin_traffic(context, true, false, true, buff_to_recv.size(), command);
LOG_ERROR("Failed to load_from_binary on command " << command);
@@ -152,7 +157,7 @@ namespace epee
return false;
}
serialization::portable_storage stg_ret;
if(!stg_ret.load_from_binary(buff))
if(!stg_ret.load_from_binary(buff, &default_levin_limits))
{
on_levin_traffic(context, true, false, true, buff.size(), command);
LOG_ERROR("Failed to load_from_binary on command " << command);
@@ -202,7 +207,7 @@ namespace epee
int buff_to_t_adapter(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, callback_t cb, t_context& context )
{
serialization::portable_storage strg;
if(!strg.load_from_binary(in_buff))
if(!strg.load_from_binary(in_buff, &default_levin_limits))
{
on_levin_traffic(context, false, false, true, in_buff.size(), command);
LOG_ERROR("Failed to load_from_binary in command " << command);
@@ -236,7 +241,7 @@ namespace epee
int buff_to_t_adapter(t_owner* powner, int command, const epee::span<const uint8_t> in_buff, callback_t cb, t_context& context)
{
serialization::portable_storage strg;
if(!strg.load_from_binary(in_buff))
if(!strg.load_from_binary(in_buff, &default_levin_limits))
{
on_levin_traffic(context, false, false, true, in_buff.size(), command);
LOG_ERROR("Failed to load_from_binary in notify " << command);

View File

@@ -40,6 +40,8 @@
#include "span.h"
#include "int-util.h"
#include <boost/mpl/contains.hpp>
namespace epee
{
namespace serialization
@@ -54,6 +56,13 @@ namespace epee
typedef epee::serialization::harray harray;
typedef storage_entry meta_entry;
struct limits_t
{
size_t n_objects;
size_t n_fields;
size_t n_strings; // not counting field names
};
portable_storage(){}
virtual ~portable_storage(){}
hsection open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist = false);
@@ -84,8 +93,8 @@ namespace epee
//-------------------------------------------------------------------------------
bool store_to_binary(binarybuffer& target);
bool load_from_binary(const epee::span<const uint8_t> target);
bool load_from_binary(const std::string& target) { return load_from_binary(epee::strspan<uint8_t>(target)); }
bool load_from_binary(const epee::span<const uint8_t> target, const limits_t *limits = NULL);
bool load_from_binary(const std::string& target, const limits_t *limits = NULL) { return load_from_binary(epee::strspan<uint8_t>(target), limits); }
template<class trace_policy>
bool dump_as_xml(std::string& targetObj, const std::string& root_name = "");
bool dump_as_json(std::string& targetObj, size_t indent = 0, bool insert_newlines = true);
@@ -150,7 +159,7 @@ namespace epee
CATCH_ENTRY("portable_storage::store_to_binary", false)
}
inline
bool portable_storage::load_from_binary(const epee::span<const uint8_t> source)
bool portable_storage::load_from_binary(const epee::span<const uint8_t> source, const limits_t *limits)
{
m_root.m_entries.clear();
if(source.size() < sizeof(storage_block_header))
@@ -173,6 +182,8 @@ namespace epee
}
TRY_ENTRY();
throwable_buffer_reader buf_reader(source.data()+sizeof(storage_block_header), source.size()-sizeof(storage_block_header));
if (limits)
buf_reader.set_limits(limits->n_objects, limits->n_fields, limits->n_strings);
buf_reader.read(m_root);
return true;//TODO:
CATCH_ENTRY("portable_storage::load_from_binary", false);
@@ -282,6 +293,7 @@ namespace epee
static_assert(std::is_rvalue_reference<entry_type&&>(), "unexpected copy of value");
TRY_ENTRY();
CHECK_AND_ASSERT(psection, nullptr);
CHECK_AND_ASSERT(!pentry_name.empty(), nullptr);
auto ins_res = psection->m_entries.emplace(pentry_name, std::forward<entry_type>(entry));
return &ins_res.first->second;
CATCH_ENTRY("portable_storage::insert_new_entry_get_storage_entry", nullptr);

View File

@@ -42,6 +42,24 @@ namespace epee
{
namespace serialization
{
template<typename T>
struct ps_min_bytes {
static constexpr const size_t strict = 4096; // actual low bound
};
template<> struct ps_min_bytes<uint64_t> { static constexpr const size_t strict = 8; };
template<> struct ps_min_bytes<int64_t> { static constexpr const size_t strict = 8; };
template<> struct ps_min_bytes<uint32_t> { static constexpr const size_t strict = 4; };
template<> struct ps_min_bytes<int32_t> { static constexpr const size_t strict = 4; };
template<> struct ps_min_bytes<uint16_t> { static constexpr const size_t strict = 2; };
template<> struct ps_min_bytes<int16_t> { static constexpr const size_t strict = 2; };
template<> struct ps_min_bytes<uint8_t> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<int8_t> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<double> { static constexpr const size_t strict = 8; };
template<> struct ps_min_bytes<bool> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<std::string> { static constexpr const size_t strict = 2; };
template<> struct ps_min_bytes<section> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<array_entry> { static constexpr const size_t strict = 1; };
struct throwable_buffer_reader
{
throwable_buffer_reader(const void* ptr, size_t sz);
@@ -61,6 +79,9 @@ namespace epee
void read(section& sec);
void read(std::string& str);
void read(array_entry &ae);
template<class t_type>
size_t min_bytes() const;
void set_limits(size_t objects, size_t fields, size_t strings);
private:
struct recursuion_limitation_guard
{
@@ -81,6 +102,13 @@ namespace epee
const uint8_t* m_ptr;
size_t m_count;
size_t m_recursion_count;
size_t m_objects;
size_t m_fields;
size_t m_strings;
size_t max_objects;
size_t max_fields;
size_t max_strings;
};
inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz)
@@ -92,6 +120,12 @@ namespace epee
m_ptr = (uint8_t*)ptr;
m_count = sz;
m_recursion_count = 0;
m_objects = 0;
m_fields = 0;
m_strings = 0;
max_objects = std::numeric_limits<size_t>::max();
max_fields = std::numeric_limits<size_t>::max();
max_strings = std::numeric_limits<size_t>::max();
}
inline
void throwable_buffer_reader::read(void* target, size_t count)
@@ -108,6 +142,7 @@ namespace epee
RECURSION_LIMITATION();
uint8_t name_len = 0;
read(name_len);
CHECK_AND_ASSERT_THROW_MES(name_len > 0, "Section name is missing");
sce_name.resize(name_len);
read((void*)sce_name.data(), name_len);
}
@@ -138,7 +173,18 @@ namespace epee
//for pod types
array_entry_t<type_name> sa;
size_t size = read_varint();
CHECK_AND_ASSERT_THROW_MES(size <= m_count, "Size sanity check failed");
CHECK_AND_ASSERT_THROW_MES(size <= m_count / ps_min_bytes<type_name>::strict, "Size sanity check failed");
if (std::is_same<type_name, section>())
{
CHECK_AND_ASSERT_THROW_MES(size <= max_objects - m_objects, "Too many objects");
m_objects += size;
}
else if (std::is_same<type_name, std::string>())
{
CHECK_AND_ASSERT_THROW_MES(size <= max_strings - m_strings, "Too many strings");
m_strings += size;
}
sa.reserve(size);
//TODO: add some optimization here later
while(size--)
@@ -204,6 +250,8 @@ namespace epee
inline storage_entry throwable_buffer_reader::read_se<std::string>()
{
RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(m_strings + 1 <= max_strings, "Too many strings");
m_strings += 1;
return storage_entry(read<std::string>());
}
@@ -212,6 +260,8 @@ namespace epee
inline storage_entry throwable_buffer_reader::read_se<section>()
{
RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(m_objects < max_objects, "Too many objects");
++m_objects;
section s;//use extra variable due to vs bug, line "storage_entry se(section()); " can't be compiled in visual studio
storage_entry se(std::move(s));
section& section_entry = boost::get<section>(se);
@@ -263,12 +313,16 @@ namespace epee
RECURSION_LIMITATION();
sec.m_entries.clear();
size_t count = read_varint();
CHECK_AND_ASSERT_THROW_MES(count <= max_fields - m_fields, "Too many object fields");
m_fields += count;
while(count--)
{
//read section name string
std::string sec_name;
read_sec_name(sec_name);
sec.m_entries.emplace(std::move(sec_name), load_storage_entry());
const auto insert_loc = sec.m_entries.lower_bound(sec_name);
CHECK_AND_ASSERT_THROW_MES(insert_loc == sec.m_entries.end() || insert_loc->first != sec_name, "duplicate key: " << sec_name);
sec.m_entries.emplace_hint(insert_loc, std::move(sec_name), load_storage_entry());
}
}
inline
@@ -289,5 +343,12 @@ namespace epee
RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(false, "Reading array entry is not supported");
}
inline
void throwable_buffer_reader::set_limits(size_t objects, size_t fields, size_t strings)
{
max_objects = objects;
max_fields = fields;
max_strings = strings;
}
}
}

View File

@@ -84,10 +84,10 @@ namespace epee
}
//-----------------------------------------------------------------------------------------------------------
template<class t_struct>
bool load_t_from_binary(t_struct& out, const epee::span<const uint8_t> binary_buff)
bool load_t_from_binary(t_struct& out, const epee::span<const uint8_t> binary_buff, const epee::serialization::portable_storage::limits_t *limits = NULL)
{
portable_storage ps;
bool rs = ps.load_from_binary(binary_buff);
bool rs = ps.load_from_binary(binary_buff, limits);
if(!rs)
return false;

View File

@@ -211,6 +211,7 @@ namespace epee
for(const section_pair& se: sec.m_entries)
{
CHECK_AND_ASSERT_THROW_MES(se.first.size() < std::numeric_limits<uint8_t>::max(), "storage_entry_name is too long: " << se.first.size() << ", val: " << se.first);
CHECK_AND_ASSERT_THROW_MES(!se.first.empty(), "storage_entry_name is empty");
uint8_t len = static_cast<uint8_t>(se.first.size());
strm.write((const char*)&len, sizeof(len));
strm.write(se.first.data(), size_t(len));

View File

@@ -27,7 +27,7 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add_library(epee STATIC byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp
add_library(epee byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp
wipeable_string.cpp levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp
int-util.cpp)
@@ -35,9 +35,7 @@ if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
add_library(epee_readline STATIC readline_buffer.cpp)
endif()
if(HAVE_C11)
SET_PROPERTY(SOURCE memwipe.c PROPERTY COMPILE_FLAGS -std=c11)
endif()
set_property(SOURCE memwipe.c PROPERTY C_STANDARD 11)
# Build and install libepee if we're building for GUI
if (BUILD_GUI_DEPS)
@@ -60,14 +58,23 @@ target_link_libraries(epee
${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
PRIVATE
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${OPENSSL_LIBRARIES}
PRIVATE
${EXTRA_LIBRARIES})
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
target_link_libraries(epee_readline
PUBLIC
easylogging
${Boost_SYSTEM_LIBRARY}
PRIVATE
${GNU_READLINE_LIBRARY})
endif()
target_include_directories(epee
PUBLIC
"${EPEE_INCLUDE_DIR_BASE}"
"${OPENSSL_INCLUDE_DIR}")

View File

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

View File

@@ -209,12 +209,7 @@ namespace
}
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)
auto quoted_(const T& arg) // avoid ADL selecting C++14 std::quoted
{
return boost::range::join(boost::range::join(ceref(u8"\""), arg), ceref(u8"\""));
}
@@ -242,13 +237,13 @@ namespace
{
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));
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));
add_field(str, u8"opaque", quoted_(user.server.opaque));
}
//! Implements superseded algorithm specified in RFC 2069
@@ -674,8 +669,8 @@ namespace
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"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)));

View File

@@ -473,6 +473,7 @@ bool ssl_options_t::has_fingerprint(boost::asio::ssl::verify_context &ctx) const
bool ssl_options_t::handshake(
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> &socket,
boost::asio::ssl::stream_base::handshake_type type,
boost::asio::const_buffer buffer,
const std::string& host,
std::chrono::milliseconds timeout) const
{
@@ -530,7 +531,7 @@ bool ssl_options_t::handshake(
});
boost::system::error_code ec = boost::asio::error::would_block;
socket.async_handshake(type, boost::lambda::var(ec) = boost::lambda::_1);
socket.async_handshake(type, boost::asio::buffer(buffer), boost::lambda::var(ec) = boost::lambda::_1);
if (io_service.stopped())
{
io_service.reset();

View File

@@ -6,6 +6,17 @@
#include "string_tools.h"
#include "net/local_ip.h"
static inline uint32_t make_address_v4_from_v6(const boost::asio::ip::address_v6& a)
{
const auto &bytes = a.to_bytes();
uint32_t v4 = 0;
v4 = (v4 << 8) | bytes[12];
v4 = (v4 << 8) | bytes[13];
v4 = (v4 << 8) | bytes[14];
v4 = (v4 << 8) | bytes[15];
return htonl(v4);
}
namespace epee { namespace net_utils
{
bool ipv4_network_address::equal(const ipv4_network_address& other) const noexcept
@@ -83,8 +94,28 @@ namespace epee { namespace net_utils
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);
if (typeid(*self_) == typeid(*other_self))
return self_->is_same_host(*other_self);
const auto this_id = get_type_id();
if (this_id == ipv4_network_address::get_type_id() && other.get_type_id() == ipv6_network_address::get_type_id())
{
const boost::asio::ip::address_v6 &actual_ip = other.as<const epee::net_utils::ipv6_network_address>().ip();
if (actual_ip.is_v4_mapped())
{
const uint32_t v4ip = make_address_v4_from_v6(actual_ip);
return is_same_host(ipv4_network_address(v4ip, 0));
}
}
else if (this_id == ipv6_network_address::get_type_id() && other.get_type_id() == ipv4_network_address::get_type_id())
{
const boost::asio::ip::address_v6 &actual_ip = this->as<const epee::net_utils::ipv6_network_address>().ip();
if (actual_ip.is_v4_mapped())
{
const uint32_t v4ip = make_address_v4_from_v6(actual_ip);
return other.is_same_host(ipv4_network_address(v4ip, 0));
}
}
return false;
}
std::string print_connection_context(const connection_context_base& ctx)

View File

@@ -51,6 +51,7 @@ rdln::readline_buffer::readline_buffer()
void rdln::readline_buffer::start()
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
if(m_cout_buf != NULL)
return;
m_cout_buf = std::cout.rdbuf();
@@ -60,6 +61,7 @@ void rdln::readline_buffer::start()
void rdln::readline_buffer::stop()
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
if(m_cout_buf == NULL)
return;
std::cout.rdbuf(m_cout_buf);
@@ -88,9 +90,9 @@ rdln::linestatus rdln::readline_buffer::get_line(std::string& line) const
void rdln::readline_buffer::set_prompt(const std::string& prompt)
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
if(m_cout_buf == NULL)
return;
boost::lock_guard<boost::mutex> lock(sync_mutex);
rl_set_prompt(std::string(m_prompt_length, ' ').c_str());
rl_redisplay();
rl_set_prompt(prompt.c_str());
@@ -113,6 +115,12 @@ const std::vector<std::string>& rdln::readline_buffer::get_completions()
int rdln::readline_buffer::sync()
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
if (m_cout_buf == nullptr)
{
return -1;
}
#if RL_READLINE_VERSION < 0x0700
char lbuf[2] = {0,0};
char *line = NULL;

View File

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

View File

@@ -1,5 +1,12 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(Boost_USE_MULTITHREADED ON)
@@ -14,8 +21,8 @@ IF (MSVC)
include_directories(SYSTEM platform/msvc)
ELSE()
# set stuff for other systems
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-reorder")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-reorder")
ENDIF()

85
contrib/gitian/DOCKRUN.md Normal file
View File

@@ -0,0 +1,85 @@
Quick Gitian building with docker
=================================
*Setup instructions for a Gitian build of Monero using Docker.*
Gitian supports other container mechanisms too but if you have a Debian or
Ubuntu-based host the steps can be greatly simplified.
Preparing the Gitian builder host
---------------------------------
The procedure here will create a docker container for build preparation, as well as
for actually running the builds. The only items you must install on your own host
are docker and apt-cacher-ng. With docker installed, you should also give yourself
permission to use docker by adding yourself to the docker group.
```bash
sudo apt-get install docker.io apt-cacher-ng
sudo usermod -aG docker $USER
su $USER
```
The final `su` command is needed to start a new shell with your new group membership,
since the `usermod` command doesn't affect any existing sessions.
If you want Mac binaries included in your build, you need to obtain the MacOS SDK:
```bash
curl -O https://bitcoincore.org/depends-sources/sdks/MacOSX10.11.sdk.tar.gz
```
Other User Preparation
----------------------
The final step will be to `gpg` sign the results of your build and upload them to GitHub.
Before you can do that, you'll need
* a GitHub account.
If your GitHub account name is different from your local account name, you must
set your GitHub account name for the script to use:
```bash
export GH_USER=<github account name>
```
* PGP keys - if you don't have one already, you can use `gpg --quick-gen-key` to generate it.
* a fork of the [gitian.sigs](https://github.com/monero-project/gitian.sigs/) repo on your GitHub account.
Please follow the directions there for uploading your key first.
**Note:** Please ensure your gpg public key is available to check signatures by adding it to the [gitian.sigs/gitian-pubkeys/](https://github.com/monero-project/gitian.sigs/tree/master/gitian-pubkeys) directory in a pull request.
Building the Binaries
---------------------
The dockrun.sh script will do everything to build the binaries. Just specify the
version to build as its only argument, e.g.
```bash
./dockrun.sh v0.17.2.3
```
The build should run to completion with no errors, and will display the SHA256 checksums
of the resulting binaries. You'll be prompted to check if the sums look good, and if so
then the results will be signed, and the signatures will be pushed to GitHub.
You can also look in the [gitian.sigs](https://github.com/monero-project/gitian.sigs/) repo and / or [getmonero.org release checksums](https://web.getmonero.org/downloads/hashes.txt) to see if others got the same checksum for the same version tag. If there is ever a mismatch -- **STOP! Something is wrong**. Contact others on IRC / GitHub to figure out what is going on.
Other Options
-------------
This script just runs the [gitian-build.py](gitian-build.py) inside a container named `gitrun`.
You can set other options for that script by setting the OPT variable when running `dockrun.sh`
e.g.
```bash
OPT="-j 8" ./dockrun.sh v0.17.2.3
```
You can also examine the build and install logs by running a shell in the container, e.g.
```bash
docker exec -it gitrun /bin/bash
more builder/var/install-linux.log
```

View File

@@ -31,6 +31,8 @@ This guide explains how to set up the environment, and how to start the builds.
* Gitian gives you the option of using any of 3 different virtualization tools: `kvm`, `docker` or `lxc`. This documentation will only show how to build with `lxc` and `docker` (documentation for `kvm` is welcome). Building with `lxc` is the default, but is more complicated, so we recommend docker your first time.
* For a shortcut using `docker` follow the instructions in [DOCKRUN.md](DOCKRUN.md) instead
of following the rest of this document..
## Create the gitianuser account
@@ -126,7 +128,7 @@ Setup for LXC:
```bash
GH_USER=fluffypony
VERSION=v0.17.1.2
VERSION=v0.17.3.0
./gitian-build.py --setup $GH_USER $VERSION
```
@@ -182,7 +184,7 @@ If you chose to do detached signing using `--detach-sign` above (recommended), y
```bash
GH_USER=fluffypony
VERSION=v0.17.1.2
VERSION=v0.17.3.0
gpg --detach-sign ${VERSION}-linux/${GH_USER}/monero-linux-*-build.assert
gpg --detach-sign ${VERSION}-win/${GH_USER}/monero-win-*-build.assert

133
contrib/gitian/dockrun.sh Executable file
View File

@@ -0,0 +1,133 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: $0 <version>"
exit 1
fi
VERSION=$1
DOCKER=`command -v docker`
CACHER=`command -v apt-cacher-ng`
if [ -z "$DOCKER" -o -z "$CACHER" ]; then
echo "$0: you must first install docker.io and apt-cacher-ng"
echo " e.g. sudo apt-get install docker.io apt-cacher-ng"
exit 1
fi
GH_USER=${GH_USER-$USER}
TAG=gitrun-bionic
TAG2=base-bionic-amd64
IMAGE=`docker images | grep $TAG`
WORKDIR=/home/ubuntu
if [ -z "$IMAGE" ]; then
GID=`getent group docker`
mkdir -p docker
cd docker
# container for running gitian-build.py
cat <<EOF > ${TAG}.Dockerfile
FROM ubuntu:bionic
ENV DEBIAN_FRONTEND=noninteractive
RUN echo 'Acquire::http { Proxy "http://172.17.0.1:3142"; };' > /etc/apt/apt.conf.d/50cacher
RUN echo "$GID" >> /etc/group
RUN apt-get update && apt-get --no-install-recommends -y install lsb-release ruby git make wget docker.io python3 curl
RUN useradd -ms /bin/bash -U ubuntu -G docker
USER ubuntu:docker
WORKDIR $WORKDIR
RUN git clone https://github.com/monero-project/gitian.sigs.git sigs; \
git clone https://github.com/devrandom/gitian-builder.git builder; \
cd builder; git checkout c0f77ca018cb5332bfd595e0aff0468f77542c23; mkdir -p inputs var; cd inputs; \
git clone https://github.com/monero-project/monero
CMD ["sleep", "infinity"]
EOF
docker build --pull -f ${TAG}.Dockerfile -t $TAG .
cd ..
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name gitrun $TAG
if [ -f MacOSX10.11.sdk.tar.gz ]; then
docker cp MacOSX10.11.sdk.tar.gz gitrun:$WORKDIR/builder/inputs/
else
echo "No MacOS SDK found, Mac builds will be omitted"
fi
fi
IMAGE=`docker images | grep $TAG2`
if [ -z "$IMAGE" ]; then
mkdir -p docker
cd docker
# container for actually running each build
cat <<EOF > ${TAG2}.Dockerfile
FROM ubuntu:bionic
ENV DEBIAN_FRONTEND=noninteractive
RUN echo 'Acquire::http { Proxy "http://172.17.0.1:3142"; };' > /etc/apt/apt.conf.d/50cacher
RUN apt-get update && apt-get --no-install-recommends -y install build-essential git language-pack-en \
wget lsb-release curl gcc-7 g++-7 gcc g++ binutils-gold pkg-config autoconf libtool automake faketime \
bsdmainutils ca-certificates python cmake gperf
RUN useradd -ms /bin/bash -U ubuntu
USER ubuntu:ubuntu
WORKDIR $WORKDIR
CMD ["sleep", "infinity"]
EOF
docker build --pull -f ${TAG2}.Dockerfile -t $TAG2 .
cd ..
fi
RUNNING=`docker ps | grep gitrun`
if [ -z "$RUNNING" ]; then
BUILT=`docker ps -a | grep gitrun`
if [ -z "$BUILT" ]; then
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name gitrun $TAG
else
docker start gitrun
fi
fi
docker cp gitian-build.py gitrun:$WORKDIR/
docker exec -t gitrun ./gitian-build.py -d -b -D -n $OPT $GH_USER $VERSION
RC=$?
if [ $RC != 0 ]; then
exit $RC
fi
echo "\nBuild Results:\n"
docker exec gitrun sh -c "sha256sum out/$VERSION/*"
echo "\nIf these results look correct, type \"sign\" to sign them, otherwise ^C to stop now."
read check
if [ "$check" != "sign" ]; then
echo "Not signing, bye."
exit 1
fi
if [ ! -d sigs ]; then
git clone https://github.com/monero-project/gitian.sigs.git sigs
cd sigs
git remote add $GH_USER git@github.com:$GH_USER/gitian.sigs.git
cd ..
fi
DIRS=`docker exec gitrun sh -c "echo sigs/$VERSION-*"`
for i in $DIRS; do
docker cp gitrun:$WORKDIR/$i sigs
gpg --detach-sign $i/$GH_USER/*.assert
done
cd sigs
git checkout -b $VERSION
git add $VERSION-*
git commit -S -m "Add $GH_USER $VERSION"
git push --set-upstream $GH_USER $VERSION

View File

@@ -24,12 +24,6 @@ packages:
- "ca-certificates"
- "python"
- "cmake"
- "ccache"
- "protobuf-compiler"
- "libdbus-1-dev"
- "libharfbuzz-dev"
- "libprotobuf-dev"
- "python3-zmq"
- "unzip"
remotes:
- "url": "https://github.com/monero-project/monero.git"
@@ -52,6 +46,7 @@ script: |
if test -n "$GBUILD_CACHE_ENABLED"; then
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
export GITIAN=1
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
fi
@@ -125,8 +120,8 @@ script: |
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DCMAKE_BUILD_TYPE=Release
make ${MAKEOPTS}
chmod 755 bin/*
cp ../LICENSE bin
chmod 644 bin/LICENSE
cp ../LICENSE ../README.md ../ANONYMITY_NETWORKS.md bin
chmod 644 bin/LICENSE bin/*.md
DISTNAME=monero-${i}-${version}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2

View File

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

View File

@@ -25,12 +25,6 @@ packages:
- "ca-certificates"
- "python"
- "cmake"
- "ccache"
- "protobuf-compiler"
- "libdbus-1-dev"
- "libharfbuzz-dev"
- "libprotobuf-dev"
- "python3-zmq"
remotes:
- "url": "https://github.com/monero-project/monero.git"
"dir": "monero"
@@ -52,6 +46,7 @@ script: |
if test -n "$GBUILD_CACHE_ENABLED"; then
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
export GITIAN=1
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
fi
@@ -122,8 +117,8 @@ script: |
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=ON
make ${MAKEOPTS}
chmod 755 bin/*
cp ../LICENSE bin
chmod 644 bin/LICENSE
cp ../LICENSE ../README.md ../ANONYMITY_NETWORKS.md bin
chmod 644 bin/LICENSE bin/*.md
DISTNAME=monero-${i}-${version}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2

View File

@@ -36,12 +36,6 @@ packages:
- "ca-certificates"
- "python"
- "cmake"
- "ccache"
- "protobuf-compiler"
- "libdbus-1-dev"
- "libharfbuzz-dev"
- "libprotobuf-dev"
- "python3-zmq"
remotes:
- "url": "https://github.com/monero-project/monero.git"
"dir": "monero"
@@ -63,6 +57,7 @@ script: |
if test -n "$GBUILD_CACHE_ENABLED"; then
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
export GITIAN=1
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
fi
@@ -167,8 +162,8 @@ script: |
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON -DCMAKE_SKIP_RPATH=ON
make ${MAKEOPTS}
chmod 755 bin/*
cp ../LICENSE bin
chmod 644 bin/LICENSE
cp ../LICENSE ../README.md ../ANONYMITY_NETWORKS.md bin
chmod 644 bin/LICENSE bin/*.md
DISTNAME=monero-${i}-${version}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2

View File

@@ -41,6 +41,7 @@ script: |
if test -n "$GBUILD_CACHE_ENABLED"; then
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
export GITIAN=1
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
fi
@@ -111,8 +112,8 @@ script: |
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
make ${MAKEOPTS}
chmod 755 bin/*
cp ../LICENSE bin
chmod 644 bin/LICENSE
cp ../LICENSE ../README.md ../ANONYMITY_NETWORKS.md bin
chmod 644 bin/LICENSE bin/*.md
DISTNAME=monero-${i}-${version}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2

View File

@@ -20,7 +20,6 @@ packages:
- "zip"
- "ca-certificates"
- "python"
- "rename"
- "cmake"
alternatives:
-
@@ -54,6 +53,7 @@ script: |
if test -n "$GBUILD_CACHE_ENABLED"; then
export SOURCES_PATH=${GBUILD_COMMON_CACHE}
export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
export GITIAN=1
mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
fi
@@ -127,7 +127,7 @@ script: |
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
make ${MAKEOPTS}
cp ../LICENSE bin
cp ../LICENSE ../README.md ../ANONYMITY_NETWORKS.md bin
DISTNAME=monero-${i}-${version}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | zip -X@ ${OUTDIR}/${DISTNAME}.zip

View File

@@ -38,8 +38,10 @@
find_package(Miniupnpc REQUIRED)
message(STATUS "Using in-tree miniupnpc")
set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
add_subdirectory(miniupnp/miniupnpc)
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
if(MSVC)
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
elseif(NOT MSVC)

View File

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

View File

@@ -26,11 +26,13 @@
# 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.
cmake_minimum_required(VERSION 2.8.7)
cmake_minimum_required(VERSION 3.5)
project(easylogging CXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Threads)
find_package(Backtrace)

View File

@@ -2968,8 +2968,8 @@ void Writer::initializeLogger(Logger *logger, bool needLock) {
}
void Writer::processDispatch() {
static std::atomic_flag in_dispatch;
if (in_dispatch.test_and_set())
static __thread bool in_dispatch = false;
if (in_dispatch)
{
if (m_proceed && m_logger != NULL)
{
@@ -2978,6 +2978,7 @@ void Writer::processDispatch() {
}
return;
}
in_dispatch = true;
#if ELPP_LOGGING_ENABLED
if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) {
bool firstDispatched = false;
@@ -3016,7 +3017,7 @@ void Writer::processDispatch() {
m_logger->releaseLock();
}
#endif // ELPP_LOGGING_ENABLED
in_dispatch.clear();
in_dispatch = false;
}
void Writer::triggerDispatch(void) {

View File

@@ -1312,17 +1312,20 @@ public:
* height. The number of blocks returned is variable, based on the max_size passed.
*
* @param start_height the height of the first block
* @param min_count the minimum number of blocks to return, if they exist
* @param max_count the maximum number of blocks to return
* @param min_block_count the minimum number of blocks to return, if they exist
* @param max_block_count the maximum number of blocks to return
* @param max_tx_count the maximum number of txes to return
* @param max_size the maximum size of block/transaction data to return (will be exceeded by one blocks's worth at most, if min_count is met)
* @param blocks the returned block/transaction data
* @param pruned whether to return full or pruned tx data
* @param skip_coinbase whether to return or skip coinbase transactions (they're in blocks regardless)
* @param get_miner_tx_hash whether to calculate and return the miner (coinbase) tx hash
*
* The call will return at least min_block_count if possible, even if this contravenes max_tx_count
*
* @return true iff the blocks and transactions were found
*/
virtual bool get_blocks_from(uint64_t start_height, size_t min_count, size_t max_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const = 0;
virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const = 0;
/**
* @brief fetches the prunable transaction blob with the given hash

View File

@@ -467,7 +467,12 @@ void mdb_txn_safe::allow_new_txns()
creation_gate.clear();
}
void lmdb_resized(MDB_env *env)
void mdb_txn_safe::increment_txns(int i)
{
num_active_txns += i;
}
void lmdb_resized(MDB_env *env, int isactive)
{
mdb_txn_safe::prevent_new_txns();
@@ -478,7 +483,11 @@ void lmdb_resized(MDB_env *env)
mdb_env_info(env, &mei);
uint64_t old = mei.me_mapsize;
if (isactive)
mdb_txn_safe::increment_txns(-1);
mdb_txn_safe::wait_no_active_txns();
if (isactive)
mdb_txn_safe::increment_txns(1);
int result = mdb_env_set_mapsize(env, 0);
if (result)
@@ -496,7 +505,7 @@ inline int lmdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB
{
int res = mdb_txn_begin(env, parent, flags, txn);
if (res == MDB_MAP_RESIZED) {
lmdb_resized(env);
lmdb_resized(env, 1);
res = mdb_txn_begin(env, parent, flags, txn);
}
return res;
@@ -506,7 +515,7 @@ inline int lmdb_txn_renew(MDB_txn *txn)
{
int res = mdb_txn_renew(txn);
if (res == MDB_MAP_RESIZED) {
lmdb_resized(mdb_txn_env(txn));
lmdb_resized(mdb_txn_env(txn), 0);
res = mdb_txn_renew(txn);
}
return res;
@@ -1268,11 +1277,11 @@ BlockchainLMDB::~BlockchainLMDB()
// batch transaction shouldn't be active at this point. If it is, consider it aborted.
if (m_batch_active)
{
try { batch_abort(); }
try { BlockchainLMDB::batch_abort(); }
catch (...) { /* ignore */ }
}
if (m_open)
close();
BlockchainLMDB::close();
}
BlockchainLMDB::BlockchainLMDB(bool batch_transactions): BlockchainDB()
@@ -1569,9 +1578,9 @@ void BlockchainLMDB::close()
if (m_batch_active)
{
LOG_PRINT_L3("close() first calling batch_abort() due to active batch transaction");
batch_abort();
BlockchainLMDB::batch_abort();
}
this->sync();
BlockchainLMDB::sync();
m_tinfo.reset();
// FIXME: not yet thread safe!!! Use with care.
@@ -1584,7 +1593,7 @@ void BlockchainLMDB::sync()
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
if (is_read_only())
if (BlockchainLMDB::is_read_only())
return;
// Does nothing unless LMDB environment was opened with MDB_NOSYNC or in part
@@ -3171,7 +3180,7 @@ bool BlockchainLMDB::get_pruned_tx_blobs_from(const crypto::hash& h, size_t coun
return true;
}
bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_count, size_t max_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const
bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
@@ -3185,14 +3194,15 @@ bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_count, si
RCURSOR(txs_prunable);
}
blocks.reserve(std::min<size_t>(max_count, 10000)); // guard against very large max count if only checking bytes
blocks.reserve(std::min<size_t>(max_block_count, 10000)); // guard against very large max count if only checking bytes
const uint64_t blockchain_height = height();
uint64_t size = 0;
size_t num_txes = 0;
MDB_val_copy<uint64_t> key(start_height);
MDB_val k, v, val_tx_id;
uint64_t tx_id = ~0;
MDB_cursor_op op = MDB_SET;
for (uint64_t h = start_height; h < blockchain_height && blocks.size() < max_count && (size < max_size || blocks.size() < min_count); ++h)
for (uint64_t h = start_height; h < blockchain_height && blocks.size() < max_block_count && (size < max_size || blocks.size() < min_block_count); ++h)
{
MDB_cursor_op op = h == start_height ? MDB_SET : MDB_NEXT;
int result = mdb_cursor_get(m_cur_blocks, &key, &v, op);
@@ -3243,6 +3253,7 @@ bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_count, si
op = MDB_NEXT;
current_block.second.reserve(b.tx_hashes.size());
num_txes += b.tx_hashes.size() + (skip_coinbase ? 0 : 1);
for (const auto &tx_hash: b.tx_hashes)
{
// get pruned data
@@ -3262,6 +3273,9 @@ bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_count, si
current_block.second.push_back(std::make_pair(tx_hash, std::move(tx_blob)));
size += current_block.second.back().second.size();
}
if (blocks.size() >= min_block_count && num_txes >= max_tx_count)
break;
}
TXN_POSTFIX_RDONLY();

View File

@@ -154,6 +154,7 @@ struct mdb_txn_safe
static void prevent_new_txns();
static void wait_no_active_txns();
static void allow_new_txns();
static void increment_txns(int);
mdb_threadinfo* m_tinfo;
MDB_txn* m_txn;
@@ -257,7 +258,7 @@ public:
virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const;
virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const;
virtual bool get_pruned_tx_blobs_from(const crypto::hash& h, size_t count, std::vector<cryptonote::blobdata> &bd) const;
virtual bool get_blocks_from(uint64_t start_height, size_t min_count, size_t max_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const;
virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const;
virtual bool get_prunable_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const;
virtual bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const;

View File

@@ -70,7 +70,7 @@ public:
virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; }
virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; }
virtual bool get_pruned_tx_blobs_from(const crypto::hash& h, size_t count, std::vector<cryptonote::blobdata> &bd) const override { return false; }
virtual bool get_blocks_from(uint64_t start_height, size_t min_count, size_t max_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const override { return false; }
virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const override { return false; }
virtual bool get_prunable_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; }
virtual bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const override { return false; }
virtual uint64_t get_block_height(const crypto::hash& h) const override { return 0; }

View File

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

Binary file not shown.

View File

@@ -241,6 +241,14 @@ namespace cryptonote
ADD_CHECKPOINT2(2206500, "dd3c8590f33eaa546a4ce69d02f27fd58a2f115cd32d733bd9426f8278f0cb8a", "0xf8725275799f0d");
ADD_CHECKPOINT2(2210500, "ed17259215ac6aabe6e8252b5b5eff613d2e69cc2111173e567109aa78301911", "0xfbcb50a9a6a433");
ADD_CHECKPOINT2(2224000, "e34bc71301600df96d08aaa6b0bde932cba1b06a3dd57076e3f664a078810a80", "0x1052fc256fceb6f");
ADD_CHECKPOINT2(2235500, "3eac1a1253495733e10d00fd5e8e1639741566d91bae38bc6d3342af6b75da53", "0x10cea232ce71d23");
ADD_CHECKPOINT2(2244000, "f06b8a19a75070cd002414d9d3ce59cf6b11ed9db464c6b84d3f22abbff84fae", "0x112b3331539f585");
ADD_CHECKPOINT2(2248500, "125d0872f00b54730b1e6f925f9d211b0158dd0e254de8cefa371f2e7aba5118", "0x115c89ab7abec4a");
ADD_CHECKPOINT2(2257500, "99643c32f27b157c6952a67af7dbe07ca819e71df386fa9379a344686d2950cf", "0x11c2f448d4f8830");
ADD_CHECKPOINT2(2265000, "727a6228a71f5b35c899553ee19d60bfc10c126a009ffd633afb30666e8edbe6", "0x121a33e656ecad4");
ADD_CHECKPOINT2(2325000, "f61261994b368700f0cbbfb4477433fa36a3c7537908ab2d1a06ac2987cc8b01", "0x154bceeffaff847");
ADD_CHECKPOINT2(2430000, "5f7f4273eb6be024df3c4311a8d28482220a253190efa1719f35b7782587740c", "0x1c3f14ba9b0bebc");
ADD_CHECKPOINT2(2478000, "692fc889f5328c9cfe47e9846ca2bb3d61d82dbeb37077e90e0f8c36b8fc0c84", "0x1fbb38d0aae41a6");
return true;
}

View File

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

View File

@@ -871,10 +871,19 @@ std::string get_nix_version_display_string()
return max_concurrency;
}
bool is_privacy_preserving_network(const std::string &address)
{
if (boost::ends_with(address, ".onion"))
return true;
if (boost::ends_with(address, ".i2p"))
return true;
return false;
}
bool is_local_address(const std::string &address)
{
// always assume Tor/I2P addresses to be untrusted by default
if (boost::ends_with(address, ".onion") || boost::ends_with(address, ".i2p"))
if (is_privacy_preserving_network(address))
{
MDEBUG("Address '" << address << "' is Tor/I2P, non local");
return false;
@@ -1346,8 +1355,12 @@ std::string get_nix_version_display_string()
100743, 92152, 57565, 22533, 37564, 21823, 19980, 18277, 18402, 14344,
12142, 15842, 13677, 17631, 18294, 22270, 41422, 39296, 36688, 33512,
33831, 27582, 22276, 27516, 27317, 25505, 24426, 20566, 23045, 26766,
28185, 26169, 27011,
28642 // Blocks 1,990,000 to 1,999,999 in December 2019
28185, 26169, 27011, 28642, 34994, 34442, 30682, 34357, 31640, 41167,
41301, 48616, 51075, 55061, 49909, 44606, 47091, 53828, 42520, 39023,
55245, 56145, 51119, 60398, 71821, 48142, 60310, 56041, 54176, 66220,
56336, 55248, 56656, 63305, 54029, 77136, 71902, 71618, 83587, 81068,
69062, 54848, 53681, 53555,
50616 // Blocks 2,400,000 to 2,409,999 in July 2021
};
const uint64_t block_range_size = 10000;

View File

@@ -228,6 +228,7 @@ namespace tools
unsigned get_max_concurrency();
bool is_local_address(const std::string &address);
bool is_privacy_preserving_network(const std::string &address);
int vercmp(const char *v0, const char *v1); // returns < 0, 0, > 0, similar to strcmp, but more human friendly than lexical - does not attempt to validate
bool sha256sum(const uint8_t *data, size_t len, crypto::hash &hash);

View File

@@ -123,13 +123,17 @@ namespace crypto {
void random32_unbiased(unsigned char *bytes)
{
// l = 2^252 + 27742317777372353535851937790883648493.
// it fits 15 in 32 bytes
// l fits 15 times in 32 bytes (iow, 15 l is the highest multiple of l that fits in 32 bytes)
static const unsigned char limit[32] = { 0xe3, 0x6a, 0x67, 0x72, 0x8b, 0xce, 0x13, 0x29, 0x8f, 0x30, 0x82, 0x8c, 0x0b, 0xa4, 0x10, 0x39, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0 };
do
while(1)
{
generate_random_bytes_thread_safe(32, bytes);
} while (!sc_isnonzero(bytes) && !less32(bytes, limit)); // should be good about 15/16 of the time
sc_reduce32(bytes);
if (!less32(bytes, limit))
continue;
sc_reduce32(bytes);
if (sc_isnonzero(bytes))
break;
}
}
/* generate a random 32-byte (256-bit) integer and copy it to res */
static inline void random_scalar(ec_scalar &res) {

View File

@@ -51,6 +51,12 @@
#define INIT_SIZE_BLK 8
#define INIT_SIZE_BYTE (INIT_SIZE_BLK * AES_BLOCK_SIZE)
#if defined(_MSC_VER)
#define THREADV __declspec(thread)
#else
#define THREADV __thread
#endif
extern void aesb_single_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
extern void aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
@@ -89,6 +95,28 @@ static inline int use_v4_jit(void)
#endif
}
#if defined(__x86_64__) || defined(__aarch64__)
static inline int force_software_aes(void)
{
static int use = -1;
if (use != -1)
return use;
const char *env = getenv("MONERO_USE_SOFTWARE_AES");
if (!env) {
use = 0;
}
else if (!strcmp(env, "0") || !strcmp(env, "no")) {
use = 0;
}
else {
use = 1;
}
return use;
}
#endif
#define VARIANT1_1(p) \
do if (variant == 1) \
{ \
@@ -437,12 +465,6 @@ static inline int use_v4_jit(void)
_b1 = _b; \
_b = _c; \
#if defined(_MSC_VER)
#define THREADV __declspec(thread)
#else
#define THREADV __thread
#endif
#pragma pack(push, 1)
union cn_slow_hash_state
{
@@ -498,25 +520,6 @@ STATIC INLINE void xor64(uint64_t *a, const uint64_t b)
* @return true if the CPU supports AES, false otherwise
*/
STATIC INLINE int force_software_aes(void)
{
static int use = -1;
if (use != -1)
return use;
const char *env = getenv("MONERO_USE_SOFTWARE_AES");
if (!env) {
use = 0;
}
else if (!strcmp(env, "0") || !strcmp(env, "no")) {
use = 0;
}
else {
use = 1;
}
return use;
}
STATIC INLINE int check_aes_hw(void)
{
@@ -1009,6 +1012,44 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
}
#elif !defined NO_AES && (defined(__arm__) || defined(__aarch64__))
#ifdef __aarch64__
#include <sys/mman.h>
THREADV uint8_t *hp_state = NULL;
THREADV int hp_malloced = 0;
void cn_slow_hash_allocate_state(void)
{
if(hp_state != NULL)
return;
#ifndef MAP_HUGETLB
#define MAP_HUGETLB 0
#endif
hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
if(hp_state == MAP_FAILED)
hp_state = NULL;
if(hp_state == NULL)
{
hp_malloced = 1;
hp_state = (uint8_t *) malloc(MEMORY);
}
}
void cn_slow_hash_free_state(void)
{
if(hp_state == NULL)
return;
if (hp_malloced)
free(hp_state);
else
munmap(hp_state, MEMORY);
hp_state = NULL;
hp_malloced = 0;
}
#else
void cn_slow_hash_allocate_state(void)
{
// Do nothing, this is just to maintain compatibility with the upgraded slow-hash.c
@@ -1020,6 +1061,7 @@ void cn_slow_hash_free_state(void)
// As above
return;
}
#endif
#if defined(__GNUC__)
#define RDATA_ALIGN16 __attribute__ ((aligned(16)))
@@ -1060,6 +1102,23 @@ union cn_slow_hash_state
* and moving between vector and regular registers stalls the pipeline.
*/
#include <arm_neon.h>
#ifndef __APPLE__
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
STATIC INLINE int check_aes_hw(void)
{
#ifdef __APPLE__
return 1;
#else
static int supported = -1;
if(supported < 0)
supported = (getauxval(AT_HWCAP) & HWCAP_AES) != 0;
return supported;
#endif
}
#define TOTALBLOCKS (MEMORY / AES_BLOCK_SIZE)
@@ -1156,7 +1215,6 @@ __asm__(
STATIC INLINE void aes_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey, int nblocks)
{
const uint8x16_t *k = (const uint8x16_t *)expandedKey, zero = {0};
uint8x16_t tmp;
int i;
for (i=0; i<nblocks; i++)
@@ -1191,7 +1249,6 @@ STATIC INLINE void aes_pseudo_round_xor(const uint8_t *in, uint8_t *out, const u
{
const uint8x16_t *k = (const uint8x16_t *)expandedKey;
const uint8x16_t *x = (const uint8x16_t *)xor;
uint8x16_t tmp;
int i;
for (i=0; i<nblocks; i++)
@@ -1244,16 +1301,17 @@ STATIC INLINE void aligned_free(void *ptr)
}
#endif /* FORCE_USE_HEAP */
STATIC INLINE void xor_blocks(uint8_t* a, const uint8_t* b)
{
U64(a)[0] ^= U64(b)[0];
U64(a)[1] ^= U64(b)[1];
}
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed, uint64_t height)
{
RDATA_ALIGN16 uint8_t expandedKey[240];
#ifndef FORCE_USE_HEAP
RDATA_ALIGN16 uint8_t local_hp_state[MEMORY];
#else
uint8_t *local_hp_state = (uint8_t *)aligned_malloc(MEMORY,16);
#endif
uint8_t *local_hp_state;
uint8_t text[INIT_SIZE_BYTE];
RDATA_ALIGN16 uint64_t a[2];
RDATA_ALIGN16 uint64_t b[4];
@@ -1264,12 +1322,22 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
size_t i, j;
uint64_t *p = NULL;
oaes_ctx *aes_ctx = NULL;
int useAes = !force_software_aes() && check_aes_hw();
static void (*const extra_hashes[4])(const void *, size_t, char *) =
{
hash_extra_blake, hash_extra_groestl, hash_extra_jh, hash_extra_skein
};
// this isn't supposed to happen, but guard against it for now.
if(hp_state == NULL)
cn_slow_hash_allocate_state();
// locals to avoid constant TLS dereferencing
local_hp_state = hp_state;
// locals to avoid constant TLS dereferencing
/* CryptoNight Step 1: Use Keccak1600 to initialize the 'state' (and 'text') buffers from the data. */
if (prehashed) {
@@ -1287,11 +1355,26 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
* the 2MB large random access buffer.
*/
aes_expand_key(state.hs.b, expandedKey);
for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)
if(useAes)
{
aes_pseudo_round(text, text, expandedKey, INIT_SIZE_BLK);
memcpy(&local_hp_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE);
aes_expand_key(state.hs.b, expandedKey);
for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)
{
aes_pseudo_round(text, text, expandedKey, INIT_SIZE_BLK);
memcpy(&local_hp_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE);
}
}
else
{
aes_ctx = (oaes_ctx *) oaes_alloc();
oaes_key_import_data(aes_ctx, state.hs.b, AES_KEY_SIZE);
for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)
{
for(j = 0; j < INIT_SIZE_BLK; j++)
aesb_pseudo_round(&text[AES_BLOCK_SIZE * j], &text[AES_BLOCK_SIZE * j], aes_ctx->key->exp_data);
memcpy(&local_hp_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE);
}
}
U64(a)[0] = U64(&state.k[0])[0] ^ U64(&state.k[32])[0];
@@ -1307,13 +1390,26 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
_b = vld1q_u8((const uint8_t *)b);
_b1 = vld1q_u8(((const uint8_t *)b) + AES_BLOCK_SIZE);
for(i = 0; i < ITER / 2; i++)
if(useAes)
{
pre_aes();
_c = vaeseq_u8(_c, zero);
_c = vaesmcq_u8(_c);
_c = veorq_u8(_c, _a);
post_aes();
for(i = 0; i < ITER / 2; i++)
{
pre_aes();
_c = vaeseq_u8(_c, zero);
_c = vaesmcq_u8(_c);
_c = veorq_u8(_c, _a);
post_aes();
}
}
else
{
for(i = 0; i < ITER / 2; i++)
{
pre_aes();
aesb_single_round((uint8_t *) &_c, (uint8_t *) &_c, (uint8_t *) &_a);
post_aes();
}
}
/* CryptoNight Step 4: Sequentially pass through the mixing buffer and use 10 rounds
@@ -1322,11 +1418,27 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
memcpy(text, state.init, INIT_SIZE_BYTE);
aes_expand_key(&state.hs.b[32], expandedKey);
for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)
if(useAes)
{
// add the xor to the pseudo round
aes_pseudo_round_xor(text, text, expandedKey, &local_hp_state[i * INIT_SIZE_BYTE], INIT_SIZE_BLK);
aes_expand_key(&state.hs.b[32], expandedKey);
for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)
{
// add the xor to the pseudo round
aes_pseudo_round_xor(text, text, expandedKey, &local_hp_state[i * INIT_SIZE_BYTE], INIT_SIZE_BLK);
}
}
else
{
oaes_key_import_data(aes_ctx, &state.hs.b[32], AES_KEY_SIZE);
for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++)
{
for(j = 0; j < INIT_SIZE_BLK; j++)
{
xor_blocks(&text[j * AES_BLOCK_SIZE], &local_hp_state[i * INIT_SIZE_BYTE + j * AES_BLOCK_SIZE]);
aesb_pseudo_round(&text[AES_BLOCK_SIZE * j], &text[AES_BLOCK_SIZE * j], aes_ctx->key->exp_data);
}
}
oaes_free((OAES_CTX **) &aes_ctx);
}
/* CryptoNight Step 5: Apply Keccak to the state again, and then
@@ -1339,10 +1451,6 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
memcpy(state.init, text, INIT_SIZE_BYTE);
hash_permutation(&state.hs);
extra_hashes[state.hs.b[0] & 3](&state, 200, hash);
#ifdef FORCE_USE_HEAP
aligned_free(local_hp_state);
#endif
}
#else /* aarch64 && crypto */

View File

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

View File

@@ -0,0 +1,71 @@
// Copyright (c) 2020, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "connection_context.h"
#include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "p2p/p2p_protocol_defs.h"
namespace cryptonote
{
std::size_t cryptonote_connection_context::get_max_bytes(const int command) noexcept
{
switch (command)
{
case nodetool::COMMAND_HANDSHAKE_T<cryptonote::CORE_SYNC_DATA>::ID:
return 65536;
case nodetool::COMMAND_TIMED_SYNC_T<cryptonote::CORE_SYNC_DATA>::ID:
return 65536;
case nodetool::COMMAND_PING::ID:
return 4096;
case nodetool::COMMAND_REQUEST_SUPPORT_FLAGS::ID:
return 4096;
case cryptonote::NOTIFY_NEW_BLOCK::ID:
return 1024 * 1024 * 128; // 128 MB (max packet is a bit less than 100 MB though)
case cryptonote::NOTIFY_NEW_TRANSACTIONS::ID:
return 1024 * 1024 * 128; // 128 MB (max packet is a bit less than 100 MB though)
case cryptonote::NOTIFY_REQUEST_GET_OBJECTS::ID:
return 1024 * 1024 * 2; // 2 MB
case cryptonote::NOTIFY_RESPONSE_GET_OBJECTS::ID:
return 1024 * 1024 * 128; // 128 MB (max packet is a bit less than 100 MB though)
case cryptonote::NOTIFY_REQUEST_CHAIN::ID:
return 512 * 1024; // 512 kB
case cryptonote::NOTIFY_RESPONSE_CHAIN_ENTRY::ID:
return 1024 * 1024 * 4; // 4 MB
case cryptonote::NOTIFY_NEW_FLUFFY_BLOCK::ID:
return 1024 * 1024 * 4; // 4 MB, but it does not includes transaction data
case cryptonote::NOTIFY_REQUEST_FLUFFY_MISSING_TX::ID:
return 1024 * 1024; // 1 MB
case cryptonote::NOTIFY_GET_TXPOOL_COMPLEMENT::ID:
return 1024 * 1024 * 4; // 4 MB
default:
break;
};
return std::numeric_limits<size_t>::max();
}
} // cryptonote

View File

@@ -31,6 +31,7 @@
#pragma once
#include <unordered_set>
#include <atomic>
#include <algorithm>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "net/net_utils_base.h"
#include "copyable_atomic.h"
@@ -38,12 +39,12 @@
namespace cryptonote
{
struct cryptonote_connection_context: public epee::net_utils::connection_context_base
{
cryptonote_connection_context(): m_state(state_before_handshake), m_remote_blockchain_height(0), m_last_response_height(0),
m_last_request_time(boost::date_time::not_a_date_time), m_callback_request_count(0),
m_last_known_hash(crypto::null_hash), m_pruning_seed(0), m_rpc_port(0), m_rpc_credits_per_hash(0), m_anchor(false) {}
m_last_known_hash(crypto::null_hash), m_pruning_seed(0), m_rpc_port(0), m_rpc_credits_per_hash(0), m_anchor(false), m_score(0),
m_expect_response(0), m_expect_height(0), m_num_requested(0) {}
enum state
{
@@ -54,6 +55,12 @@ namespace cryptonote
state_normal
};
static constexpr int handshake_command() noexcept { return 1001; }
bool handshake_complete() const noexcept { return m_state != state_before_handshake; }
//! \return Maximum number of bytes permissible for `command`.
static size_t get_max_bytes(int command) noexcept;
state m_state;
std::vector<std::pair<crypto::hash, uint64_t>> m_needed_objects;
std::unordered_set<crypto::hash> m_requested_objects;
@@ -66,7 +73,12 @@ namespace cryptonote
uint16_t m_rpc_port;
uint32_t m_rpc_credits_per_hash;
bool m_anchor;
//size_t m_score; TODO: add score calculations
int32_t m_score;
int m_expect_response;
uint64_t m_expect_height;
size_t m_num_requested;
epee::copyable_atomic m_new_stripe_notification{0};
epee::copyable_atomic m_idle_peer_notification{0};
};
inline std::string get_protocol_state_string(cryptonote_connection_context::state s)

View File

@@ -49,6 +49,7 @@
#include "misc_language.h"
#include "ringct/rctTypes.h"
#include "device/device.hpp"
#include "cryptonote_basic/fwd.h"
namespace cryptonote
{

View File

@@ -139,22 +139,6 @@ namespace cryptonote
return h;
}
//---------------------------------------------------------------
void get_transaction_prefix_hash(const transaction_prefix& tx, crypto::hash& h)
{
std::ostringstream s;
binary_archive<true> a(s);
::serialization::serialize(a, const_cast<transaction_prefix&>(tx));
crypto::cn_fast_hash(s.str().data(), s.str().size(), h);
}
//---------------------------------------------------------------
crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx)
{
crypto::hash h = null_hash;
get_transaction_prefix_hash(tx, h);
return h;
}
//---------------------------------------------------------------
bool expand_transaction_1(transaction &tx, bool base_only)
{
if (tx.version >= 2 && !is_coinbase(tx))

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2014-2021, 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
#include "cryptonote_format_utils.h"
namespace cryptonote
{
void get_transaction_prefix_hash(const transaction_prefix& tx, crypto::hash& h)
{
std::ostringstream s;
binary_archive<true> a(s);
::serialization::serialize(a, const_cast<transaction_prefix&>(tx));
crypto::cn_fast_hash(s.str().data(), s.str().size(), h);
}
crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx)
{
crypto::hash h = crypto::null_hash;
get_transaction_prefix_hash(tx, h);
return h;
}
}

View File

@@ -41,6 +41,8 @@ namespace cryptonote
{
cryptonote::transaction tx;
crypto::hash hash;
uint64_t blob_size;
uint64_t weight;
bool res; //!< Listeners must ignore `tx` when this is false.
};
}

View File

@@ -33,4 +33,5 @@ namespace cryptonote
struct block;
class transaction;
struct txpool_event;
struct tx_block_template_backlog_entry;
}

View File

@@ -93,6 +93,7 @@
#define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing
#define BLOCKS_IDS_SYNCHRONIZING_MAX_COUNT 25000 //max blocks ids count in synchronizing
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4 100 //by default, blocks count in blocks downloading
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 //by default, blocks count in blocks downloading
#define BLOCKS_SYNCHRONIZING_MAX_COUNT 2048 //must be a power of 2, greater than 128, equal to SEEDHASH_EPOCH_BLOCKS
@@ -102,11 +103,11 @@
#define CRYPTONOTE_DANDELIONPP_STEMS 2 // number of outgoing stem connections per epoch
#define CRYPTONOTE_DANDELIONPP_FLUFF_PROBABILITY 10 // out of 100
#define CRYPTONOTE_DANDELIONPP_FLUFF_PROBABILITY 20 // out of 100
#define CRYPTONOTE_DANDELIONPP_MIN_EPOCH 10 // minutes
#define CRYPTONOTE_DANDELIONPP_EPOCH_RANGE 30 // seconds
#define CRYPTONOTE_DANDELIONPP_FLUSH_AVERAGE 5 // seconds average for poisson distributed fluff flush
#define CRYPTONOTE_DANDELIONPP_EMBARGO_AVERAGE 173 // seconds (see tx_pool.cpp for more info)
#define CRYPTONOTE_DANDELIONPP_EMBARGO_AVERAGE 39 // seconds (see tx_pool.cpp for more info)
// see src/cryptonote_protocol/levin_notify.cpp
#define CRYPTONOTE_NOISE_MIN_EPOCH 5 // minutes
@@ -123,7 +124,8 @@
#define CRYPTONOTE_MAX_FRAGMENTS 20 // ~20 * NOISE_BYTES max payload size for covert/noise send
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT 1000
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT 1000
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_TX_COUNT 20000
#define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000
#define P2P_LOCAL_GRAY_PEERLIST_LIMIT 5000
@@ -132,6 +134,7 @@
#define P2P_DEFAULT_HANDSHAKE_INTERVAL 60 //secondes
#define P2P_DEFAULT_PACKET_MAX_SIZE 50000000 //50000000 bytes maximum packet size
#define P2P_DEFAULT_PEERS_IN_HANDSHAKE 250
#define P2P_MAX_PEERS_IN_HANDSHAKE 250
#define P2P_DEFAULT_CONNECTION_TIMEOUT 5000 //5 seconds
#define P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT 45 // seconds
#define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
@@ -195,6 +198,8 @@
#define RPC_CREDITS_PER_HASH_SCALE ((float)(1<<24))
#define DNS_BLOCKLIST_LIFETIME (86400 * 8)
// New constants are intended to go here
namespace config
{

View File

@@ -1234,6 +1234,12 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<block_extended_info>
reorg_notify->notify("%s", std::to_string(split_height).c_str(), "%h", std::to_string(m_db->height()).c_str(),
"%n", std::to_string(m_db->height() - split_height).c_str(), "%d", std::to_string(discarded_blocks).c_str(), NULL);
crypto::hash prev_id;
if (!get_block_hash(alt_chain.back().bl, prev_id))
MERROR("Failed to get block hash of an alternative chain's tip");
else
send_miner_notifications(prev_id, alt_chain.back().already_generated_coins);
for (const auto& notifier : m_block_notifiers)
{
std::size_t notify_height = split_height;
@@ -1780,6 +1786,30 @@ bool Blockchain::create_block_template(block& b, const account_public_address& m
return create_block_template(b, NULL, miner_address, diffic, height, expected_reward, ex_nonce, seed_height, seed_hash);
}
//------------------------------------------------------------------
bool Blockchain::get_miner_data(uint8_t& major_version, uint64_t& height, crypto::hash& prev_id, crypto::hash& seed_hash, difficulty_type& difficulty, uint64_t& median_weight, uint64_t& already_generated_coins, std::vector<tx_block_template_backlog_entry>& tx_backlog)
{
prev_id = m_db->top_block_hash(&height);
++height;
major_version = m_hardfork->get_ideal_version(height);
seed_hash = crypto::null_hash;
if (m_hardfork->get_current_version() >= RX_BLOCK_VERSION)
{
uint64_t seed_height, next_height;
crypto::rx_seedheights(height, &seed_height, &next_height);
seed_hash = get_block_id_by_height(seed_height);
}
difficulty = get_difficulty_for_next_block();
median_weight = m_current_block_cumul_weight_median;
already_generated_coins = m_db->get_block_already_generated_coins(height - 1);
m_tx_pool.get_block_template_backlog(tx_backlog);
return true;
}
//------------------------------------------------------------------
// for an alternate chain, get the timestamps from the main chain to complete
// the needed number of timestamps for the BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW.
bool Blockchain::complete_timestamps_vector(uint64_t start_top_height, std::vector<uint64_t>& timestamps) const
@@ -2701,7 +2731,7 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& qbloc
// find split point between ours and foreign blockchain (or start at
// blockchain height <req_start_block>), and return up to max_count FULL
// blocks by reference.
bool Blockchain::find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata> > > >& blocks, uint64_t& total_height, uint64_t& start_height, bool pruned, bool get_miner_tx_hash, size_t max_count) const
bool Blockchain::find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata> > > >& blocks, uint64_t& total_height, uint64_t& start_height, bool pruned, bool get_miner_tx_hash, size_t max_block_count, size_t max_tx_count) const
{
LOG_PRINT_L3("Blockchain::" << __func__);
CRITICAL_REGION_LOCAL(m_blockchain_lock);
@@ -2726,8 +2756,8 @@ bool Blockchain::find_blockchain_supplement(const uint64_t req_start_block, cons
db_rtxn_guard rtxn_guard(m_db);
total_height = get_current_blockchain_height();
blocks.reserve(std::min(std::min(max_count, (size_t)10000), (size_t)(total_height - start_height)));
CHECK_AND_ASSERT_MES(m_db->get_blocks_from(start_height, 3, max_count, FIND_BLOCKCHAIN_SUPPLEMENT_MAX_SIZE, blocks, pruned, true, get_miner_tx_hash),
blocks.reserve(std::min(std::min(max_block_count, (size_t)10000), (size_t)(total_height - start_height)));
CHECK_AND_ASSERT_MES(m_db->get_blocks_from(start_height, 3, max_block_count, max_tx_count, FIND_BLOCKCHAIN_SUPPLEMENT_MAX_SIZE, blocks, pruned, true, get_miner_tx_hash),
false, "Error getting blocks");
return true;
@@ -2758,32 +2788,44 @@ void Blockchain::flush_invalid_blocks()
m_invalid_blocks.clear();
}
//------------------------------------------------------------------
bool Blockchain::have_block(const crypto::hash& id) const
bool Blockchain::have_block_unlocked(const crypto::hash& id, int *where) const
{
// WARNING: this function does not take m_blockchain_lock, and thus should only call read only
// m_db functions which do not depend on one another (ie, no getheight + gethash(height-1), as
// well as not accessing class members, even read only (ie, m_invalid_blocks). The caller must
// lock if it is otherwise needed.
LOG_PRINT_L3("Blockchain::" << __func__);
CRITICAL_REGION_LOCAL(m_blockchain_lock);
if(m_db->block_exists(id))
{
LOG_PRINT_L2("block " << id << " found in main chain");
if (where) *where = HAVE_BLOCK_MAIN_CHAIN;
return true;
}
if(m_db->get_alt_block(id, NULL, NULL))
{
LOG_PRINT_L2("block " << id << " found in alternative chains");
if (where) *where = HAVE_BLOCK_ALT_CHAIN;
return true;
}
if(m_invalid_blocks.count(id))
{
LOG_PRINT_L2("block " << id << " found in m_invalid_blocks");
if (where) *where = HAVE_BLOCK_INVALID;
return true;
}
return false;
}
//------------------------------------------------------------------
bool Blockchain::have_block(const crypto::hash& id, int *where) const
{
CRITICAL_REGION_LOCAL(m_blockchain_lock);
return have_block_unlocked(id, where);
}
//------------------------------------------------------------------
bool Blockchain::handle_block_to_main_chain(const block& bl, block_verification_context& bvc, bool notify/* = true*/)
{
LOG_PRINT_L3("Blockchain::" << __func__);
@@ -4366,6 +4408,7 @@ leave:
get_difficulty_for_next_block(); // just to cache it
invalidate_block_template_cache();
send_miner_notifications(id, already_generated_coins);
for (const auto& notifier: m_block_notifiers)
notifier(new_height - 1, {std::addressof(bl), 1});
@@ -4737,6 +4780,8 @@ uint64_t Blockchain::prevalidate_block_hashes(uint64_t height, const std::vector
CHECK_AND_ASSERT_MES(weights.empty() || weights.size() == hashes.size(), 0, "Unexpected weights size");
CRITICAL_REGION_LOCAL(m_blockchain_lock);
// easy case: height >= hashes
if (height >= m_blocks_hash_of_hashes.size() * HASH_OF_HASHES_STEP)
return hashes.size();
@@ -4992,6 +5037,8 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::vector<block_complete
unsigned nblocks = batches;
if (i < extra)
++nblocks;
if (nblocks == 0)
break;
tpool.submit(&waiter, boost::bind(&Blockchain::block_longhash_worker, this, thread_height, epee::span<const block>(&blocks[thread_height - height], nblocks), std::ref(maps[i])), true);
thread_height += nblocks;
}
@@ -5272,7 +5319,7 @@ void Blockchain::set_user_options(uint64_t maxthreads, bool sync_on_blocks, uint
m_max_prepare_blocks_threads = maxthreads;
}
void Blockchain::add_block_notify(boost::function<void(std::uint64_t, epee::span<const block>)>&& notify)
void Blockchain::add_block_notify(BlockNotifyCallback&& notify)
{
if (notify)
{
@@ -5281,6 +5328,15 @@ void Blockchain::add_block_notify(boost::function<void(std::uint64_t, epee::span
}
}
void Blockchain::add_miner_notify(MinerNotifyCallback&& notify)
{
if (notify)
{
CRITICAL_REGION_LOCAL(m_blockchain_lock);
m_miner_notifiers.push_back(std::move(notify));
}
}
void Blockchain::safesyncmode(const bool onoff)
{
/* all of this is no-op'd if the user set a specific
@@ -5376,7 +5432,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
static const char expected_block_hashes_hash[] = "1d166275537bfbb5841d98da298c65089f3006d751776b2dc8a4f0275ef0ce58";
static const char expected_block_hashes_hash[] = "dbc25cc509fe8a44426f7168c608d0b4cf6ea5d43682ba4087d6a47aa0384656";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)
@@ -5533,6 +5589,33 @@ void Blockchain::cache_block_template(const block &b, const cryptonote::account_
m_btc_valid = true;
}
void Blockchain::send_miner_notifications(const crypto::hash &prev_id, uint64_t already_generated_coins)
{
if (m_miner_notifiers.empty())
return;
const uint64_t height = m_db->height();
const uint8_t major_version = m_hardfork->get_ideal_version(height);
const difficulty_type diff = get_difficulty_for_next_block();
const uint64_t median_weight = m_current_block_cumul_weight_median;
crypto::hash seed_hash = crypto::null_hash;
if (m_hardfork->get_current_version() >= RX_BLOCK_VERSION)
{
uint64_t seed_height, next_height;
crypto::rx_seedheights(height, &seed_height, &next_height);
seed_hash = get_block_id_by_height(seed_height);
}
std::vector<tx_block_template_backlog_entry> tx_backlog;
m_tx_pool.get_block_template_backlog(tx_backlog);
for (const auto& notifier : m_miner_notifiers)
{
notifier(major_version, height, prev_id, seed_hash, diff, median_weight, already_generated_coins, tx_backlog);
}
}
namespace cryptonote {
template bool Blockchain::get_transactions(const std::vector<crypto::hash>&, std::vector<transaction>&, std::vector<crypto::hash>&) const;
template bool Blockchain::get_split_transactions_blobs(const std::vector<crypto::hash>&, std::vector<std::tuple<crypto::hash, cryptonote::blobdata, crypto::hash, cryptonote::blobdata>>&, std::vector<crypto::hash>&) const;

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