aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-09-24Merge pull request #5905luigi11111-5/+0
Revert a96c1a4 and adc16d2 (moneromooo-monero)
2019-09-24Merge pull request #5877luigi11111-8/+8
2cd4fd8 Changed the use of boost:value_initialized for C++ list initializer (JesusRami) 4ad191f Removed unused boost/value_init header (whyamiroot) 928f4be Make null hash constants constexpr (whyamiroot)
2019-09-16Properly format multiline logsmoneromooo-monero1-2/+2
As a side effect, colouring on Windows should now work regardless of version
2019-09-11Revert "cryptonote_protocol: drop peers we can't download from when syncing"moneromooo-monero1-5/+0
This reverts commit a96c1a46d4b3854252de75cbe09458ad5d1aecb0.
2019-09-11Revert "Fix check for disconnecting peers when syncing"moneromooo-monero1-1/+1
This reverts commit adc16d2504d3e76b0115791caf10446684d45433.
2019-09-04Merge pull request #5806luigi11111-3/+3
69465e3 cryptonote_protocol: fix '--no-sync', ignore new blocks and txes (xiphon)
2019-09-02Changed the use of boost:value_initialized for C++ list initializerJesus Ramirez1-8/+8
2019-08-11cryptonote_protocol: fix '--no-sync', ignore new blocks and txesxiphon1-3/+3
2019-07-24Merge pull request #5595luigi11112-0/+4
2aa1134 daemon: display peer address type in print_cn (moneromooo-monero)
2019-07-24Merge pull request #5591luigi11112-16/+9
f17dcde Remove unused txs member in NOTIFY_RESPONSE_GET_OBJECT (Doy-lee)
2019-07-17Added support for "noise" over I1P/Tor to mask Tx transmission.Lee Clagett3-61/+709
2019-08-16Fix check for disconnecting peers when syncingJason Rhinelander1-1/+1
The check added here (in #5732/#5733) is supposed to disconnect behind peers when the current node is syncing, but actually disconnects behind peers always. We are syncing when `target > our_height`, but the check here triggers when `target > remote_height`, which is basically always true when the preceding `m_core.have_block(hshd.top_id)` check is true.
2019-07-15Remove unused txs member in NOTIFY_RESPONSE_GET_OBJECTDoyle2-16/+9
2019-07-04cryptonote_protocol: drop peers we can't download from when syncingmoneromooo-monero1-0/+5
Any peer that's behind us while syncing is useless to us (though not to them). This ensures that we don't get our peer slots filled with peers that we can't use. Once we've synced, we can connect to them and they can then sync off us if they want.
2019-06-14cryptonote_protocol: fix another potential P2P DoSmoneromooo-monero1-0/+15
When asking for txes in a fluffy transaction, one might ask for the same (large) tx many times
2019-06-14cryptonote_protocol: expand basic DoS protectionmoneromooo-monero2-4/+4
Count transactions as well
2019-06-14cryptonote_protocol_handler: prevent potential DoSanonimal2-0/+12
Essentially, one can send such a large amount of IDs that core exhausts all free memory. This issue can theoretically be exploited using very large CN blockchains, such as Monero. This is a partial fix. Thanks and credit given to CryptoNote author 'cryptozoidberg' for collaboration and the fix. Also thanks to 'moneromooo'. Referencing HackerOne report #506595.
2019-05-31daemon: display peer address type in print_cnmoneromooo-monero2-0/+4
2019-05-01fix wide difficulty conversion with some versions of boostmoneromooo-monero1-2/+2
2019-04-14cryptonote_protocol: warn when the last connection goesmoneromooo-monero1-0/+2
2019-04-06Merge pull request #5360Riccardo Spagni1-2/+16
b0c552f5 cryptonote_protocol_handler: add block/tx hashes in notify logs (moneromooo-monero)
2019-04-06Merge pull request #5346Riccardo Spagni1-4/+4
c84ea299 cryptonote_basic: some more minor speedups (moneromooo-monero) e40eb2ad cryptonote_basic: speedup calculate_block_hash (moneromooo-monero) 547a9708 cryptonote: block parsing + hash calculation speedup (moneromooo-monero) 11604b6d blockchain: avoid unneeded block copy (moneromooo-monero) 8461df04 save some database calls when getting top block hash and height (moneromooo-monero) 3bbc3661 Avoid repeated (de)serialization when syncing (moneromooo-monero)
2019-03-28cryptonote_protocol_handler: add block/tx hashes in notify logsmoneromooo-monero1-2/+16
2019-03-25cryptonote: block parsing + hash calculation speedupmoneromooo-monero1-4/+4
This saves a duplicate serialization step
2019-03-24Make difficulty 128 bit instead of 64 bitmoneromooo-monero2-1/+8
Based on Boolberry work by: jahrsg <jahr@jahr.me> cr.zoidberg <crypto.zoidberg@gmail.com>
2019-03-19Merge pull request #5199Riccardo Spagni2-0/+44
eef164f7 cryptonote_protocol_handler: search for syncing peers in "cruise mode" (moneromooo-monero)
2019-03-19Merge pull request #5195Riccardo Spagni2-1/+11
a54e81e5 daemon: add '--no-sync' arg to optionally disable blockchain sync (xiphon)
2019-03-17Merge pull request #5190Riccardo Spagni2-0/+3
551104fb daemon: add --public-node mode, RPC port propagation over P2P (xiphon)
2019-03-05Update 2019 copyrightbinaryFate8-8/+8
2019-03-05cryptonote: avoid double parsing blocks when syncingmoneromooo-monero1-3/+18
2019-03-05core: avoid double parsing blocks after hohmoneromooo-monero1-7/+17
2019-03-04default initialize rpc structuresmoneromooo-monero1-8/+16
2019-03-04Merge pull request #5111Riccardo Spagni1-1/+1
6a3608d3 cryptonote_protocol_handler: pad tx messages when using tor/i2p (moneromooo-monero)
2019-02-26cryptonote_protocol_handler: search for syncing peers in "cruise mode"moneromooo-monero2-0/+44
When all our outgoing peer slots are filled, we cycle one peer at a time looking for syncing peers until we have at least two such peers. This brings two advantages: - Peers without incoming connections will find more syncing peers that before, thereby strengthening network decentralization - Peers will have more resistance to isolation attacks, as they are more likely to find a "good" peer than they were before
2019-02-25daemon: add '--no-sync' arg to optionally disable blockchain syncxiphon2-1/+11
2019-02-25daemon: add --public-node mode, RPC port propagation over P2Pxiphon2-0/+3
2019-02-02epee: add SSL supportmoneromooo-monero2-0/+2
RPC connections now have optional tranparent SSL. An optional private key and certificate file can be passed, using the --{rpc,daemon}-ssl-private-key and --{rpc,daemon}-ssl-certificate options. Those have as argument a path to a PEM format private private key and certificate, respectively. If not given, a temporary self signed certificate will be used. SSL can be enabled or disabled using --{rpc}-ssl, which accepts autodetect (default), disabled or enabled. Access can be restricted to particular certificates using the --rpc-ssl-allowed-certificates, which takes a list of paths to PEM encoded certificates. This can allow a wallet to connect to only the daemon they think they're connected to, by forcing SSL and listing the paths to the known good certificates. To generate long term certificates: openssl genrsa -out /tmp/KEY 4096 openssl req -new -key /tmp/KEY -out /tmp/REQ openssl x509 -req -days 999999 -sha256 -in /tmp/REQ -signkey /tmp/KEY -out /tmp/CERT /tmp/KEY is the private key, and /tmp/CERT is the certificate, both in PEM format. /tmp/REQ can be removed. Adjust the last command to set expiration date, etc, as needed. It doesn't make a whole lot of sense for monero anyway, since most servers will run with one time temporary self signed certificates anyway. SSL support is transparent, so all communication is done on the existing ports, with SSL autodetection. This means you can start using an SSL daemon now, but you should not enforce SSL yet or nothing will talk to you.
2019-01-30cryptonote_protocol_handler: pad tx messages when using tor/i2pmoneromooo-monero1-1/+1
2019-01-29Merge pull request #4988Riccardo Spagni2-17/+44
973403bc Adding initial support for broadcasting transactions over Tor (Lee Clagett)
2019-01-28Adding initial support for broadcasting transactions over TorLee Clagett2-17/+44
- Support for ".onion" in --add-exclusive-node and --add-peer - Add --anonymizing-proxy for outbound Tor connections - Add --anonymous-inbounds for inbound Tor connections - Support for sharing ".onion" addresses over Tor connections - Support for broadcasting transactions received over RPC exclusively over Tor (else broadcast over public IP when Tor not enabled).
2019-01-28block_queue: fix late sanity check off by onemoneromooo-monero1-1/+1
2019-01-22Pruningmoneromooo-monero5-229/+790
The blockchain prunes seven eighths of prunable tx data. This saves about two thirds of the blockchain size, while keeping the node useful as a sync source for an eighth of the blockchain. No other data is currently pruned. There are three ways to prune a blockchain: - run monerod with --prune-blockchain - run "prune_blockchain" in the monerod console - run the monero-blockchain-prune utility The first two will prune in place. Due to how LMDB works, this will not reduce the blockchain size on disk. Instead, it will mark parts of the file as free, so that future data will use that free space, causing the file to not grow until free space grows scarce. The third way will create a second database, a pruned copy of the original one. Since this is a new file, this one will be smaller than the original one. Once the database is pruned, it will stay pruned as it syncs. That is, there is no need to use --prune-blockchain again, etc.
2019-01-16Merge pull request #5001Riccardo Spagni1-0/+1
a5ffc2d5 Remove boost::lexical_cast for uuid and unused uuid function (Lee Clagett)
2019-01-16Merge pull request #4976Riccardo Spagni2-4/+4
85665003 epee: better network buffer data structure (moneromooo-monero)
2019-01-06Merge pull request #4949Riccardo Spagni2-12/+24
5464725a protocol: change standby mode to not wait sleeping (moneromooo-monero) 85807dfb add a once_a_time_milliseconds class (moneromooo-monero)
2018-12-23epee: better network buffer data structuremoneromooo-monero2-4/+4
avoids pointless allocs and memcpy
2018-12-23Remove boost::lexical_cast for uuid and unused uuid functionLee Clagett1-0/+1
2018-12-12Merge pull request #4787Riccardo Spagni2-0/+33
3dba7f25 protocol: option to pad transaction relay to the next kB (moneromooo-monero)
2018-12-07protocol: change standby mode to not wait sleepingmoneromooo-monero2-12/+24
2018-12-04Merge pull request #4906Riccardo Spagni1-2/+2
506472e0 protocol: fix use after free when dropping a connection (moneromooo-monero)
2018-12-04Merge pull request #4877Riccardo Spagni1-1/+3
c25260f5 protocol: fix incorrect tx hash in log (moneromooo-monero)
2018-11-26protocol: fix use after free when dropping a connectionmoneromooo-monero1-2/+2
2018-11-20protocol: fix incorrect tx hash in logmoneromooo-monero1-1/+3
2018-11-15Removed a lot of unnecessary includesMartijn Otto1-22/+0
2018-11-06protocol: option to pad transaction relay to the next kBmoneromooo-monero2-0/+33
To help protect one's privacy from traffic volume analysis for people using Tor or I2P. This will really fly once we relay txes on a timer rather than on demand, though. Off by default for now since it's wasteful and doesn't bring anything until I2P's in.
2018-09-04Merge pull request #4160luigi11112-13/+32
704b60c block_queue: faster check whether a block was requested (moneromooo-monero)
2018-08-22Merge pull request #4207luigi11111-7/+12
ce9457a cryptonote_protocol: don't serialize an unneeded new block message (moneromooo-monero)
2018-08-15Merge pull request #4020luigi11111-1/+14
c24a0af [monerod] Added blocks remaining count during syncronisation. (Jorropo)
2018-08-09cryptonote_protocol: don't serialize an unneeded new block messagemoneromooo-monero1-7/+12
Non fluffy block nodes should now be very rare
2018-07-25[monerod] Added blocks remaining count during syncronisation.Jorropo1-1/+14
And percent if usefull (% < 99)
2018-07-20block_queue: faster check whether a block was requestedmoneromooo-monero2-13/+32
2018-06-27Merge pull request #3716luigi11114-59/+62
a2b557f 6795bd0 209ec96 ed2c81e a830db2 57ea902 31a895e ba8331c f7f1917 41be339 f025ae9 ef2cb63 dcfd299 5d3e702 2704624 2771a18 0e4c7d0 (moneromooo-monero)
2018-06-26replace std::list with std::vector on some hot pathsmoneromooo-monero4-59/+62
also use reserve where appropriate
2018-06-09cryptonote_protocol_handler: log when dropping a peermoneromooo-monero1-0/+3
2018-06-03protocol: drop (and increase fails) if most blocks hashes are invalidmoneromooo-monero1-3/+3
2018-05-28protocol: do not switch to unsafe sync mode for just a few blocksmoneromooo-monero1-1/+2
2018-04-29Merge pull request #3719Riccardo Spagni1-8/+11
3880bf39 cryptonote_protocol_handler.inl: remove span read just now that failed to pass some basic tests (stoffu) da249fd5 cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool) (stoffu)
2018-04-28cryptonote_protocol_handler.inl: remove span read just now that failed to ↵stoffu1-0/+3
pass some basic tests
2018-04-28cryptonote_protocol_handler.inl: fix return type mismatches (int vs bool)stoffu1-8/+8
2018-04-22Only log an error if fork version is higher AND is not known.Thaer Khawaja1-1/+1
2018-03-15Fix typos in various filesDimitris Apostolou1-1/+1
2018-03-05Merge pull request #3277Riccardo Spagni1-1/+1
0e7ad2e2 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (stoffu) af773211 Stagenet (stoffu) cc9a0bee command_line: allow args to depend on more than one args (stoffu) 55f8d917 command_line::get_arg: remove 'required' for dependent args as they're always optional (stoffu) 450306a0 command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 (stoffu) 9f9e095a Use `genesis_tx` parameter in `generate_genesis_block`. #3261 (Jean Pierre Dudey)
2018-03-05Correct spelling mistakes.Edward Betts2-2/+2
2018-03-05Stagenetstoffu1-1/+1
2018-02-16Merge pull request #3229Riccardo Spagni1-0/+9
928c1825 cryptonote_protocol: guard against all threads in standby (moneromooo-monero)
2018-02-16Merge pull request #3181Riccardo Spagni2-3/+3
e3f0980a daemon: don't drop RPC with busy error when running offline (moneromooo-monero)
2018-02-02cryptonote_protocol: guard against all threads in standbymoneromooo-monero1-0/+9
2018-01-28Merge pull request #3186Riccardo Spagni1-1/+1
7ed62e63 cryptonote_protocol: fix std::move usage on different types (moneromooo-monero)
2018-01-26Readd copyright starting datexmr-eric2-2/+2
2018-01-26Update 2018 copyrightxmr-eric8-8/+8
2018-01-26cryptonote_protocol: fix std::move usage on different typesmoneromooo-monero1-1/+1
2018-01-25Merge pull request #3105Riccardo Spagni1-1/+1
b56f4645 cryptonote_protocol: fix size_t used in wire format (moneromooo-monero)
2018-01-25Merge pull request #3040Riccardo Spagni1-1/+1
69f9a075 cryptonote_protocol: fix missing space in version mismatch message (moneromooo-monero)
2018-01-25Merge pull request #3015Riccardo Spagni1-0/+2
f06603a4 cryptonote_protocol: update target height when receiving blocks (moneromooo-monero)
2018-01-25daemon: don't drop RPC with busy error when running offlinemoneromooo-monero2-3/+3
2018-01-11cryptonote_protocol: fix size_t used in wire formatmoneromooo-monero1-1/+1
This is 32 bits on 32 bit platforms, but 64 bits on 64 bit platforms.
2018-01-10Merge pull request #3004Riccardo Spagni1-0/+5
a2c845c7 cryptonote_protocol: internal error consistency size check (moneromooo-monero)
2017-12-31cryptonote_protocol: fix missing space in version mismatch messagemoneromooo-monero1-1/+1
2017-12-27cryptonote_protocol: update target height when receiving blocksmoneromooo-monero1-0/+2
2017-12-24cryptonote_protocol: internal error consistency size checkmoneromooo-monero1-0/+5
2017-12-18use const refs in for loops for non tiny typesmoneromooo-monero1-1/+1
2017-12-18add empty container sanity checks when using front() and back()moneromooo-monero2-0/+7
2017-12-18cryptonote_protocol: sanity check chain hashes from peermoneromooo-monero1-0/+6
2017-12-18cryptonote_protocol: print peer versions when unexpectedmoneromooo-monero1-6/+10
also avoid integer underflow on zero height
2017-12-17Merge pull request #2877Riccardo Spagni3-10/+4
43f5269f Wallets now do not depend on the daemon rpc lib (moneromooo-monero) bb89ae8b move connection_basic and network_throttle from src/p2p to epee (moneromooo-monero) 4abf25f3 cryptonote_core does not depend on p2p anymore (moneromooo-monero)
2017-12-16move connection_basic and network_throttle from src/p2p to epeemoneromooo-monero2-2/+2
These even had the epee namespace. This fixes some ugly circular dependencies.
2017-12-16cryptonote_core does not depend on p2p anymoremoneromooo-monero2-8/+2
As a followon side effect, this makes a lot of inline code included only in particular cpp files (and instanciated when necessary.
2017-12-16move includes around to lessen overall loadmoneromooo-monero3-37/+2
2017-12-16Merge pull request #2866Riccardo Spagni1-1/+1
cf5f6236 Corrections in rate limiting / trottle code, especially in 'out' direction (rbrunner7)
2017-12-03cryptonote_protocol: fix corner case looping asking for same block hashesmoneromooo-monero1-0/+4
2017-11-28Corrections in rate limiting / trottle code, especially in 'out' directionrbrunner71-1/+1
Deleted 3 out of 4 calls to method connection_basic::sleep_before_packet that were erroneous / superfluous, which enabled the elimination of a "fudge" factor of 2.1 in connection_basic::set_rate_up_limit; also ended the multiplying of limit values and numbers of bytes transferred by 1024 before handing them over to the global throttle objects
2017-11-18make connection_id a string in RPCmoneromooo-monero2-3/+3
It's sent as JSON, so raw binary is not appropriate
2017-11-14remove "using namespace std" from headersmoneromooo-monero1-2/+2
It's nasty, and actually breaks on Solaris, where if.h fails to build due to: struct map *if_memmap;
2017-10-22protocol: drop connections which don't handshake after some timemoneromooo-monero1-3/+6
2017-10-15Fix compiler warnings with Clang 6.0.0.Vasil Dimov1-1/+1
monero/src/cryptonote_protocol/block_queue.cpp:208:44: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] static const boost::uuids::uuid uuid0 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { } monero/src/wallet/wallet_rpc_server.cpp:1895:43: error: lambda capture 'wal' is not used [-Werror,-Wunused-lambda-capture] tools::signal_handler::install([&wrpc, &wal](int) { ^ monero/src/cryptonote_protocol/cryptonote_protocol_handler.inl:1616:40: error: lambda capture 'arg' is not used [-Werror,-Wunused-lambda-capture] m_p2p->for_each_connection([this, &arg, &fluffy_arg, &exclude_context, &fullConnections... ^ monero/src/cryptonote_protocol/cryptonote_protocol_handler.inl:1616:46: error: lambda capture 'fluffy_arg' is not used [-Werror,-Wunused-lambda-capture] m_p2p->for_each_connection([this, &arg, &fluffy_arg, &exclude_context, &fullConnections... ^ monero/src/blockchain_utilities/blockchain_export.cpp:181:3: error: bool literal returned from 'main' [-Werror,-Wmain] CHECK_AND_ASSERT_MES(r, false, "Failed to initialize source blockchain storage"); ^ ~~~~~ monero/contrib/epee/include/misc_log_ex.h:180:97: note: expanded from macro 'CHECK_AND_ASSERT_MES' ...fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0) ^ ~~~~~~~~~~~~ monero/src/blockchain_utilities/blockchain_export.cpp:195:3: error: bool literal returned from 'main' [-Werror,-Wmain] CHECK_AND_ASSERT_MES(r, false, "Failed to export blockchain raw data"); ^ ~~~~~ monero/contrib/epee/include/misc_log_ex.h:180:97: note: expanded from macro 'CHECK_AND_ASSERT_MES' ...fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0) ^ ~~~~~~~~~~~~
2017-10-15Merge pull request #2604Riccardo Spagni1-3/+10
0a872798 protocol: kick idle peers by dropping them (moneromooo-monero)
2017-10-15Merge pull request #2571Riccardo Spagni1-2/+1
8028dde7 block_queue: use boost::uuids::nil_uuid where appropriate (moneromooo-monero)
2017-10-15Merge pull request #2469Riccardo Spagni1-0/+12
7adceee6 precomputed block hashes are now in blocks of N (currently 256) (moneromooo-monero)
2017-10-07protocol: kick idle peers by dropping themmoneromooo-monero1-3/+10
This is safer, as we don't risk break expectations (eg, requesting block hashes and then receiving a late set of blocks). Dropping a connection means another will be attempted in a fresh state. Also bump the kick timeout to 5 minutes, to ensure we only kick really idle peers.
2017-10-03block_queue: use boost::uuids::nil_uuid where appropriatemoneromooo-monero1-2/+1
2017-09-25move checkpoints in a separate librarymoneromooo-monero2-2/+2
2017-09-25Merge pull request #2460Riccardo Spagni1-2/+3
3487d810 cryptonote_protocol: fix needless chain hashes downloads (moneromooo-monero)
2017-09-25Merge pull request #2458Riccardo Spagni2-14/+2
7f2f6ee1 protocol: remove hop count on block propagation (moneromooo-monero)
2017-09-21build: auto update version info without manually deleting version.hstoffu1-2/+0
2017-09-18precomputed block hashes are now in blocks of N (currently 256)moneromooo-monero1-0/+12
This shaves a lot of space off binaries
2017-09-17cryptonote_protocol: fix needless chain hashes downloadsmoneromooo-monero1-2/+3
The last known hash was calculated incorrectly, causing further chain hash downloads to restart from the current chain. When the block queue has close to 10k blocks waiting, this causes frequent downloads of 10k more hashes, but with only the last few hashes actually being useful.
2017-09-17protocol: remove hop count on block propagationmoneromooo-monero2-14/+2
It is unused, as it was apparently a future optimization, and it leaks some information (though since pools publish thei blocks they find, that amount seems small).
2017-09-03Add a --fluffy-blocks option to relay blocks as fluffy blocksmoneromooo-monero1-1/+1
Defaults to off, but fluffy blocks are forced enabled on testnet
2017-09-02Merge pull request #2372Riccardo Spagni1-6/+34
c867357a cryptonote_protocol: error handling on cleanup_handle_incoming_blocks (moneromooo-monero) ce901fcb Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks (moneromooo-monero) 84fa015e core: guard against exceptions in handle_incoming_{block,tx} (moneromooo-monero)
2017-08-29cryptonote_protocol: error handling on cleanup_handle_incoming_blocksmoneromooo-monero1-6/+34
2017-08-28cryptonote_protocol: remove old spans when received as old blocksmoneromooo-monero1-0/+1
fixes getting those in a loop
2017-08-26Merge pull request #2314Riccardo Spagni1-0/+2
c22d22e2 Cleanup test impact of adding safesyncmode() method (Howard Chu) 9a859844 Toggle SAFE syncmode on and off automatically (Howard Chu)
2017-08-23cryptonote_protocol: warn if we see a higher top version we expectmoneromooo-monero1-0/+2
2017-08-23cryptonote_protocol: less strict check on top version on connectmoneromooo-monero1-1/+1
This allows peers who synced past a fork on the wrong height to reorg to the right chain after they updated their software to include the new version.
2017-08-23cryptonote_protocol: update target height when syncing toomoneromooo-monero1-0/+4
2017-08-23cryptonote_protocol: simplify and remove unnecessary castsmoneromooo-monero1-5/+6
2017-08-23cryptonote_protocol: print peer top height along with its versionmoneromooo-monero1-1/+1
2017-08-22Cleanup test impact of adding safesyncmode() methodHoward Chu1-2/+2
2017-08-21cryptonote_protocol: misc fixes to the new sync algorithmmoneromooo-monero4-38/+107
Fix sync wedge corner case: It could happen if a connection went into standby mode, while it was the one which had requested the next span, and that span was still waiting for the data, and that peer is not on the main chain. Other peers can then start asking for that data again and again, but never get it as only that forked peer does. And various other fixes
2017-08-20Toggle SAFE syncmode on and off automaticallyHoward Chu1-0/+2
If monerod is started with default sync mode, set it to SAFE after synchronization completes. Set it back to FAST if synchronization restarts (e.g. because another peer has a longer blockchain). If monerod is started with an explicit sync mode, none of this automation takes effect.
2017-08-17Merge pull request #2303Riccardo Spagni4-1/+42
5a283078 cryptonote_protocol: large block sync size before v4 (moneromooo-monero) 7b747607 cryptonote_protocol: kick idle synchronizing peers (moneromooo-monero)
2017-08-17Merge pull request #2300Riccardo Spagni1-1/+1
42b34b35 Consistently print peer id in hex and on 16 chars (moneromooo-monero)
2017-08-17Merge pull request #2291Riccardo Spagni1-1/+1
b59cd074 befor -> before (Nano Akron)
2017-08-17cryptonote_protocol: large block sync size before v4moneromooo-monero1-1/+1
2017-08-16cryptonote_protocol: kick idle synchronizing peersmoneromooo-monero4-0/+41
In case they dropped off downloading for any reason, they'll get sent to download again.
2017-08-16Consistently print peer id in hex and on 16 charsmoneromooo-monero1-1/+1
2017-08-15befor -> beforeNano Akron1-1/+1
Really unique yet consistent spelling mistake
2017-08-15protocol: pass blockchain cumulative difficulty when syncingmoneromooo-monero2-0/+5
Not used yet.
2017-08-15Merge pull request #2276Riccardo Spagni1-2/+2
a1891ebe tests: fix tests build (moneromooo-monero)
2017-08-15Merge pull request #2275Riccardo Spagni1-1/+1
88e83f94 cryptonote_protocol_handler: log versions as unsigned ints (moneromooo-monero)
2017-08-15Merge pull request #2273Riccardo Spagni1-2/+2
0e8d60c0 cryptonote_protocol: fix recv/send idle time before handshake (moneromooo-monero)
2017-08-15Merge pull request #2272Riccardo Spagni2-67/+56
f90bbe2a cryptonote_protocol: keep target in sync with dropped connections (moneromooo-monero)
2017-08-15cryptonote_protocol: fix "holes" in block download schedulemoneromooo-monero1-1/+2
2017-08-15cryptonote_protocol: fix out of order additionmoneromooo-monero1-0/+37
This was broken by the reorg fix, since we now have to add blocks regardless of their starting height. We now check whether we know the parent for the first block in the next span, or whether it was requested. If neither, it's an orphan. If it is not known, but was requested, we wait to get that block.
2017-08-15block_queue: do not add empty spansmoneromooo-monero1-0/+2
2017-08-12daemon: print peers' top height in sync_infomoneromooo-monero2-1/+7
2017-08-12cryptonote_protocol_handler: log versions as unsigned intsmoneromooo-monero1-1/+1
They're interpreted as characters otherwise
2017-08-12protocol: fix reorgs while syncingmoneromooo-monero3-100/+45
2017-08-10tests: fix tests buildmoneromooo-monero1-2/+2
Add get_fork_version and add_ideal_fork_version to core so cryptonote_protocol does not have to need the Blockchain class directly, as it's not in its dependencies, and add those to the fake core classes in tests too.
2017-08-09cryptonote_protocol: fix recv/send idle time before handshakemoneromooo-monero1-2/+2
2017-08-09cryptonote_protocol: keep target in sync with dropped connectionsmoneromooo-monero2-67/+56
When a node is dropped, we stop considering its claimed blockchain height as a factor in the target height calculation. This prevents a runaway chain from being still thought to be the target even if the nodes carrying it are dropped.
2017-08-09protocol: add checks for top block hard fork versionmoneromooo-monero2-0/+13
We won't even talk to a peer which claims a wrong version for its top block. This will avoid syncing to known bad peers in the first place. Also add IP fails when failing to verify a block.
2017-08-07Merge pull request #2149Riccardo Spagni6-159/+1012
158c3ecf core: thread most of handle_incoming_tx (moneromooo-monero) f57ee382 cryptonote_protocol: retry stale spans early (moneromooo-monero) 90df52e1 cryptonote_protocol: light cleanup (moneromooo-monero) 84e23156 cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages (moneromooo-monero) 5be43fcd cryptonote_protocol_handler: sync speedup (moneromooo-monero)
2017-08-07Merge pull request #2242Riccardo Spagni1-1/+1
1c9196b0 cryptonote_protocol: fix days behind calc on testnet (moneromooo-monero)
2017-08-07Merge pull request #2234Riccardo Spagni2-6/+6
214fd81e some include cleanup (moneromooo-monero)
2017-08-07core: thread most of handle_incoming_txmoneromooo-monero1-6/+9
2017-08-07cryptonote_protocol: retry stale spans earlymoneromooo-monero3-0/+25
Connections can be dropped by the net_node layer, unbeknownst to cryptonote_protocol, which would then not flush any spans scheduled to that connection, which would cause it to be only downloaded again once it becomes the next span (possibly after a small delay if it had been requested less than 5 seconds ago).
2017-08-07cryptonote_protocol: light cleanupmoneromooo-monero2-26/+9
2017-08-07cryptonote_protocol: avoid spurious SYNCHRONIZED OK messagesmoneromooo-monero1-2/+12
2017-08-07cryptonote_protocol_handler: sync speedupmoneromooo-monero5-131/+963
A block queue is now placed between block download and block processing. Blocks are now requested only from one peer (unless starved). Includes a new sync_info coommand.
2017-08-02cryptonote_protocol: fix days behind calc on testnetmoneromooo-monero1-1/+1
2017-07-31some include cleanupmoneromooo-monero2-6/+6
2017-07-24cryptonote_protocol: Set send_idle_time in connection_info correctlyrbrunner71-1/+1
2017-06-28Remove typeid use in network_addressmoneromooo-monero1-1/+1
Since I had to add an ID to the derived classes anyway, this can be used instead. This removes an apparently pointless warning from CLANG too.
2017-06-18Merge pull request #2064Riccardo Spagni1-3/+1
6fc2dc39 cryptonote_protocol_handler: fix crash in debug log (moneromooo-monero)
2017-06-18Merge pull request #2052Riccardo Spagni2-33/+22
072102cf abstracted nework addresses (moneromooo-monero)
2017-06-01cryptonote_protocol_handler: fix crash in debug logmoneromooo-monero1-3/+1
2017-05-27abstracted nework addressesmoneromooo-monero2-33/+22
All code which was using ip and port now uses a new IPv4 object, subclass of a new network_address class. This will allow easy addition of I2P addresses later (and also IPv6, etc). Both old style and new style peer lists are now sent in the P2P protocol, which is inefficient but allows peers using both codebases to talk to each other. This will be removed in the future. No other subclasses than IPv4 exist yet.
2017-05-25Move txpool to the databasemoneromooo-monero1-3/+13
Integration could go further (ie, return_tx_to_pool calls should not be needed anymore, possibly other things). poolstate.bin is now obsolete.
2017-03-13protocol: fix wrong tx being looked up from fluffy blockmoneromooo-monero1-1/+10
Found by smooth
2017-03-12protocol: fix fluffy to normal block dropping txesmoneromooo-monero1-1/+1
2017-02-25protocol: tone down a rate limit not implemented yet warningmoneromooo-monero1-1/+1
it scares users
2017-02-24protocol: fix "sync done" message not appearingmoneromooo-monero1-1/+3
2017-02-21update copyright year, fix occasional lack of newline at line endRiccardo Spagni7-7/+7
2017-02-21Merge pull request #1736Riccardo Spagni1-1/+5
424b76a4 Fix spurious synchronization status msgs (Howard Chu)
2017-02-21Merge pull request #1727Riccardo Spagni1-0/+3
0288310e blockchain_db: add "raw" blobdata getters for block and transaction (moneromooo-monero)
2017-02-15Fix spurious synchronization status msgsHoward Chu1-1/+5
Only update target height if it's actually greater than the current target. Only display "synchronized" when current height equals target.
2017-02-13blockchain_db: add "raw" blobdata getters for block and transactionmoneromooo-monero1-0/+3
This speeds up operations such as serving blocks to syncing peers
2017-02-13cryptonote_protocol: tweaks to the syncing speedupmoneromooo-monero1-6/+10
- only pause mining once we've got the lock (in practice, it'll already be paused by another thread if we can't get the lock at once though) - do not call prepare_handle_incoming_blocks when we dismissed all the blocks, it only causes cleanup_handle_incoming_blocks to complain afterwards
2017-02-12Merge pull request #1717Riccardo Spagni2-2/+31
8bdc86be protocol: speed up sync by minimizing duplicate work (moneromooo-monero) 61dfa310 epee: fix some log macros not printing context nicely (moneromooo-monero)
2017-02-12protocol: speed up sync by minimizing duplicate workmoneromooo-monero2-2/+31
In particular, the prepare_handle_incoming_blocks call is pretty lengthy, and entirely pointless in the common case where several different connections will prepare the exact same blocks.
2017-02-12cryptonote_protocol: misc fluffy block fixesmoneromooo-monero2-42/+78
- fix wrong block being used when a new block is received between a node elaying a fluffy block and sending a new fluffy block with txes a peer did not have - misc a neverending ping pong requesting the same missing txids when a new block is received in the meantime, causing the top block to not be the one we need - send the original fluffy block message block height when sending a new fluffy block, not the current top height, which might have been updated since - avoid sending back the whole block blob when asking for txes, send only the hash instead - plus misc cleanup and additional debugging logs
2017-02-08extract some basic code from libcryptonote_core into libcryptonote_basickenshi845-6/+8
2017-02-02Merge pull request #1617Riccardo Spagni2-8/+7
0644eed7 Remove boost/foreach.cpp includes (Miguel Herranz) 36dd3e23 Replace BOOST_REVERSE_FOREACH with ranged for (Miguel Herranz) 629e3101 Replace BOOST_FOREACH with C++11 ranged for (Miguel Herranz)
2017-01-23Update log messages to reflect fact we no longer need to type `exit` to save ↵NanoAkron1-5/+2
database before quitting
2017-01-22Remove boost/foreach.cpp includesMiguel Herranz1-1/+0
2017-01-22Replace BOOST_FOREACH with C++11 ranged forMiguel Herranz1-7/+7
2017-01-22protocol: log received messages in a separate categorymoneromooo-monero1-8/+10
Makes it easier to log just what's going on on P2P
2017-01-16fixups in logging init calls, and add missing net context in a logmoneromooo-monero1-1/+1
2017-01-16Change logging to easylogging++moneromooo-monero3-53/+26
This replaces the epee and data_loggers logging systems with a single one, and also adds filename:line and explicit severity levels. Categories may be defined, and logging severity set by category (or set of categories). epee style 0-4 log level maps to a sensible severity configuration. Log files now also rotate when reaching 100 MB. To select which logs to output, use the MONERO_LOGS environment variable, with a comma separated list of categories (globs are supported), with their requested severity level after a colon. If a log matches more than one such setting, the last one in the configuration string applies. A few examples: This one is (mostly) silent, only outputting fatal errors: MONERO_LOGS=*:FATAL This one is very verbose: MONERO_LOGS=*:TRACE This one is totally silent (logwise): MONERO_LOGS="" This one outputs all errors and warnings, except for the "verify" category, which prints just fatal errors (the verify category is used for logs about incoming transactions and blocks, and it is expected that some/many will fail to verify, hence we don't want the spam): MONERO_LOGS=*:WARNING,verify:FATAL Log levels are, in decreasing order of priority: FATAL, ERROR, WARNING, INFO, DEBUG, TRACE Subcategories may be added using prefixes and globs. This example will output net.p2p logs at the TRACE level, but all other net* logs only at INFO: MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE Logs which are intended for the user (which Monero was using a lot through epee, but really isn't a nice way to go things) should use the "global" category. There are a few helper macros for using this category, eg: MGINFO("this shows up by default") or MGINFO_RED("this is red"), to try to keep a similar look and feel for now. Existing epee log macros still exist, and map to the new log levels, but since they're used as a "user facing" UI element as much as a logging system, they often don't map well to log severities (ie, a log level 0 log may be an error, or may be something we want the user to see, such as an important info). In those cases, I tried to use the new macros. In other cases, I left the existing macros in. When modifying logs, it is probably best to switch to the new macros with explicit levels. The --log-level options and set_log commands now also accept category settings, in addition to the epee style log levels.
2017-01-14fix do_not_relay not preventing relaying on a timermoneromooo-monero1-4/+4
Also print its value when printing pool
2016-12-12Improve language of 'node ahead by' messageNanoAkron1-1/+1
2016-12-10Update cryptonote_protocol_handler.inlGingeropolous1-2/+2
Per discussion of #1359, the wording has changed to indicate that no assessment of the blocks validity is made.
2016-12-04Merge pull request #1398Riccardo Spagni1-8/+8
f4772bae Fix a few minor typos (Pierre Boyer)
2016-12-04Merge pull request #1397Riccardo Spagni2-2/+22
3f7d6fb5 Fix delayed exit when syncing (moneromooo-monero)
2016-12-04Fix a few minor typosPierre Boyer1-8/+8
2016-12-04Fix delayed exit when syncingmoneromooo-monero2-2/+22
2016-12-01p2p: possibly fix crash in relay_blocksmoneromooo-monero1-11/+26
2016-11-11Merge pull request #1263Riccardo Spagni3-5/+387
d61bd81 add lightweight block propagation ("fluffy blocks") (Dion Ahmetaj)
2016-11-09add lightweight block propagation ("fluffy blocks")Dion Ahmetaj3-5/+387
Added a new command to the P2P protocol definitions to allow querying for support flags. Implemented handling of new support flags command in net_node. Changed for_each callback template to include support flags. Updated print_connections command to show peer support flags. Added p2p constant for signaling fluffy block support. Added get_pool_transaction function to cryptnote_core. Added new commands to cryptonote protocol for relaying fluffy blocks. Implemented handling of fluffy block command in cryptonote protocol. Enabled fluffy block support in node initial configuration. Implemented get_testnet function in cryptonote_core. Made it so that fluffy blocks only run on testnet.