Commit Graph

269 Commits

Author SHA1 Message Date
Ignotus Peverell 7284cfec72 Changed magic number and seeds for Floonet (#2188)
* Changed magic number and seeds for Floonet.
* Genesis generator now loads a local wallet seed to build coinbase.
2018-12-20 11:08:01 -08:00
Antioch Peverell 2d4538c428 Clean shutdown via stop_state (#2117)
* clean shutdown wip

* rustfmt

* introduce StopState that we can lock on

* rustfmt

* take lock on stop_state during critical processing (process_block_single etc.)

* rustfmt

* take lock on stop_state during chain::init()

* cleanup

* cleanup

* rustfmt

* docs/comments

* fixup servers tests

* cleanup p2p tests
2018-12-11 11:07:41 +00:00
hashmap aedac483f5 Convert to Rust 2018 edition (#2084)
* Convert to Rust 2018 edition

* Update gitignore
2018-12-08 00:59:40 +01:00
hashmap a6bb6344ac Fix seed thread crash (#2096)
We get overflow in some tests, peraps in real life too
Fixes #2095
2018-12-07 17:09:26 +01:00
Ignotus Peverell 87bfd9aaa4 Mark all crates as publishable 2018-12-07 00:08:15 +00:00
Antioch Peverell a3523028dc Sync headers slice (#2085)
* pass slices of headers around, not vec of headers

* rustfmt
2018-12-05 16:50:32 +00:00
Antioch Peverell 7b07fe99a7 bump 0.4.1 -> 0.4.2 so we can watch the HF (#2057) 2018-11-30 11:20:12 +00:00
antiochp f7608f5b9c rustfmt 2018-11-16 14:34:05 +00:00
antiochp 4b48eebdfe refactor some p2p to use Read/Write over TcpStream 2018-11-16 14:33:35 +00:00
Antioch Peverell f0fa410273 Streaming headers (#1989)
* headers msg is now "streamed" off the tcp stream

* rustfmt

* cleanup

* move StreamingReader into ser.rs
extract read_exact out into util crate

* rustfmt
2018-11-16 11:00:39 +00:00
Antioch Peverell cb652e7ef1 do not treat txhashset.zip download as abusive behavior (#1973)
* do not treat txhashset.zip download as abusive behavior

* count times, not bytes so we exclude quiet increments

* use inc_quiet when tracking sent bytes via an attachment

* add comment

* fixup "quiet" counter entries

* rustfmt
2018-11-13 21:34:45 +00:00
Antioch Peverell 01900f2e4d Enable TX_KERNEL_HASH capability by default (#1971) 2018-11-13 09:28:36 -08:00
Antioch Peverell 236fe56f60 ask for peers with PEER_LIST capability when asking for more peers (#1969)
do not simply look for peers with the same capabilities we have
2018-11-13 10:59:33 +00:00
Antioch Peverell c631b45ab6 cleanup how we deal with flexible rproof size in ser/deser (#1965) 2018-11-13 09:30:40 +00:00
Antioch Peverell a3c1c6d603 Do not use mem::size_of() when calculating serialized size of data (#1967)
* use FixedLength to define serialized size in bytes of various structs
replace usages of mem::size_of() with ::LEN so we correctly calculate serialized sizes in bytes

* rustfmt
2018-11-13 09:30:02 +00:00
Gary Yu 7ff1ee5fde Peer send receive bytes statistics missed response messages and attachment (#1953)
* fix: peer send receive bytes statistics missed response message and attachment

* rustfmt
2018-11-11 07:30:57 +08:00
Gary Yu 2352275dff Suppress some peers logs by trace level instead of debug (#1952)
* suppress some peers boring logs by trace instead of debug

* rustfmt
2018-11-11 07:30:14 +08:00
Gary Yu 9af9ca9518 refactor the state_sync to handle the long fork (#1902)
* split horizon into two explicit values for cut through and txhashset request

* let node which has 2-7 days of history be able to handle forks larger than 2 days

* add test simulate_long_fork

* add pause/resume feature on p2p for tests

* refactor the state_sync

* ignore the test case simulate_long_fork for normal Travis-CI

* refactor function check_txhashset_needed to be shared with body_sync

* fix: state TxHashsetDone should allow header sync
2018-11-10 11:27:52 +08:00
Antioch Peverell 39ebb33ba1 bump 0.4.0 -> 0.4.1 (tx kernel broadcast support) (#1950) 2018-11-09 14:57:25 +00:00
Ignotus Peverell f7d0fe1840 Bug fix, tuning of peer message rate counting 2018-11-07 22:15:12 +00:00
Antioch Peverell ab30f714fc Capabilities now deserialize safely (#1946)
* deserialize capabilities dropping unknown flag bits

* add tests for capabilities deserialization

* rustfmt

* FULL_NODE needs to be handled safely for legacy nodes
2018-11-07 11:15:37 +00:00
Antioch Peverell e25a3b9d72 Fix capabilities (#1944)
* we cannot safely update nodes to use capabilities bits = 15 ...

* rustfmt
2018-11-07 10:00:42 +00:00
Antioch Peverell 949f75c77c fix the lock on the new mutex (#1942) 2018-11-07 09:40:39 +00:00
Antioch Peverell d97a6c2189 [DNM] broadcast tx kernel hash (if supported by peer) (#1929)
broadcast tx kernel hash (if supported by peer)
2018-11-07 09:28:17 +00:00
Ignotus Peverell 8b546632fe Peer rate limiting (#1933)
* Rate counter in peer conn to monitor traffic 
* Ban peers that trigger is_abusive
2018-11-06 17:51:22 -08:00
hashmap d2088ff48c Fix recently introduced peer deadlock (#1941) 2018-11-06 16:42:36 -08:00
hashmap 8742c334dd Remove unsafe sync/send impl for Peers (#1938)
This is really unsafe. Fixes #1937

* Switch to better mutex
2018-11-06 08:59:46 -08:00
hashmap 0af1f13bf9 Fix IPV6 address deserialization (#1932)
Fuzz test found that we don't read IPV6 addr (as part of p2p message)
properly. The code is supposed to read 8 dwords, but [0..8] is not a
slice of 8 ints, but a slice of one Range, so we always read just one
dword
2018-11-05 20:38:41 -08:00
hashmap 109a426990 Add fuzz tests for p2p crate (#1931)
Add fuzz tests for p2p crate
2018-11-05 21:50:16 +01:00
hashmap b01fcd2f56 Remove unused unsafe declarations (#1901) 2018-10-31 13:19:28 -07:00
Ignotus Peverell 46051ee174 improve minimum difficulty handling (#1791)
* rename MIN_DIFFICULTY to UNIT_DIFFICULTY; define Difficulty::unit, fix INITIAL_DIFFICULTY
* improve minimum difficulty handling
* replace all Difficulty::one by ::min
* revert secondary scaling default in HeaderInfo; rename scaling_difficulty; refactor difficulty_data_to_vector
2018-10-27 10:37:44 -07:00
Ignotus Peverell c083312ad4 Improve crate descriptors to be more cargo-friendly (#1844)
* Update secp dependency to use crates.io version
* Add more details to various Cargo.toml
* Remove use of env variables that aren't reliably provided by cargo
2018-10-25 17:44:50 -07:00
Ignotus Peverell a42d66efff Merge branch 'master' into unitdiff 2018-10-25 14:20:41 -07:00
eupn 711fad6c24 Remove TODO for counting of bytes that was already done (#1838) 2018-10-25 15:57:53 +02:00
Antioch Peverell 38cbd6eafb full node == fast sync (no full archival guarantees) (#1809)
* wip - fast sync only

* wip

* cleanup

* cleanup

* cleanup comments in default config file around capabilities

* fixup p2p tests
2018-10-23 13:01:19 +01:00
Ignotus Peverell 7f60e2076d Default last connected to migrate older db (#1812)
Fixes backward compatibility issue with #1794
2018-10-22 18:15:10 -07:00
eupn 8f42f7306c feat: remove expired peers from the storage (#1794)
* Initial expired peers removal
* Stop expired peers
* Simplify peer removal and remove only Defunct peers
* Make seed to check for expired peers every hour
* Get rid of unused vector of peers to remove
* Make peer deletion predicate closure immutable
2018-10-22 13:59:40 -07:00
eupn 1195071f5b Replace logging backend to log4rs and add log rotation (#1789)
* Replace logging backend to flexi-logger and add log rotation
* Changed flexi_logger to log4rs
* Disable logging level filtering in Root logger
* Support different logging levels for file and stdout
* Don't log messages from modules other than Grin-related
* Fix formatting
* Place backed up compressed log copies into log file directory
* Increase default log file size to 16 MiB
* Add comment to config file on log_max_size option
2018-10-21 13:30:56 -07:00
Gary Yu 0d06561a91 replace stdlib RwLock and Mutex with parking_lot (#1793)
* replace all stdlib RwLock with parking_lot RwLock

* replace stdlib Mutex with parking_lot Mutex

* rustfmt
2018-10-20 08:13:07 +08:00
John Tromp 846b38308c replace all Difficulty::one by ::min 2018-10-18 21:18:16 +02:00
yeastplume f94ede9af3 merge T4 into master 2018-10-18 11:23:04 +01:00
Gary Yu 53b10a083c kick stuck peer out of connected peers. (#1782)
* cherry-picking commit 7754adb8 from master for #1746
2018-10-18 10:04:05 +08:00
Ignotus Peverell b5cb227322 Last genesis for T4, unless I messed up something 2018-10-17 19:36:12 +00:00
eupn b22fb55245 feat: add peers used bandwidth calculation and display in TUI (#1770)
* Add peers used bandwidth calculation and display in TUI
* Fix formatting
* Change Mutex to RwLock from peer's used bandwidth statistics in Tracker
* Make used bandwidth column in TUI peers list sort by sum of bytes
2018-10-17 10:01:42 -07:00
Yeastplume b43d6e4326 [T4] Set genesis block data + initial secondary scaling correctly (#1776)
* ensure genesis block+pre genesis is populated correctly with secondary scaling

* rustfmt
2018-10-17 16:53:31 +01:00
Yeastplume 5cec885ef5 [T4] diff change (#1769)
* pre-t4 again

* rustfmt
2018-10-17 13:48:18 +01:00
Yeastplume 404165a8fd [T4] Add sec pow info to TUI, change magic number, genesis diff to 1 (temporarily) (#1768)
* add sec scaling stats to tui

* rustfmt
2018-10-17 10:37:28 +01:00
hashmap 85433c659d Introduce a constant for peer send channel capacity (#1761)
We implicitly use it also in body_sync, so it's hard to keep it in sync.
2018-10-16 16:31:00 -07:00
Gary Yu 7754adb834 kick stuck peer out of connected peers (#1746)
* kick stuck peer out of connected peers
* adjust kick time to 2 hours
* stuck detection take into account own difficulty compare
2018-10-16 09:14:16 -07:00
yeastplume 4bb31dbdb4 update new genesis block, change p2p msg magic number 2018-10-16 10:16:54 +01:00