Commit Graph

704 Commits (7b02c3d24a43b922b2568c883009df40e4aab013)

Author SHA1 Message Date
SChernykh f05f7c4268 Fixed wrong nonce values in submit_block error log 2021-09-26 16:50:24 +02:00
SChernykh ae8733c187 Update RandomX 2021-09-22 17:59:58 +02:00
SChernykh 5c92920619 Default log level 3
Also refactored default port numbers
2021-09-18 10:03:06 +02:00
SChernykh b4ea125a8a Hardcode default consensus ID for faster startup 2021-09-16 14:23:14 +02:00
SChernykh 8aa9e54dc4 BlockTemplate: wait for 10 seconds before including new transactions 2021-09-14 12:54:42 +02:00
SChernykh b35b4a9f76 Crypto: added cache for faster key derivation 2021-09-14 11:06:49 +02:00
SChernykh ba6a2c8eb2 P2PServer: relax stale block restriction 2021-09-13 19:25:12 +02:00
SChernykh 14e26f5c17 Fix: always check before closing TCP handles 2021-09-13 19:11:59 +02:00
SChernykh 4c5144b37f Check monerod RPC version at startup 2021-09-13 18:27:47 +02:00
SChernykh 42dd58d778 P2PServer: check broadcasts for wrong height 2021-09-13 15:48:05 +02:00
SChernykh da0f376bef P2PServer: ban peers that don't broadcast blocks 2021-09-13 15:01:02 +02:00
SChernykh 0d439e7712 SideChain: submit blocks to monerod in more cases 2021-09-13 10:16:45 +02:00
SChernykh b8f04ac787 Tweaked block broadcast rules 2021-09-11 23:44:09 +02:00
WeebDataHoarder 7bad1e05a4 Implemented shares/uncles position chart on status command
Shows progress in slices of PPNLS window. Shares move left to right as they age.
A dot "." indicates no shares, 1-9 for that number in shares, for 9+ it shows a "+".

