aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2020-10-12Dandelion++: skip desynced peers in stem phasexiphon3-21/+27
2020-08-10cryptonote_protocol: don't synced pruned blocks before v11cohcho1-2/+2
There are a few Borromean proofs txes in the v8 era, and these aren't supported by get_pruned_transaction_weight. Moreover, only only the most recent variant of bulletproofs is currently supported.
2020-07-24Wallet, daemon: From 'help_advanced' back to 'help', and new 'apropos' commandrbrunner71-2/+1
2020-05-19protocol: move the "peer claims higher version" warning to debugmoneromooo-monero1-2/+2
Because there's a neverending supply of cunts claiming a wrong version just to say "look at me" I guess
2020-05-19cryptonote_protocol: stricter limit to number of objects requestedmoneromooo-monero1-1/+2
Reported by xnbya
2020-05-19cryptonote_protocol: reject requests/notifications before handshakemoneromooo-monero1-0/+20
Reported by xnbya
2020-05-16protocol: don't drop a connection if we can't get a compatible chainmoneromooo-monero1-1/+0
This can now happen if: - we have a pruned db - we have not connected to the monero network for a while - we connect to a node - that node asks us for history - we only have a pruned version of the most recent common block In that case, it's better to not reply but keep the connection alive, so we can sync off it.
2020-05-15Add randomized delay when forwarding txes from i2p/tor -> ipv4/6Lee Clagett3-9/+28
2020-05-06Update copyright year to 2020SomaticFanatic12-12/+12
Update copyright year to 2020
2020-05-06cryptonote_protocol: do not request pruned borromean sig txesmoneromooo-monero1-1/+6
We don't have a function to calculate their weight from a pruned version (yet).
2020-03-26Adding Dandelion++ support to public networks:Lee Clagett7-69/+216
- New flag in NOTIFY_NEW_TRANSACTION to indicate stem mode - Stem loops detected in tx_pool.cpp - Embargo timeout for a blackhole attack during stem phase
2020-03-22protocol: request txpool contents when syncedmoneromooo-monero3-0/+90
A newly synced Alice sends a (typically quite small) list of txids in the local tpxool to a random peer Bob, who then uses the existing tx relay system to send Alice any tx in his txpool which is not in the list Alice sent
2020-03-21Daemon: Print estimates for time until fully syncedrbrunner72-3/+91
2020-03-20p2p: remove old debug commandsAaron Hook2-9/+0
2020-03-10Fix receive order leakage with tx fluffingLee Clagett1-0/+3
2020-03-07Added logging for dropped local txes with no i2p/tor connectionsLee Clagett1-4/+17
2020-01-26cryptonote_protocol: omit top 64 bits of difficulty when 0moneromooo-monero1-2/+8
2020-01-26network: log traffic and add a simple traffic analysis scriptmoneromooo-monero1-0/+16
2020-01-10Daemon: Guard against reporting "synchronized" too earlyrbrunner71-1/+1
The added condition "hshd.current_height >= target" guards against reporting "synchronized" too early in the special situation that the very first peer sending us data is synced to a lower height than ourselves.
2019-12-14Corrected message typopalomato1-1/+1
Message was "peer claims higher version that we think" Requested change "peer claims higher version than we think"
2019-12-05Fix time comparison mathJason Rhinelander1-2/+2
Dividing `dt` here by 1e6 converts it to seconds, but that is clearly wrong since `REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY` is measured in microseconds. As a result, this if statement was effectively never used.
2019-11-13simplewallet: noob-friendly help menuwowario1-1/+2
2019-11-04Change to Tx diffusion (Dandelion++ fluff) instead of floodingLee Clagett4-49/+161
2019-11-02Adding support for hidden (anonymity) txpoolLee Clagett6-25/+101
2019-10-30daemon: always use bootstrap daemon (if set) in '--no-sync' modexiphon1-0/+1
2019-10-29always print peer IDs in the same formatmoneromooo-monero1-4/+2
2019-10-28daemon: always use bootstrap daemon (if set) in '--no-sync' modexiphon1-0/+1
2019-10-25daemon, wallet: new pay for RPC use systemmoneromooo-monero2-0/+3
Daemons intended for public use can be set up to require payment in the form of hashes in exchange for RPC service. This enables public daemons to receive payment for their work over a large number of calls. This system behaves similarly to a pool, so payment takes the form of valid blocks every so often, yielding a large one off payment, rather than constant micropayments. This system can also be used by third parties as a "paywall" layer, where users of a service can pay for use by mining Monero to the service provider's address. An example of this for web site access is Primo, a Monero mining based website "paywall": https://github.com/selene-kovri/primo This has some advantages: - incentive to run a node providing RPC services, thereby promoting the availability of third party nodes for those who can't run their own - incentive to run your own node instead of using a third party's, thereby promoting decentralization - decentralized: payment is done between a client and server, with no third party needed - private: since the system is "pay as you go", you don't need to identify yourself to claim a long lived balance - no payment occurs on the blockchain, so there is no extra transactional load - one may mine with a beefy server, and use those credits from a phone, by reusing the client ID (at the cost of some privacy) - no barrier to entry: anyone may run a RPC node, and your expected revenue depends on how much work you do - Sybil resistant: if you run 1000 idle RPC nodes, you don't magically get more revenue - no large credit balance maintained on servers, so they have no incentive to exit scam - you can use any/many node(s), since there's little cost in switching servers - market based prices: competition between servers to lower costs - incentive for a distributed third party node system: if some public nodes are overused/slow, traffic can move to others - increases network security - helps counteract mining pools' share of the network hash rate - zero incentive for a payer to "double spend" since a reorg does not give any money back to the miner And some disadvantages: - low power clients will have difficulty mining (but one can optionally mine in advance and/or with a faster machine) - payment is "random", so a server might go a long time without a block before getting one - a public node's overall expected payment may be small Public nodes are expected to compete to find a suitable level for cost of service. The daemon can be set up this way to require payment for RPC services: monerod --rpc-payment-address 4xxxxxx \ --rpc-payment-credits 250 --rpc-payment-difficulty 1000 These values are an example only. The --rpc-payment-difficulty switch selects how hard each "share" should be, similar to a mining pool. The higher the difficulty, the fewer shares a client will find. The --rpc-payment-credits switch selects how many credits are awarded for each share a client finds. Considering both options, clients will be awarded credits/difficulty credits for every hash they calculate. For example, in the command line above, 0.25 credits per hash. A client mining at 100 H/s will therefore get an average of 25 credits per second. For reference, in the current implementation, a credit is enough to sync 20 blocks, so a 100 H/s client that's just starting to use Monero and uses this daemon will be able to sync 500 blocks per second. The wallet can be set to automatically mine if connected to a daemon which requires payment for RPC usage. It will try to keep a balance of 50000 credits, stopping mining when it's at this level, and starting again as credits are spent. With the example above, a new client will mine this much credits in about half an hour, and this target is enough to sync 500000 blocks (currently about a third of the monero blockchain). There are three new settings in the wallet: - credits-target: this is the amount of credits a wallet will try to reach before stopping mining. The default of 0 means 50000 credits. - auto-mine-for-rpc-payment-threshold: this controls the minimum credit rate which the wallet considers worth mining for. If the daemon credits less than this ratio, the wallet will consider mining to be not worth it. In the example above, the rate is 0.25 - persistent-rpc-client-id: if set, this allows the wallet to reuse a client id across runs. This means a public node can tell a wallet that's connecting is the same as one that connected previously, but allows a wallet to keep their credit balance from one run to the other. Since the wallet only mines to keep a small credit balance, this is not normally worth doing. However, someone may want to mine on a fast server, and use that credit balance on a low power device such as a phone. If left unset, a new client ID is generated at each wallet start, for privacy reasons. To mine and use a credit balance on two different devices, you can use the --rpc-client-secret-key switch. A wallet's client secret key can be found using the new rpc_payments command in the wallet. Note: anyone knowing your RPC client secret key is able to use your credit balance. The wallet has a few new commands too: - start_mining_for_rpc: start mining to acquire more credits, regardless of the auto mining settings - stop_mining_for_rpc: stop mining to acquire more credits - rpc_payments: display information about current credits with the currently selected daemon The node has an extra command: - rpc_payments: display information about clients and their balances The node will forget about any balance for clients which have been inactive for 6 months. Balances carry over on node restart.
2019-10-17protocol: fix syncing from peers being too choosy about peersmoneromooo-monero1-3/+3
2019-10-11protocol: initialize block_weight in block_complete_entry ctormoneromooo-monero1-1/+1
CID 204479
2019-09-27monerod can now sync from pruned blocksmoneromooo-monero5-49/+229
If the peer (whether pruned or not itself) supports sending pruned blocks to syncing nodes, the pruned version will be sent along with the hash of the pruned data and the block weight. The original tx hashes can be reconstructed from the pruned txes and theur prunable data hash. Those hashes and the block weights are hashes and checked against the set of precompiled hashes, ensuring the data we received is the original data. It is currently not possible to use this system when not using the set of precompiled hashes, since block weights can not otherwise be checked for validity. This is off by default for now, and is enabled by --sync-pruned-blocks
2019-09-25ban peers sending bad pow outrightmoneromooo-monero2-7/+14
PoW is expensive to verify, so be strict
2019-09-24protocol: only print sync complete message when out of precompiled hashesmoneromooo-monero1-1/+1
This avoids most premature triggers
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-02Changed the use of boost:value_initialized for C++ list initializerJesus Ramirez1-8/+8
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-08-11cryptonote_protocol: fix '--no-sync', ignore new blocks and txesxiphon1-3/+3
2019-07-29Fixed i2p/tor tx flooding bug (white noise disabled)Lee Clagett2-7/+12
2019-07-17Added support for "noise" over I1P/Tor to mask Tx transmission.Lee Clagett3-61/+709
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-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-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-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-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.
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-07protocol: change standby mode to not wait sleepingmoneromooo-monero2-12/+24
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-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-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-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-05Correct spelling mistakes.Edward Betts2-2/+2
2018-03-05Stagenetstoffu1-1/+1
2018-02-02cryptonote_protocol: guard against all threads in standbymoneromooo-monero1-0/+9
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-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.
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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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.
2016-11-09cryptonote_protocol: drop connection when find_blockchain_supplement failsmoneromooo-monero1-0/+1
This will be when we can't find common ground between the peer's short chain history and our blockchain. This fixes bad peers claiming a higher blockchain height from never dropped, and keeping the node in synchronizing state forever, since we will never get blocks from that peer.
2016-10-23core: notify the txpool when transactions are relayedmoneromooo-monero1-0/+3
2016-10-03Moved logging to target functions rather than callerNanoAkron1-2/+0
2016-09-27Update CMakeLists.txtcodehalo1-1/+0
2016-09-27Update CMakeLists.txtcodehalo1-1/+1
2016-09-27Update CMakeLists.txtcodehalo1-11/+6
2016-09-26Cleanup. Dropped "bit" from bitmonero.Randi Joseph1-3/+3
2016-09-26Dropped "bit" from bitmonero.Randi Joseph1-3/+3
2016-09-25Revert "Fix fake 'network synchronized, begin using' messages"moneromooo-monero1-1/+1
This reverts commit 78035d2b6c9922f4cd730df0766aa74f4854ccb2. The patch doesn't work, and causes constant SYNCHRONIZED OK spam.
2016-09-24core: make the sync chunk block count overridablemoneromooo-monero1-2/+2
2016-09-18cmake: transitive deps and remove deprecated LINK_*redfish1-10/+4
Keep the immediate direct deps at the library that depends on them, declare deps as PUBLIC so that targets that link against that library get the library's deps as transitive deps. Break dep cycle between blockchain_db <-> crytonote_core. No code refactoring, just hide cycle from cmake so that it doesn't complain (cycles are allowed only between static libs, not shared libs). This is in preparation for supproting BUILD_SHARED_LIBS cmake built-in option for building internal libs as shared.
2016-09-03fix remaining bitmonero and simplewallet bitsRiccardo Spagni1-1/+1
2016-08-30Show correct amount of days behind/ahead while syncingtobiasw21-1/+4
2016-08-23Fix fake 'network synchronized, begin using' messagesThomas Winget1-1/+1
2016-03-21Revert "Print stack trace upon exceptions"moneromooo-monero1-1/+0
Ain't nobody got time for link/cmake skullduggery. This reverts commit fff238ec94ac6d45fc18c315d7bc590ddfaad63d.
2016-03-20cryptonote_protocol: clarify height wordingmoneromooo-monero1-1/+1
It's logging the blockchain height, not the top block height
2016-03-19Print stack trace upon exceptionsmoneromooo-monero1-0/+1
Useful for debugging users' logs
2016-03-11Use boost::thread instead of std::threadHoward Chu1-1/+1
and all other associated IPC
2016-01-29Fix V1/V2 use of hard fork related parametersmoneromooo-monero1-1/+1
Some of it uses hardcoded height, which will need some thinking for next (voted upon) fork.
2015-12-31updated copyright yearRiccardo Spagni7-7/+7
2015-12-17move another non user useful log to L1moneromooo-monero1-1/+1
2015-12-15Replace tabs with two spaces for consistency with rest of codebasewarptangent1-278/+277
Remove trailing whitespace in same files.
2015-12-14Tone down L0 logs during daemon sync some moremoneromooo-monero2-3/+3
2015-12-14Tone down a bit L0 logs during daemon syncmoneromooo-monero1-2/+10
2015-11-23Add IP blocking for misbehaving nodes (adapted from Boolberry)Javier Smooth1-0/+4
With minor cleanup and fixes (spelling, indent) by moneromooo