aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-10-28daemon: always use bootstrap daemon (if set) in '--no-sync' modexiphon1-0/+1
2019-10-25Merge pull request #5357luigi11112-0/+3
b3a9a4d add a quick early out to get_blocks.bin when up to date (moneromooo-monero) 2899379 daemon, wallet: new pay for RPC use system (moneromooo-monero) ffa4602 simplewallet: add public_nodes command (moneromooo-monero)
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-24Merge pull request #5998luigi11111-3/+3
0da09ed protocol: fix syncing from peers being too choosy about peers (moneromooo-monero)
2019-10-22Merge pull request #5981luigi11111-1/+1
88c9d90 protocol: initialize block_weight in block_complete_entry ctor (moneromooo-monero) fe443bb cryptonote: don't leave block_weight uninitialized (moneromooo-monero) 1ba9baf tx_pool: do not divide by 0 (moneromooo-monero)
2019-10-17protocol: fix syncing from peers being too choosy about peersmoneromooo-monero1-3/+3
2019-10-14Merge pull request #5933luigi11112-7/+14
3455efa ban peers sending bad pow outright (moneromooo-monero)
2019-10-11protocol: initialize block_weight in block_complete_entry ctormoneromooo-monero1-1/+1
CID 204479
2019-10-08Merge pull request #5915luigi11115-49/+229
8330e77 monerod can now sync from pruned blocks (moneromooo-monero)
2019-10-08Merge pull request #5926luigi11111-1/+1
74a23e9 protocol: only print sync complete message when out of precompiled hashes (moneromooo-monero)
2019-10-08Merge pull request #5921luigi11112-7/+12
2a7d915 Fixed i2p/tor tx flooding bug (white noise disabled) (vtnerd)
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-24Merge pull request #5905luigi11111-5/+0
Revert a96c1a4 and adc16d2 (moneromooo-monero)
2019-09-24protocol: only print sync complete message when out of precompiled hashesmoneromooo-monero1-1/+1
This avoids most premature triggers
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-29Fixed i2p/tor tx flooding bug (white noise disabled)Lee Clagett2-7/+12
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