Will not show shares or uncles lines unless you have one on window.
2021-09-10 16:59:15 +02:00
SChernykh 74096248e1 Better error handling of Monero RPC requests 2021-09-10 16:18:16 +02:00
SChernykh 36ee76d4d2 data api: fixed one block missing to calculate effort 2021-09-10 08:18:38 +02:00
SChernykh 3aa270a072 Fix for older compilers 2021-09-09 11:44:40 +02:00
SChernykh 7a97171b03 Tweaked block broadcast rules 2021-09-08 20:57:22 +02:00
SChernykh 52f195b89f Tweaked idle peer detection 2021-09-08 20:36:21 +02:00
SChernykh ee7a1e54f7 DNS name resolution for command line parameters 2021-09-08 20:25:39 +02:00
SChernykh c8a2a256e7 Fixed RandomX VM initialization 2021-09-08 11:49:54 +02:00
SChernykh 57bc38d2bb data api: added stats_mod 2021-09-08 09:57:31 +02:00
SChernykh a332ac7d26 P2PServer: load peers from DNS 2021-09-07 21:43:44 +02:00
SChernykh 7ea1913a9d Update log.h 2021-09-07 14:14:11 +02:00
SChernykh 73c8b1294a P2PServer: connect to peers from the event loop thread
Better thread safety
2021-09-07 12:56:22 +02:00
SChernykh ce8ec3860d Fixed memory leak 2021-09-07 10:22:58 +02:00
SChernykh 25772abc0f Show block share % in status 2021-09-07 09:53:38 +02:00
SChernykh 899d5a82dd data api: check p2pool shares that come after a Monero block 2021-09-06 23:33:52 +02:00
SChernykh 7b0cc256c5 P2PServer: ban peers that disconnect without finishing handshake 2021-09-06 16:17:20 +02:00
SChernykh d3dc4c731f Added more tests 2021-09-06 15:49:39 +02:00
SChernykh e264377f0e Added more checks 2021-09-06 09:17:39 +02:00
SChernykh a36825424b Fixed some Coverity reports 2021-09-06 09:02:35 +02:00
SChernykh 2ecd935bc5 data api: fixed saving of p2pool.blocks 2021-09-05 23:05:36 +02:00
SChernykh f3b6423d4c Log difficulty for found pool shares 2021-09-05 22:57:36 +02:00
SChernykh 82a88ce0ef data api: added block hashes to pool/blocks 2021-09-05 22:28:57 +02:00
SChernykh 884d0f180a TCP server: log IP addresses in more places 2021-09-05 20:21:33 +02:00
SChernykh f3ee444aed Stratum server: log IP addresses that send bad data 2021-09-05 19:16:23 +02:00
SChernykh dd0a35fb79 Show pool-side hashrate in status only when it's not zero 2021-09-05 15:56:50 +02:00
SChernykh 4deef2f807 Added cppcheck workflow 2021-09-05 12:53:40 +02:00
SChernykh b31adbd5ae Added macOS build 2021-09-05 12:10:40 +02:00
SChernykh e527b0c660 Added Windows builds 2021-09-05 11:28:24 +02:00
SChernykh b17723f1e4 Removed unused code 2021-09-05 00:07:03 +02:00
SChernykh 1554a44f5c Added more integrity checks 2021-09-04 09:10:44 +02:00
SChernykh 08d2fbdbd1 Parse full 128-bit difficulty from monerod 2021-09-03 22:45:55 +02:00
SChernykh 661d596107 api: store difficulty and totalHashes for each block 2021-09-03 18:04:54 +02:00
SChernykh 2d8530798d Unit tests for difficulty_type 2021-09-03 11:32:11 +02:00
SChernykh b26c4616d7 Fixed wrong diff in api/network/stats 2021-09-02 23:39:47 +02:00
SChernykh 70ff4ba859 Tweaked peer list logic 2021-09-02 19:21:38 +02:00
SChernykh bab148fbad Added cppcheck scripts 2021-09-02 12:35:36 +02:00
SChernykh 55f8e9dc33 Added total blocks found 2021-09-02 09:02:24 +02:00
SChernykh fbdef7d058 Count all miners that were active in last 24 hours 2021-09-01 20:48:03 +02:00
SChernykh e1b4649c2a Added pool blocks 2021-09-01 17:35:54 +02:00
SChernykh 73da71a2d3 Renamed next payout to block reward share 2021-09-01 16:34:10 +02:00
SChernykh 533cc202d2 Added pool stats 2021-09-01 16:28:05 +02:00
SChernykh 295cbda449 p2pool: export data to an external web-server
Dumps data to JSON files which can be later served by a web-server.
2021-09-01 14:11:28 +02:00
SChernykh 5d6fa03f11 Show all Monero block rewards in log 2021-09-01 10:43:10 +02:00
SChernykh 75843e9b37 P2PServer: don't broadcast stale blocks 2021-08-31 23:41:05 +02:00
SChernykh 1a83610299 P2PServer: simplified the code a bit 2021-08-31 23:11:58 +02:00
SChernykh 5f406a60a6 StratumServer: added keepalived method 2021-08-31 20:57:01 +02:00
SChernykh 5eea610f3c Stricter wallet address checks 2021-08-31 18:26:28 +02:00
SChernykh e44919c289 Changed pool name for the new test 2021-08-31 17:25:01 +02:00
SChernykh 780afd84a2 Added checks for tx keys 2021-08-31 17:23:20 +02:00
SChernykh 0558cdb9cc Fixed share effort calculation 2021-08-31 15:14:33 +02:00
SChernykh 7364292ece Fixed average effort calculation 2021-08-31 14:59:36 +02:00
SChernykh 662a7e91c8 P2PServer: always ban IPs that send bad blocks 2021-08-31 13:14:35 +02:00
SChernykh 8064865ba5 Fixed setting max log level from command line 2021-08-31 11:18:40 +02:00
SChernykh 7b197824fe P2PServer: add peers from the command line to the peer list on startup 2021-08-31 11:16:40 +02:00
SChernykh 114f6b627b P2PServer: don't allow multiple connections to/from the same IP 2021-08-31 10:41:41 +02:00
SChernykh 4757cdb8e2 P2PServer: added 1 second grace time for stale shares
Only for shares that lag 1 Monero block behind
2021-08-31 09:58:57 +02:00
SChernykh bb8ff24db8 StratumServer: added avg effort and number of shares to status 2021-08-30 20:49:51 +02:00
SChernykh 4ac08ac10d StratumServer: print current effort in status 2021-08-30 19:45:37 +02:00
SChernykh 891ee36e53 Force update average hashrates when print_status() is called 2021-08-30 17:50:09 +02:00
SChernykh d1e94d6e1a StartumServer: print average hashrate in status 2021-08-30 16:51:23 +02:00
SChernykh a2f6e73122 JSONRPCRequest: more informative error messages 2021-08-30 14:28:23 +02:00
SChernykh 9120b86007 Fixed use of out of scope variable 2021-08-30 01:21:46 +02:00
SChernykh bb7720968f Tweaked log levels 2021-08-29 19:20:36 +02:00
SChernykh dac74a8829 Update p2p_server.cpp 2021-08-29 17:42:49 +02:00
SChernykh dd9166e91c Update dataset at normal thread priority 2021-08-29 17:36:10 +02:00
SChernykh 456f5d356f P2PServer: ban peers only after handshake finished and failed 2021-08-29 17:26:30 +02:00
SChernykh 541b3c653d Enable 4-byte target format for diff up to 4 million 2021-08-29 08:46:23 +02:00
SChernykh 519b4b548d Relax JSON parsing
Allow comments and trailing commas
2021-08-29 08:39:17 +02:00
SChernykh 8e29abd906 Small fixes 2021-08-29 00:13:53 +02:00
SChernykh 8a26498b66 Tweaked log levels 2021-08-28 23:34:46 +02:00
SChernykh ff4d89868b StratumServer: Use short target format (4 bytes) for diff <= ~2 million 2021-08-28 19:50:48 +02:00
SChernykh 4175f4c8bc StratumServer: ban clients that send incorrect shares 2021-08-28 18:40:50 +02:00
SChernykh 9e438210d1 StratumServer: support custom fixed difficulty
Example (set fixed difficulty 10000)

