aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/rx-slow-hash.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed deadlock and crash when syncing with full dataset on WindowsSChernykh2023-03-291-1/+2
| | | | | | | | | | | | It's not allowed to use WaitForSingleObject with _beginthread, because the thread closes its own handle before exiting. So the wait function will either wait on an invalid handle, or on a different handle used by something else. Or, if it starts waiting before the thread exits, the behavior is undefined according to MS: "If this handle is closed while the wait is still pending, the function's behavior is undefined." In my test sync I observed threads getting stuck infinitely on WaitForSingleObject, and then rx_set_main_seedhash spamming new threads when RandomX seed changes again. Eventually the system ran out of resources, and monerod aborted with "Couldn't start RandomX seed thread" message. This PR fixes it by using `_beginthreadex` instead and explicitly closing the handle when it's safe.
* Demote large pages warning to `mdebug`SChernykh2023-01-171-4/+7
|
* RandomX: print VM allocation warnings only onceSChernykh2023-01-111-2/+10
|
* Refactored rx-slow-hash.cSChernykh2022-12-141-182/+317
| | | | | | | | | - Straight-forward call interface: `void rx_slow_hash(const char *seedhash, const void *data, size_t length, char *result_hash)` - Consensus chain seed hash is now updated by calling `rx_set_main_seedhash` whenever a block is added/removed or a reorg happens - `rx_slow_hash` will compute correct hash no matter if `rx_set_main_seedhash` was called or not (the only difference is performance) - New environment variable `MONERO_RANDOMX_FULL_MEM` to force use the full dataset for PoW verification (faster block verification) - When dataset is used for PoW verification, dataset updates don't stall other threads (verification is done in light mode then) - When mining is running, PoW checks now also use dataset for faster verification
* Copyright: Update to 2022mj-xmr2022-03-041-1/+1
|
* crypto: fix constant randomx exceptions in large page allocatormoneromooo-monero2022-02-191-1/+4
| | | | | | If allocating large pages fails, we don't try again. This has the obvious drawback of not being able to use large pages if they fail once.
* Honor LARGE_PAGES flag in randomx umaskHoward Chu2021-02-111-10/+18
|
* functional_tests: add randomx testsmoneromooo-monero2020-08-271-4/+46
|
* Update copyright year to 2020SomaticFanatic2020-05-061-1/+1
| | | | Update copyright year to 2020
* Merge pull request #6298luigi11112020-03-311-0/+4
|\ | | | | | | fe92fa1 [randomx] Add missing randomx_vm_set_cache() (cohcho)
| * [randomx] Add missing randomx_vm_set_cache()cohcho2020-01-171-0/+4
| |
* | Silence miner debugmsg spamHoward Chu2019-12-091-7/+14
|/ | | | Don't try to allocate the dataset repeatedly if it has already failed.
* RandomX: update to v1.1.4tevador2019-10-131-76/+30
| | | | | | | * Faster cache initialization with SSSE3/AVX2 * Automatic detection of CPU capabilities in RandomX * Fixed a possible out-of-bounds access in superscalar program generator * Use MONERO_RANDOMX_UMASK to manually disable RandomX flags in monerod
* Fix for miners on reorgHoward Chu2019-10-071-1/+4
| | | | Make sure dataset gets re-init'd if a reorg changes the epoch
* Update to RandomX v1.1.3, simplifyHoward Chu2019-10-051-19/+2
| | | | | | We don't need to detect if the cache has changed, just always call to set it on the VM. The call will be a no-op if the cache hasn't changed.
* Fix randomx cache selection for RPCsHoward Chu2019-10-031-12/+28
| | | | Was using the wrong cache slot, and returning invalid PoW hashes to RPC clients
* RandomX integrationHoward Chu2019-09-251-0/+357
Support RandomX PoW algorithm