Commit graph

212 commits

Author SHA1 Message Date
Javier Smooth
4cea2b13b2 Add IP blocking for misbehaving nodes (adapted from Boolberry)
With minor cleanup and fixes (spelling, indent) by moneromooo
2015-11-23 18:06:20 +00:00
Javier Smooth
9c64b12320 quiet down p2p logging a bit 2015-11-23 17:20:47 +00:00
warptangent
ee27559724
Update to compile with latest miniupnpc
upnpDiscover() takes a new argument for TTL.
Use the suggested default of 2.
2015-10-05 17:07:52 -07:00
warptangent
7424cfc7b8
net_node: Use DNS resolver singleton
Each thread can use the same resolver.
2015-08-14 21:05:43 -07:00
moneromooo-monero
7764cd7006
net_node: skimplify rate limit code, and log as appropriate 2015-08-11 20:32:48 +01:00
NoodleDoodleNoodleDoodleNoodleDoodleNoo
e5d2680094 ** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY)
Bockchain:
1. Optim: Multi-thread long-hash computation when encountering groups of blocks.
2. Optim: Cache verified txs and return result from cache instead of re-checking whenever possible.
3. Optim: Preload output-keys when encoutering groups of blocks. Sort by amount and global-index before bulk querying database and multi-thread when possible.
4. Optim: Disable double spend check on block verification, double spend is already detected when trying to add blocks.
5. Optim: Multi-thread signature computation whenever possible.
6. Patch: Disable locking (recursive mutex) on called functions from check_tx_inputs which causes slowdowns (only seems to happen on ubuntu/VMs??? Reason: TBD)
7. Optim: Removed looped full-tx hash computation when retrieving transactions from pool (???).
8. Optim: Cache difficulty/timestamps (735 blocks) for next-difficulty calculations so that only 2 db reads per new block is needed when a new block arrives (instead of 1470 reads).

Berkeley-DB:
1. Fix: 32-bit data errors causing wrong output global indices and failure to send blocks to peers (etc).
2. Fix: Unable to pop blocks on reorganize due to transaction errors.
3. Patch: Large number of transaction aborts when running multi-threaded bulk queries.
4. Patch: Insufficient locks error when running full sync.
5. Patch: Incorrect db stats when returning from an immediate exit from "pop block" operation.
6. Optim: Add bulk queries to get output global indices.
7. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3)
8. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key
9. Optim: Added thread-safe buffers used when multi-threading bulk queries.
10. Optim: Added support for nosync/write_nosync options for improved performance (*see --db-sync-mode option for details)
11. Mod: Added checkpoint thread and auto-remove-logs option.
12. *Now usable on 32-bit systems like RPI2.

LMDB:
1. Optim: Added custom comparison for 256-bit key tables (minor speed-up, TBD: get actual effect)
2. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3)
3. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key
4. Optim: Added support for sync/writemap options for improved performance (*see --db-sync-mode option for details)
5. Mod: Auto resize to +1GB instead of multiplier x1.5

ETC:
1. Minor optimizations for slow-hash for ARM (RPI2). Incomplete.
2. Fix: 32-bit saturation bug when computing next difficulty on large blocks.

[PENDING ISSUES]
1. Berkely db has a very slow "pop-block" operation. This is very noticeable on the RPI2 as it sometimes takes > 10 MINUTES to pop a block during reorganization.
   This does not happen very often however, most reorgs seem to take a few seconds but it possibly depends on the number of outputs present. TBD.
2. Berkeley db, possible bug "unable to allocate memory". TBD.

[NEW OPTIONS] (*Currently all enabled for testing purposes)
1. --fast-block-sync arg=[0:1] (default: 1)
	a. 0 = Compute long hash per block (may take a while depending on CPU)
	b. 1 = Skip long-hash and verify blocks based on embedded known good block hashes (faster, minimal CPU dependence)
2. --db-sync-mode arg=[[safe|fast|fastest]:[sync|async]:[nblocks_per_sync]] (default: fastest:async:1000)
	a. safe = fdatasync/fsync (or equivalent) per stored block. Very slow, but safest option to protect against power-out/crash conditions.
	b. fast/fastest = Enables asynchronous fdatasync/fsync (or equivalent). Useful for battery operated devices or STABLE systems with UPS and/or systems with battery backed write cache/solid state cache.
	Fast    - Write meta-data but defer data flush.
	Fastest - Defer meta-data and data flush.
	Sync    - Flush data after nblocks_per_sync and wait.
	Async   - Flush data after nblocks_per_sync but do not wait for the operation to finish.
3. --prep-blocks-threads arg=[n] (default: 4 or system max threads, whichever is lower)
        Max number of threads to use when computing long-hash in groups.
4. --show-time-stats arg=[0:1] (default: 1)
	Show benchmark related time stats.