`"user":"x+10000"` in config.json or
`-u x+10000` in command line
2021-08-28 17:23:16 +02:00
SChernykh 46ce4ebee7 check_pow: fixed carry calculation 2021-08-28 11:50:20 +02:00
SChernykh 0be078cb09 StartumServer: moved warnings to log level 4 2021-08-28 08:30:17 +02:00
SChernykh 14bb308794 P2PServer: clear m_missingBlockRequests when there is nothing missing 2021-08-27 21:09:35 +02:00
SChernykh f9be0de8d2 P2PServer: ask peers about unknown blocks only once 2021-08-27 17:26:42 +02:00
SChernykh 81a12158fc P2PServer: don't add banned peers back to the peer list 2021-08-27 16:36:06 +02:00
SChernykh 8304d81961 Prepare for mainnet test 2021-08-27 11:30:03 +02:00
SChernykh 27c2aab145 Check network type at startup
- Make network type part of consensus ID to avoid mixing p2pool nodes from mainnet and testnet/stagenet
- Check that wallet address matches the network type of monerod
2021-08-27 11:25:25 +02:00
SChernykh afca83d6c2 BlockCache: check block size before storing it 2021-08-27 10:37:14 +02:00
SChernykh 2761ce5af7 Fixed a leak in ZMQReader 2021-08-27 10:32:31 +02:00
SChernykh 776b1f561c Fixed use after free on p2pool shutdown 2021-08-27 10:13:33 +02:00
SChernykh 715c0d4e14 Reduced cache size a bit 2021-08-27 10:12:41 +02:00
SChernykh 3ea71d51e5 Fixed crash on startup 2021-08-27 00:41:09 +02:00
SChernykh f77e0434c6 Fixed TCPServer startup 2021-08-27 00:19:01 +02:00
SChernykh 3f1ee9ce4b TCPServer fixes
- Proper shutdown sequence, uv_close() must be called from the event loop thread
- Moved start_listening() to child class constructor because it must be ready before it can listen on sockets
- Added simple memory leak detector for Windows. Linux users can enjoy the leak sanitizer
2021-08-26 23:57:59 +02:00
SChernykh 27e85a922b TCPServer: fixed more leaks on shutdown 2021-08-26 19:14:04 +02:00
SChernykh 4ba32277c1 Use p2pool-api branch for Monero 2021-08-26 15:36:40 +02:00
SChernykh 37f3312e1d Submit received p2pool blocks to monerod when possible 2021-08-25 22:07:42 +02:00
SChernykh 125815b502 Made print_status() thread-safe 2021-08-25 21:00:06 +02:00
SChernykh 63e442dffd print_status: fixed next payout display 2021-08-25 18:52:09 +02:00
SChernykh 0009eba307 Fix RandomX startup logic
Ensure that both RandomX caches initialize before stratum and p2p servers start.
2021-08-25 18:31:42 +02:00
SChernykh 276cc5f0fd Fix Mac compilation 2021-08-25 18:16:26 +02:00
SChernykh fa3146a8f3 Reverted force close TCP connections 2021-08-25 17:27:46 +02:00
SChernykh 230d3e4780 Fixed socket leak after a failed connection 2021-08-25 17:18:59 +02:00
SChernykh d246ee1552 Enabled block cache for Mac 2021-08-25 16:26:15 +02:00
SChernykh 46b7c3e755 TCPServer: stop reading before closing connection 2021-08-25 16:19:21 +02:00
SChernykh 662865ad70 Reduced startup spam at log levels <= 5 2021-08-25 15:01:05 +02:00
SChernykh 68a4765f95 Force close TCP connections 2021-08-25 14:53:45 +02:00
SChernykh 924fd4b7bd TCPServer: better tracking of used sockets 2021-08-25 13:58:00 +02:00
SChernykh a38a7be73f p2pool: submit block from the main thread only 2021-08-25 12:45:14 +02:00
SChernykh 8f93adf7a1 Refactored signal handler
Call the same stop() function as regular exit command
2021-08-25 12:28:15 +02:00
SChernykh d8efb27374 Restrict uv_default_loop() to main thread 2021-08-25 12:17:14 +02:00
SChernykh dbf18c34a4 Fixed wrong uv loop in p2pserver::flush_cache() 2021-08-25 11:31:50 +02:00
SChernykh fcb9e25fb1 Print background jobs in status 2021-08-25 11:31:35 +02:00
SChernykh 7ab3c22114 Give only 5 seconds for new connections to complete handshake
This is to detect random port scans/non-p2pool connections quickly
2021-08-25 11:14:23 +02:00
SChernykh 336349e189 Show hashrate estimate in status 2021-08-25 11:13:38 +02:00
SChernykh 8f2493edfc Log message fixes 2021-08-25 09:52:06 +02:00
SChernykh a27577f735 Added log level 6 to reduce spam on level 5
Log level 5 is still default
2021-08-25 09:38:47 +02:00
SChernykh 09aedd9f9a Drop idle connections
Idle = didn't send any full messages in the last 5 minutes
2021-08-24 21:45:19 +02:00
SChernykh cd532965e8 Code safety: BlockCache isn't supposed to be copied/moved 2021-08-24 21:06:47 +02:00
SChernykh 64885852dd Limit max number of transactions in block template
Because if it's too high, it won't fit into p2p packet
2021-08-24 20:54:02 +02:00
SChernykh 6de98697a1 Only warn about lagging monerod if it's 2 or more blocks behind 2021-08-24 20:10:16 +02:00
SChernykh 02449bf9f9 Use UTC time for logging 2021-08-24 18:56:14 +02:00
SChernykh e4be4c1a66 Fixed pruning logic
- Erase an element from m_blocksByHeight only if it's empty
- Remove blocks from unconnected alternative chains too when they get old enough (4xPPLNS window)
2021-08-24 18:34:28 +02:00
SChernykh d4388bf9c0 Removed unnecessary lock 2021-08-24 17:56:36 +02:00
SChernykh 20b3886bfb Less tolerance to lagging nodes
Ban nodes that are 5 or more Monero blocks behind.
2021-08-24 17:19:10 +02:00
SChernykh a55545762b Merge branch 'master' of https://github.com/SChernykh/p2pool 2021-08-24 13:46:53 +02:00
SChernykh 69533fd209 Store only fully verified blocks in the cache 2021-08-24 13:46:38 +02:00
SChernykh 90a977228b
Merge pull request #2 from hyc/cmds
Tweak command handling
2021-08-24 14:37:03 +03:00
SChernykh 4837b4c863 Added missing integrity check 2021-08-24 13:33:55 +02:00
SChernykh 15354e5a88 Update util.cpp 2021-08-24 13:22:56 +02:00
Howard Chu 0dc3baa480 Tweak command handling
Modularize, add help and exit commands.
Fix shutdown_tcp() and p2pool to make sure servers exit immediately
when terminating.
2021-08-24 11:55:59 +01:00
SChernykh 05d336c8e9 Update block_cache.cpp 2021-08-24 12:45:11 +02:00
SChernykh 1cf4071f9b BlockCache (Linux version) 2021-08-24 12:36:59 +02:00
SChernykh bf5db3db08 Update p2pool.cpp 2021-08-24 12:01:43 +02:00
SChernykh 3229909333 Update p2pool.cpp 2021-08-24 11:59:59 +02:00
SChernykh 9808685981 Update stratum_server.cpp 2021-08-24 11:51:11 +02:00
SChernykh aba3bc50b8 Block cache WIP and other fixes
- Block cache is implemented only on Windows for now
- Tracking of background jobs
- More robust sidechain syncing
2021-08-24 11:42:41 +02:00
SChernykh 86b31ea821 Reduce broadcast spam after initial sync 2021-08-24 00:27:48 +02:00
SChernykh 25ef5733a7 Skip duplicates in the saved peers list 2021-08-23 23:12:52 +02:00
SChernykh fda80e3556 Sanity check 2021-08-23 23:09:59 +02:00
SChernykh 6d3cfa2c7a Couple more sanity checks 2021-08-23 23:08:46 +02:00
SChernykh 656f912a3e Workaround for crashes on shutdown 2021-08-23 22:50:36 +02:00
SChernykh c4d3f6f8b4 Fixed parse_address_list() 2021-08-23 22:24:26 +02:00
SChernykh 2f08a35ac7 Fixed logger thread start/stop logic 2021-08-23 17:36:17 +02:00
SChernykh df52838433 Removed some noisy warning messages 2021-08-23 14:05:07 +02:00
SChernykh 39a8c68ab7 More clang fixes 2021-08-23 11:44:26 +02:00
SChernykh 4a5691e349 clang fixes 2021-08-23 11:31:16 +02:00
SChernykh 510b7dbb85 Add files 2021-08-22 12:20:59 +02:00