Emit getprioritisedtransactions modified_fee in satoshis - #605
Emit getprioritisedtransactions modified_fee in satoshis#605metaphorics wants to merge 1 commit into
Conversation
Core mining RPCs use satoshi amounts. fee_delta was already an integer overlay; modified_fee was incorrectly projected as BTC. Emit actual fee plus delta as a JSON number in satoshis, omitting the field when the txid is not in the mempool. Co-authored-by: metaphorics <metaphorics@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c080bc16-1245-45a6-a7b6-0eb29d175254) |
PR Summary by QodoEmit prioritised transaction modified fees in satoshis
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
| "generateblock", SurfaceKind::Rpc, Status::Implemented, "", CORE_VERSION, "Assembles and solves one block paying an address or descriptor from the listed mempool txids or raw txs in that order; third param is Core's submit flag. Unknown 64-hex txids are -5; raw-tx decode failures are -22.", "0.4.0", Some(mining::generateblock); | ||
| "getnetworkhashps", SurfaceKind::Rpc, Status::Implemented, "", CORE_VERSION, "Estimated hashes/s over a caller-chosen lookback ending at a caller-chosen height; default lookback 120, height the applied tip.", "0.4.0", Some(mining::getnetworkhashps); | ||
| "getprioritisedtransactions", SurfaceKind::Rpc, Status::Implemented, "", CORE_VERSION, "Projects the mempool's signed fee-delta overlay, including txids not currently pooled.", "0.4.0", Some(mining::getprioritisedtransactions); | ||
| "getprioritisedtransactions", SurfaceKind::Rpc, Status::Implemented, "", CORE_VERSION, "Projects the mempool's signed fee-delta overlay, including txids not currently pooled. modified_fee is satoshis like Core mining RPCs, not BTC.", "0.4.0", Some(mining::getprioritisedtransactions); |
There was a problem hiding this comment.
1. modified_fee rule duplicated 📘 Rule violation ⚙ Maintainability
The registry metadata independently restates the modified_fee unit rule already defined by API-25, without referencing that authoritative contract. This creates parallel documentation that can drift when the API contract changes.
Agent Prompt
## Issue description
The `getprioritisedtransactions` registry note duplicates the `modified_fee` unit rule defined in the authoritative `API-25` contract.
## Issue Context
Keep the registry description concise and refer to `docs/contracts/external-api.md#API-25` rather than independently restating the satoshi-versus-BTC rule. Regenerate `docs/rpc-reference.md` afterward because it is generated from the registry.
## Fix Focus Areas
- crates/rpc/src/registry.rs[146-146]
- docs/rpc-reference.md[80-80]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| let sats = i64::try_from(modified_fee).unwrap_or_else(|_| { | ||
| if modified_fee.is_negative() { | ||
| i64::MIN | ||
| } else { |
There was a problem hiding this comment.
2. Signed saturation logic duplicated 📘 Rule violation ⌂ Architecture
The new i128-to-i64 saturation formula duplicates the conversion already embedded in signed_sat_to_btc instead of using one canonical conversion helper. Future changes to RPC numeric-boundary behavior could therefore diverge between the two paths.
Agent Prompt
## Issue description
The new `modified_fee` projection repeats signed `i128`-to-`i64` saturation logic already present in `signed_sat_to_btc`.
## Issue Context
Introduce a canonical signed saturation helper in the RPC conversion module, use it from both `signed_sat_to_btc` and `getprioritisedtransactions`, and retain the existing boundary behavior.
## Fix Focus Areas
- crates/rpc/src/compat/convert.rs[68-77]
- crates/rpc/src/handlers/mining.rs[290-296]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Qodo Fixer🍒 Ready to be cherry-picked — ✅ Merged (0) · ☑ Fixed (2) 🔗 Fix PR: #607 This fix PR was closed automatically. Its branch is preserved so you can cherry pick the changes into the original PR. Prompt for coding agent Process — 2 fixed
|
Stacked on #604. Core v31
getprioritisedtransactions(src/rpc/mining.cpp) documentsmodified_feeas a NUM in satoshis, and mining RPCs follow GBT in using satoshi amounts rather than BTC.This node already emitted
fee_deltaas an integer satoshi overlay and omittedmodified_feewhenin_mempoolis false. Pooledmodified_fee(actual fee plus delta) was projected throughsigned_sat_to_btc, so clients saw0.000015instead of1500. Projection now emits a JSON integer in satoshis.Contract:
API-25. Proven bygetprioritisedtransactions_projects_the_overlay.getmempoolentry.modifiedstays BTC; that method is not a mining RPC.Does not complete #151. Remaining mining work includes the live Core differential suite (#78), numeric p95 budgets (#158),
-acceptnonstdtxnas a real option, and pruneBLOCK_HAVE_DATAvs scripts-valid.