5. --db-auto-remove-logs arg=[0:1] (default: 1)
	For berkeley-db only. Auto remove logs if enabled.

**Note: lmdb and berkeley-db have changes to the tables and are not compatible with official git head version.
	At the moment, you need a full resync to use this optimized version.

[PERFORMANCE COMPARISON]
**Some figures are approximations only.
Using a baseline machine of an i7-2600K+SSD+(with full pow computation):
1. The optimized lmdb/blockhain core can process blocks up to 585K for ~1.25 hours + download time, so it usually takes 2.5 hours to sync the full chain.
2. The current head with memory can process blocks up to 585K for ~4.2 hours + download time, so it usually takes 5.5 hours to sync the full chain.
3. The current head with lmdb can process blocks up to 585K for ~32 hours + download time and usually takes 36 hours to sync the full chain.

Averate procesing times (with full pow computation):
lmdb-optimized:
1. tx_ave = 2.5 ms / tx
2. block_ave = 5.87 ms / block
memory-official-repo:
1. tx_ave = 8.85 ms / tx
2. block_ave = 19.68 ms / block
lmdb-official-repo (0f4a036437)
1. tx_ave = 47.8 ms / tx
2. block_ave = 64.2 ms / block

**Note: The following data denotes processing times only (does not include p2p download time)
lmdb-optimized processing times (with full pow computation):
1. Desktop,  Quad-core / 8-threads 2600k  (8Mb) - 1.25 hours processing time (--db-sync-mode=fastest:async:1000).
2. Laptop,   Dual-core / 4-threads U4200  (3Mb) - 4.90 hours processing time (--db-sync-mode=fastest:async:1000).
3. Embedded, Quad-core / 4-threads Z3735F (2x1Mb) - 12.0 hours processing time (--db-sync-mode=fastest:async:1000).

lmdb-optimized processing times (with per-block-checkpoint)
1. Desktop,  Quad-core / 8-threads 2600k  (8Mb) - 10 minutes processing time (--db-sync-mode=fastest:async:1000).

berkeley-db optimized processing times (with full pow computation)
1. Desktop, Quad-core / 8-threads 2600k  (8Mb) - 1.8 hours processing time (--db-sync-mode=fastest:async:1000).
2. RPI2. Improved from estimated 3 months(???) into 2.5 days (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).

berkeley-db optimized processing times (with per-block-checkpoint)
1. RPI2. 12-15 hours (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).
2015-07-15 23:20:16 -07:00
Thomas Winget
d7df08d6ec
properly decrement p2p socket count 2015-06-06 13:24:33 -04:00
Riccardo Spagni
e01d32e52d
cleaning up, removing redundant files, renaming, fixing incorrect licenses 2015-05-31 13:40:18 +02:00
moneromooo-monero
39a9508a20
net_peerlist: fix grayt/white naming mismatch
Looking at how these are called confirms this must have been a mistake
2015-05-28 14:10:26 +01:00
Riccardo Spagni
8cd6072090
Merge pull request #292
c44755a Build seed node list without duplicates (warptangent)
2015-05-26 10:45:20 +02:00
warptangent
696225321f
Fix compile for GCC 5.1.0
Add fix for compile error with multiple uses of peerid_type (uint64_t)
variable in lambda expression.
- known GCC issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65843

epee: replace return value of nullptr for expected boolean with false.

Fixes #231.
2015-05-25 22:18:36 -07:00
warptangent
c44755a5e2
Build seed node list without duplicates
The random selection of a node shouldn't favor repeats that occur in the
hardcoded and DNS seed node lists.

Remove hardcoded ":18080" address which gives parse error.

Test: bitmonerod --log-level 2

