Commit graph

322 commits

Author SHA1 Message Date
hashmap
224a315dd1
Allow to peers behind NAT to get up to preferred_max connections (#2543)
Allow to peers behind NAT to get up to preffered_max connections

If peer has only outbound connections it's mot likely behind NAT and we should not stop it from getting more outbound connections
2019-02-25 16:29:37 +01:00
Ignotus Peverell
8e2b0c7bc8
Bump version to 1.0.2 (#2623) 2019-02-24 21:57:56 -08:00
Antioch Peverell
48b7421d1e
use fs2 advisory file lock on startup (#2600) 2019-02-19 13:23:12 +00:00
Antioch Peverell
23cb9e2514
Map peers by ip only (ignoring port unless on loopback ip) (#2540)
* wip

* big refactor, regretting doing this now

* PeerAddr everywhere

* cleanup

* fixup server tests

* peers api working for GET, POST is still WIP

* we can now ban/unban peers by ip only (port optional)
2019-02-18 12:15:32 +00:00
hashmap
ac6ed71abd
Refactor API handlers (#2572)
Also add some API tests
2019-02-15 22:17:00 +01:00
Jeremy Rubin
99494c6fa6 get rid of default implementation of Hashed trait for writable things (#2573) 2019-02-15 13:41:19 +00:00
Jeremy Rubin
41ed10940d fix: Fix race condition with dandelion_relay peer map and make more semantic (#2548)
* fix: Fix race condition with dandelion_relay peer map and make more semantic

* Fix bug where we don't actually re-read the dandelion_relay variable after refreshing it
2019-02-13 10:40:31 -08:00
hashmap
65c0b1ecad
Fix handling of IO WouldBlock error in Stratum server (#2528)
If WouldBlock error happens Stratum server drops part of a message to
read or write. This PR inroduces a worker's buffer to store partially
read message which will be completed next time. For write the existing
util function is used.
Fixes #2524
2019-02-13 00:16:09 +01:00
Ivan Sorokin
aa4f44b79a fix: wallet coin selection respects max_block_weight (#2546)
* fix #2510: wallet coin selection respects max_block_weight

Deprecate "soft" max_outputs limit and introduce "hard" max_outputs
limit based on max_block_weight.

* Fix tests
2019-02-12 15:06:25 -08:00
hashmap
a63cfa7138 Allow to have more than min_peers/2 outbound peers (#2537)
* Allow to have more than min_peers/2 outbound peers

Default value is 8, so we allow only 4 outbound peers, unfortunately if a node is behind NAT it can't get inbound peers and it stucks with 4 peers as maximum.
This PR allows a number of outbound peers to be between min_peers and max_peers/2. Node behind NAT will eventually have just min_peers number of peers.

* Extract into healthy_peers_mix function
2019-02-07 12:26:23 -08:00
hashmap
267c706e2b Set max number of connections for peer db (#2506)
Use max_peers value for that if set. By default LMDB limit is 126, which is not enough for less than 200 peers on my node.
2019-02-01 10:51:23 -08:00
Antioch Peverell
19ce9cc28e
bump for v1.0.1 (#2511) 2019-02-01 14:43:18 +00:00
Simon B
92cbfa20a6 Handle rpc requests unwrap crash in stratumserver.rs (#2446)
* protect rpc_response from None.unwrap

* protect login handler from crashing before current_block_versions has had time to get populated

* protect worker_stats_id finding from None
2019-01-26 22:21:11 +01:00
Antioch Peverell
c8fd0575ed Pool tx weight verification (#2466) 2019-01-25 12:48:15 -08:00
Simon B
dd1a24dcbc Compiler warnings 20190123 (#2462)
* cleanup compiler warnings: unused imports

* rustfmt

* more compiler warnings
2019-01-25 10:09:32 +00:00
Ignotus Peverell
2299a03248
Fallback to building empty block to mine (if txpool is somehow in invalid state) (#2451)
* log loudly if we fail to prepare txs for mining
2019-01-23 10:31:49 -08:00
hashmap
91f4a6b180 Fix stratum reading issue one more time (#2459) 2019-01-23 10:27:00 -08:00
antiochp
61fe1418ef
rustfmt 2019-01-23 10:49:47 +00:00
antiochp
ba25592f15
log loudly if we fail to prepare txs for mining 2019-01-23 10:49:16 +00:00
antiochp
ba9a362d02
rustfmt 2019-01-23 10:31:20 +00:00
antiochp
30ad3bb7ae
fallback to empty vec of txs when building block from mineable txs 2019-01-23 10:31:14 +00:00
hashmap
55f4ee3166 Fix regression in reading stratum messages (#2450)
It was introduced in #2418, it turns out std read_line always appends to
the string, not writes from the beginning, so when we have multiple
workers to read from all messages are concatenated
2019-01-22 11:26:30 -08:00
Antioch Peverell
ef5d83817e
Maintain min outbound peers (min_preferred_peers / 2) (#2417)
* outbound connection count

* rustfmt

* display outbound peer count

* rustfmt

* wip - allow connections to exceed max when trying to create new outcound connections
any in excess of total max will be cleaned up subsequently

* fix

* we care about connected outbound peer count when deciding to connect to new peers
2019-01-19 16:13:09 +00:00
hashmap
74422efa5b
Merge pull request #2418 from cyclefortytwo/worker-str-alloc
Reduce number of String allocation in Stratum worker
2019-01-19 06:19:31 +01:00
Antioch Peverell
8c4d14f654
Build warning sync (#2416)
* sync state no longer need in adapters

* rustfmt
2019-01-18 21:40:48 +00:00
hashmap
a3f68d8d1f
Reduce number of String allocation in Stratum worker
Currently we allocate a string in the heap per each worker check (not even
read) and clone message in write. This pr introduces a buffer which is
used for a round of workers check and remove clone in write_message.
Read optimization reduces number of allocations by factor of N (where N
is a number of workers), if N = 1 number of allocations doesn't change.
2019-01-18 15:11:13 +01:00
Ignotus Peverell
e7485ab5f1
Version bump to 1.0.0 2019-01-15 16:24:29 +00:00
Ignotus Peverell
0510ba9345
Fix default DNS seed port 2019-01-15 15:46:11 +00:00
Ignotus Peverell
c5cc4f29ac
Yeastseed (#2382)
To keep it all yeasty

* The yeastiest seed

* Dammit git

* Dammit git
2019-01-14 13:31:46 -08:00
Gary Yu
c7bb5eab27 fix: avoid duplicate connection (#2361)
* fix: avoid duplicate connection
* ignore the duplicate connecting to same peer within 10 seconds
* refactor: use hashmap instead of vector for connecting history
* remove the double checking for already connected peer on connect
* add previous connecting time to the log
* fix a mistake on shrink
* move the now() into the inter loop for accurate time
* change the minimum allowed inverval time from 10s to 30s
2019-01-14 11:44:35 -08:00
Ignotus Peverell
f9a20aef0d
Track blocks we requested, always broadcast otherwise (#2349) 2019-01-12 09:28:03 -08:00
Quentin Le Sceller
424bb28c7d Reduce miner thread sleep to 1 microsecond (#2342) 2019-01-11 15:50:58 -08:00
Gary Yu
7698b28e16
fix: wait_for_min_peers shouldn't wait forever when all peers are in same work (#2340) 2019-01-12 07:38:27 +08:00
Ignotus Peverell
60d3ee3c44
Bump version to 0.5.2 for release 2019-01-11 01:26:30 +00:00
Simon B
950fa0e496 Cleanup compiler warnings (#2323)
* cleanup compiler warnings
* allow(dead_code) in tests/{framework,simulnet}
2019-01-10 12:18:25 -08:00
Gary Yu
ea4407a919
wait_for_min_peers should continue waiting if none connected (#2326)
* wait_for_min_peers should continue waiting if none connected

* allow no peers to go in non-production mode, such as travis-ci test
2019-01-10 21:08:51 +08:00
Yeastplume
cd9a539288
Add 'recover' option to grin wallet init (#2330)
* Only update outputs with unconfirmed transactions outstanding

* add further check for Unspent output that have been spent to check_repair

* rename  to

* make updating all outputs optional API parameter. do full update before a wallet check, remove unspent->spent check from check process

* rustfmt

* typo

* add recover from phrase option to init

* rustfmt

* don't panic if recover is cancelled, grin-wallet.toml is created but wallet_data dir doesn't yet exits

* rustfmt
2019-01-10 12:06:12 +00:00
Yeastplume
4191b15410
Wallet - only update outputs with unconfirmed transactions outstanding (#2322)
* Only update outputs with unconfirmed transactions outstanding

* add further check for Unspent output that have been spent to check_repair

* rename  to

* make updating all outputs optional API parameter. do full update before a wallet check, remove unspent->spent check from check process

* rustfmt

* typo
2019-01-10 11:17:35 +00:00
Hendrik Richter
c388af6603 add one more DNS seed (#2283) 2019-01-08 08:12:56 +08:00
Gary Yu
c5efb715a5 add https as optional for server api (#2310)
* add tls as optional config for server api
* add error log if start_rest_apis fail
2019-01-07 11:42:11 -08:00
Ignotus Peverell
2c5ba853f7
Version bump to 0.5.1 2019-01-07 19:41:07 +00:00
Ducem Barr
a3431fb147 feat: Configuration option to include foreign API endpoints in the owner API (#2305)
* Allow foreign API over owner API port

* Tests for owner_api_include_foreign config option
2019-01-07 10:00:52 +00:00
Gary Yu
657392b592
minor improvement on stratum server log for miner status (#2301)
* add a log to show the stratum worker status

* add miner starting time (height)

* rustfmt
2019-01-07 07:19:25 +08:00
Quentin Le Sceller
21deed3ba3 Add Quentin Le Sceller DNS Seed (#2302) 2019-01-06 12:05:57 -08:00
Gary Yu
f88ffe5fd6
more accurate stratumserver error status for block not found (#2273)
* more accurate stratumserver error status for block not found

* rustfmt
2019-01-02 22:49:06 +08:00
jaspervdm
e0923753fa Add @jaspervdm DNS seed (#2270) 2019-01-01 15:58:50 -08:00
Gary Yu
738d49d560
fix: one peer occupy multiple tcp connections (#2262)
* shutdown the tcpstream when peer connect or accept fail

* remove the unnecessary 3 times retry on peer connecting

* connect/accept are actually handshakings instead of tcpstream connect/accept
2018-12-31 19:24:30 +08:00
Gary Yu
dbf8e97b3f
fix 2 minor build warning (#2260) 2018-12-30 20:03:36 +08:00
hashmap
c332c2c7e9 Improve block difficulty logging (#2254) 2018-12-29 09:23:06 -08:00
Gary Yu
c639e85be5 Add one more dns seed (#2250) 2018-12-28 16:41:14 -08:00