diff options
| author | tobtoht <tob@featherwallet.org> | 2026-04-15 09:27:28 +0000 |
|---|---|---|
| committer | tobtoht <tob@featherwallet.org> | 2026-04-15 09:27:28 +0000 |
| commit | ecb1b7148e8ce3e5bc2b98cd5f93629d61486fc5 (patch) | |
| tree | a8816983a5f8422d1747d6bfa499402386ca0d3b | |
| parent | 54b803603cf0fb450a9b9436b9fe85452e75966f (diff) | |
| parent | 644a73867fd43420dccfe22a6cb421ac1aee7c54 (diff) | |
| download | monzero-core-ecb1b7148e8ce3e5bc2b98cd5f93629d61486fc5.tar.gz monzero-core-ecb1b7148e8ce3e5bc2b98cd5f93629d61486fc5.tar.xz monzero-core-ecb1b7148e8ce3e5bc2b98cd5f93629d61486fc5.zip | |
Merge pull request #10409
644a738 rpc: restrict `add_aux_pow` (hinto.janai)
| -rw-r--r-- | src/rpc/core_rpc_server.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index c84746975..c68449630 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2064,6 +2064,15 @@ namespace cryptonote if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_ADD_AUX_POW>(invoke_http_mode::JON_RPC, "add_aux_pow", req, res, r)) return r; + const bool restricted = m_restricted && ctx; + + if (restricted && req.aux_pow.size() > 10) + { + error_resp.code = CORE_RPC_ERROR_CODE_RESTRICTED; + error_resp.message = "Too many aux pow hashes"; + return false; + } + if (req.aux_pow.empty()) { error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM; @@ -2099,7 +2108,7 @@ namespace cryptonote while ((1u << path_domain) < aux_pow.size()) ++path_domain; uint32_t nonce; - const uint32_t max_nonce = 65535; + const uint32_t max_nonce = restricted ? 16384 : 65535; bool collision = true; for (nonce = 0; nonce <= max_nonce; ++nonce) { |