The seed node list displayed at startup shouldn't show duplicate
addresses (includes port).
2015-05-25 22:11:44 -07:00
moneromooo-monero
f278fe3883
s/terget/target/ 2015-05-17 13:16:44 +01:00
moneromooo-monero
d8ee0a95c7
print limits when running limit commands with no arguments
It's more user friendly that an error message saying the command
does not exist.
2015-05-17 13:15:09 +01:00
Sergey Kazenyuk
867e98d739 Merge branch 'clang_fixes' into clang_fixes-master 2015-05-06 19:10:51 +03:00
Sergey Kazenyuk
2ff0d757eb Fix missing virtual destructor 2015-04-20 20:17:11 +03:00
rfree2monero
9bfa593eee [fix] Network 1.8: unlimited the RPC connections
works for unit tests build, too
2015-04-08 19:54:07 +02:00
Riccardo Spagni
6f0d93097e
Merge pull request #252
618f20c Network 1.7; Quieted the debug a bit. (rfree2monero)
391c7f9 Utils: use const, document dbg. Less default debug (rfree2monero)
44f4234 [fix] mac os x includes std::random... (rfree2monero)
162c993 Network 1.6: network limits, logging, +doxy (rfree2monero)
a3b2226 my changelog (rfree2monero)
2900b1e doxygen files (rfree2monero)
1489310 doxygen related tool (rfree2monero)
f9dba47 added windows_stream.* console colors (rfree2monero)
c511abf remerged; commands JSON. logging upgrade. doxygen (rfree2monero)
f79821a fix locking in count-peers thread (2) (rfree2monero)
0198ffb 2014 network limit 1.3 fix log/path/data +utils (rfree2monero)
ae2a506 2014 network limit 1.2 +utils +toc -doc -drmonero (rfree2monero)
0f06dca fixed size_t on windows (rfree2monero)
39fc63f removed not needed <netinet/in.h> (rfree2monero)
5ce4256 2014 network limit 1.1 +utils +toc -doc -drmonero (rfree2monero)
eabb519 2014 network limit 1.0a +utils +toc -doc -drmonero (rfree2monero)
2015-04-02 17:43:43 +02:00
rfree2monero
618f20ce49 Network 1.7; Quieted the debug a bit.
Really really finall version of this changes I hope.
2015-04-02 16:27:19 +02:00
Riccardo Spagni
0823c98bbc
update hardcoded fallback seeds 2015-04-02 11:28:20 +02:00
rfree2monero
c511abf005 remerged; commands JSON. logging upgrade. doxygen 2015-04-01 19:00:45 +02:00
rfree2monero
3cbdf198f1 Merge remote-tracking branch 'monero-official/master' into network-1.6-work1 2015-04-01 18:24:45 +02:00
rfree2monero
f79821ac7e fix locking in count-peers thread (2) 2015-02-24 21:06:02 +01:00
rfree2monero
0198ffb220 2014 network limit 1.3 fix log/path/data +utils
+toc -doc -drmonero

Fixed the windows path, and improved logging and data
(for graph) logging, fixed some locks and added more checks.

Still there is a locking error,
not added by my patches, but present in master version
(locking of map/list of peers).
2015-02-24 20:12:56 +01:00
Thomas Winget
9193d6fb5b
Daemonize changes pulled in -- daemon builds
many RPC functions added by the daemonize changes
(and related changes on the upstream dev branch that were not merged)
were commented out (apart from return).  Other than that, this *should*
work...at any rate, it builds, and that's something.
2015-02-24 00:05:19 -05:00
rfree2monero
ae2a50659f 2014 network limit 1.2 +utils +toc -doc -drmonero
new update of the pr with network limits

more debug options:
discarding downloaded blocks all or after given height.
trying to trigger the locking errors.

debug levels polished/tuned to sane values.
debug/logging improved.

warning: this pr should be correct code, but it could make
an existing (in master version) locking error appear more often.

it's a race on the list (map) of peers, e.g. between closing/deleting
them versus working on them in net-limit sleep in sending chunk.

the bug is not in this code/this pr, but in the master version.

the locking problem of master will be fixed in other pr.

problem is ub, and in practice is seems to usually cause program abort
(tested on debian stable with updated gcc). see --help for option
to add sleep to trigger the error faster.
2015-02-20 22:28:03 +01:00
rfree2monero
5ce4256e3d 2014 network limit 1.1 +utils +toc -doc -drmonero
Update of the PR with network limits

works very well for all speeds
(but remember that low download speed can stop upload
because we then slow down downloading of blockchain
requests too)

more debug options

fixed pedantic warnings in our code
should work again on Mac OS X and FreeBSD
fixed warning about size_t
tested on Debian, Ubuntu, Windows(testing now)

TCP options and ToS (QoS) flag
FIXED peer number limit
FIXED some spikes in ingress/download
FIXED problems when other up and down limit
2015-02-20 22:13:00 +01:00
rfree2monero
eabb519605 2014 network limit 1.0a +utils +toc -doc -drmonero
commands and options for network limiting
works very well e.g. for 50 KiB/sec up and down
ToS (QoS) flag
peer number limit
TODO some spikes in ingress/download
TODO problems when other up and down limit
added "otshell utils" - simple logging (with colors, text files channels)
2015-02-20 22:13:00 +01:00
warptangent
f74792b778
Fix seed node threaded DNS lookup
Use copied value of seed node index during thread creation, not
reference.
- fixes segfault

Use boost:🧵:try_join_until() instead of an atomic flag result
variable for each thread.

Add and handle interrupt for thread timeout.
- fixes segfault where a thread exceeds requested timeout and tries to
  assign results to a referenced, but now out-of-scope, variable in
  the main thread.
