* reworked the dandelion rewrite (dandelion++)
* fallback to fluff/broadcast if we cannot stem the tx for any reason
* rework stem vs fluff logic during accepting tx
* cleanup docs
* add is_stem to logging
* cleanup
* rustfmt
* cleanup monitor and logging
* rework dandelion monitor to use simple cutoff for aggregation
* transition to next epoch *after* processing tx
so we fluff final outstanding txs
* fluff all txs in stempool if any are older than 30s
aggressively aggregate when we can
* fix rebase onto 1.1.0
* default config comments for Dandelion
* fix code to reflect our tests - fallback to txpool on stempool error
* log fluff and expire errors in dandelion monitor
* cleanup
* fix off by one
* cleanup
* cleanup
* various fixes
* one less clone
* cleanup
* When syncing the chain, calculate the displayed download speed using the current rate from the most recent iteration, rather than the average download speed from the entire syncing process.
* Replace the explicitly ignored variables in the pattern with an implicit ignore
* dynamically resize lmdb
* rustfmt
* explicitly close db before resizing
* rustfmt
* test fix
* rustfmt
* pool tests
* chain fix
* merge
* move RwLock into Store, ensure resize gives a min threshold
* rustfmt
* move locks based on testing
* rustfmt
* Add hooks for network and chain events. Move logging to an EventLogger
* implement webhooks
* fix failing test
* remove unnecessary 'pub'
* add some metadata to the json payload
* avoid unecessary init
* resolve conflicts
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
* 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)
* 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
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
It seems that current approach stops workring after amount of parallel
connection exceeds ~500. This PR introduces an 'async' feature which
enable asyncronius, tokio based implementation of stratum server.
* fix bug with passing current_difficulty in Handler
I passed in Handler current_difficulty as an u64, so it was copied
and all later changes were ignored. In this commit I pass referece on
RwLock with current_difficulty.
* fix crash in build_block
* improve error handling
* print error message on unknown error
* replace original server by tokio based one
* fixes after review
* reduce sleep time in mail loop to 5ms
* 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
* 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
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
* 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
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.
* 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
* 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
* 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
* 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
* Fix secondary scaling bugs; rename is_testnet -> is_floonet (#2215)
* add global::is_mainnet()
* use it to change pre-genesis pow type
* rename is_testnet -> is_floonet
* Support multiple chain configurations (#2217)
* Support multiple chain configurations
Supports generating the proper configuration for each chain type
(mainnet, floonet, usernet). Will run them by default under
their respective root directory (~/.grin/main, ~/.grin/floo, etc).
Assigned default ports for mainnet, overriding them to keep Floonet
ports unchanged.
For now, starting on mainnet will abort.
* Fixed usernet command line help message. Fixes#2217
* Differing magic numbers for each chain type (#2208)
* stick to e=H(R|P|m) when use schnorr signature (#2200)
* stick to e=H(R|P|m) when use schnorr signature
* (1)add verify_slate_messages for wallet receive (2)log the message content
* remove debug log on verify_slate_messages
* verify the sender's message signature when receive_tx in wallet listen
* Revert "remove debug log on verify_slate_messages"
This reverts commit 65ea32a407.
* Revert "rustfmt"
This reverts commit c380ab9185.
* Revert "(1)add verify_slate_messages for wallet receive (2)log the message content"
This reverts commit 9584ca7a89.
* [re-floonet] Keychain Floonet BIP32 version/network option (#2235)
* add 'is_floonet' property to keychain
* fix hex encoding and tests
* Fix couple floonet loose ends (#2230)
* Fix couple floonet loose ends. Fixes#2216
* Doc fix for sig message
* Refuse unkown kernel features (#2244)
* Minor: magic number change for re-floonet
* Set pre genesis is_secondary to true (#2247)
* Minor: tx validation error display underlying
* New floonet genesis
* genesis rustfmt
* Use chain-specific config for wallet toml gen
* Fix default wallet_listener_url
* New more reasonable genesis block, bumped version
* genesis rustfmt
* Couple minor fixes to genesis generation script
* ban a peer with highest height but can't send us the proper headers
* reset self.stalling_ts if syncing goes well
* fix: switch to peers.ban_peer() instead of peer.set_banned()
* Get last bitcon block hash, setup genesis header without PoW (for now)
* More a few properties to mainnet genesis. Don't get too excited, several are placeholders.
* Mine a valid Cuckaroo solution for genesis block
* Use miner as library to get a solution for genesis. Replace final values in genesis.rs before committing it.
* Complete genesis replacement
* Fixed various replacements to obtain a compilable, well-formed genesis
* Check plugin errors, uncomment PoW validation
* Fixes to nonce handling in genesis mining
* Also produce full block hashes
* Fix genesis hash test
* Switch commitments (#2157)
* [Floonet] Use switch commits for all blinding factors (#2178)
* move wallet mods back into dirs
* use switched keys for blinding factor in all cases
* re-implement flag to turn off switch commit derivation
* rename tx log entry field tx_hex -> stored_tx (#2181)
* [Floonet] add feature for height locked kernels (#2168)
* add feature for height locked kernels
* add function to compute kernel features appropriate for lock height, and use it
* only sign kernel-features relevant fields; refactor Features
* simplify invalid kernel logic
* remove unused height arg to reward::output and run some rustfmt
* replace nested if/else by match
* Floonet chain type and genesis, testnets cleanup (#2182)
* [Floonet] Encrypt private slate data upon storage in DB (#2189)
* xor encrypt stored nonce and blind sum in transaction data
* stop doc tests splatting wallet files throughout
* Remove bzip2 dependency
* Changed magic number and seeds for Floonet (#2188)
* Genesis generator now loads a local wallet seed to build coinbase.
* Floonet genesis block
* Add floonet to generated grin-server.toml comments
* Test with final Floonet genesis hashes
* Fix get_header_for_output for genesis (#2192)
* start search with min height 0 (#2195)
* add feature for height locked kernels
* add function to compute kernel features appropriate for lock height, and use it
* only sign kernel-features relevant fields; refactor Features
* simplify invalid kernel logic
* remove unused height arg to reward::output and run some rustfmt
* replace nested if/else by match
* move wallet mods back into dirs
* move wallet mod files
* use switched keys for blinding factor in all cases
* rustfmt
* test fix
* test fix
* test fix
* rustfmt
* re-implement flag to turn off switch commit derivation
* rustfmt
* add block hash to tui mining diff screen
include current header in there also
* rework the mining screen on the tui
show block hash as well as block height
fix the "off by one" error
* Chain init now handles genesis body properly, related unit test creating the genesis with reward
* Avoid making block body public by adding a with_reward method
* apply_block in all genesis cases works
* start wallet command refactoring
* another re-structuring attempt
* rustfmt
* begin splitting up wallet commands
* rustfmt
* clean up wallet arg checking
* rustfmt
* macro for arg parsing
* rustfmt
* factor out init commands
* rustfmt
* move recover to new format
* rustfmt
* add listen command to new format
* rustfmt
* Finish moving commands to new format
* rustfmt
* rustfmt
* propogate errors more cleanly
* rustfmt
* error handling cleanup
* replace header_by_height index with reads into the header MMR
* rustfmt
* cleanup
* cleanup chain tests
* fix locate_headers to stop on our max header
* fix the deadlock in comact_blocks_db...
* cleanup and docs/comments
* Cuckatoo size shift upgrade schedule
* Move the schedule into graph_weight instead of messing with min edge bits
* Cleanup and fixes now that we have an agreed upon schedule