2015-01-14 14:01:04 -08:00
Riccardo Spagni
24ddfa792e
Merge pull request #206
1b46226 std::atomic_flag has no copy/move constructor, can't have a vector (Thomas Winget)
df53c0a small typo in previous commit (Thomas Winget)
4a53898 DNS seed timeout and fallback (Thomas Winget)
2015-01-08 12:18:00 +02:00
Riccardo Spagni
f4b69d553a
year updated in license 2015-01-02 18:52:46 +02:00
Thomas Winget
1b462261b8
std::atomic_flag has no copy/move constructor, can't have a vector 2014-12-15 17:43:12 -05:00
Thomas Winget
df53c0a595
small typo in previous commit 2014-12-15 17:28:11 -05:00
Thomas Winget
4a53898764
DNS seed timeout and fallback 2014-12-15 17:23:42 -05:00
Riccardo Spagni
18281f4d20 remove dangling upnp port mappings, updated miniupnpc 2014-10-02 18:54:55 +02:00
Thomas Winget
30caebfce3 reload checkpoints file every ~hr and print if any fail
also some other minor bug squashing and code formatting
2014-09-30 16:21:37 -04:00
Riccardo Spagni
d1a7f699c6
use boost::asio::ip::address because cross-platform plz 2014-09-24 14:45:54 +02:00
Thomas Winget
3fb0fc020f seed node DNS code updated to use DNSResolver
Also implemented rudimentary IPv6 support, but commented it out because
it's not widely supported by ISPs for now, and thus is not currently
supported by Monero.
2014-09-23 22:58:17 +02:00
Thomas Winget
578050e91d ipv4 and ipv6 resolution working
IPv4 and IPv6 name resolution working.
Unit tests written (and passing).
net_node.{h,inl} code modified to use DNS seeds.
2014-09-23 22:58:07 +02:00
Zachary Michaels
9db881864d Fix time_t serialization issue
On 32-bit MinGW-w64, time_t is int32_t.  The existing code was serializing
time_t directly and implicitly assuming that time_t is int64_t.  This commit
formalizes that assumption by serializing int64_t directly and casting to
time_t where appropriate.

Thanks go to greatwolf for reporting this issue.

monero-project/bitmonero#88
2014-09-15 22:38:46 +02:00
Zachary Michaels
120c84d04f Make P2P use the testnet data dir 2014-09-15 15:55:07 +02:00
Zachary Michaels
23525655fa Replace macro with equivalent function call
Also removed useless bool return
2014-09-15 15:55:07 +02:00
Zachary Michaels
ee1bacc64f Add testnet seed nodes 2014-09-15 15:54:24 +02:00
Zachary Michaels
257077a96b Separate network id for testnet 2014-09-15 15:53:50 +02:00
Zachary Michaels
98ed9a41f7 Separate p2p port for testnet 2014-09-15 15:53:10 +02:00
Zachary Michaels
fb4146fa34 Reorganize testnet constants 2014-09-15 15:53:10 +02:00
Zachary Michaels
07470fd400
Add testnet flag
Source: cryptonotefoundation
2014-09-15 15:53:01 +02:00
Riccardo Spagni
8334ce0b24 versioning now includes the commit hash, or -final for tagged releases 2014-09-12 13:12:43 +02:00
fluffypony
8d8b47e69f more dynamic miniupnp fixes 2014-09-10 20:01:30 +02:00
fluffypony
59c0423eae miniupnpc includes fixed 2014-09-10 18:22:20 +02:00
fluffypony
cf5a8b1d6c moved non-critical warnings and errors to log level 1 2014-09-09 11:32:00 +02:00
fluffypony
6fc995fe5d License updated to BSD 3-clause 2014-07-23 15:03:52 +02:00
Zachary Michaels
17f0967472 Allow priority peers when there are exclusive peers
Per my reading this change makes sense since a subset of the exclusive
peers could be priority peers.  Priority peers that are not exclusive
will not get loaded, and priority peers that *are* exclusive will get
special treatment.  Prior to this change it looks like priority peers
were silently ignored when exclusive peers were provided.
2014-07-01 14:57:26 -04:00
fluffypony
8e0f20f771 added new seed nodes 2014-06-10 17:29:37 +02:00
mydesktop
3a3a817678 0.8.8update 2014-05-25 13:06:40 -04:00
mydesktop
79a4bedc36 mac osx building fixes 2014-04-30 16:50:06 -04:00
mydesktop
67df296650 various fixes to allow mac osx compilation 2014-04-30 13:52:21 -04:00
thankful_for_today
7b582fec55 2nd seed node added 2014-04-30 14:33:18 +04:00
thankful_for_today
1a8f5ce89a Bitmonero release 2014-04-18 01:21:40 +04:00
Antonio Juarez
9682a15400 Port mapping with UPnP 2014-04-09 13:14:35 +01:00
Antonio Juarez
8efa1313f3 some fixes 2014-03-20 11:46:11 +00:00
Antonio Juarez
296ae46ed8 moved all stuff to github 2014-03-03 22:07:58 +00:00