From d5af26e0ce2f5b3b032f430d8adb1081516074c9 Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Mon, 4 Mar 2024 16:04:38 -0600 Subject: [PATCH] chore: add comment to the manual calculation of reward_cycle_id --- stackslib/src/net/api/getpoxinfo.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stackslib/src/net/api/getpoxinfo.rs b/stackslib/src/net/api/getpoxinfo.rs index c9e59b651..b46360984 100644 --- a/stackslib/src/net/api/getpoxinfo.rs +++ b/stackslib/src/net/api/getpoxinfo.rs @@ -286,6 +286,9 @@ impl RPCPoxInfoData { return Err(NetError::DBError(DBError::Corruption)); } + // Manually calculate `reward_cycle_id` so that clients don't get an "off by one" view at + // reward cycle boundaries (because if the reward cycle is loaded from clarity, its + // evaluated in the last mined Stacks block, not the most recent burn block). let reward_cycle_id = burnchain .block_height_to_reward_cycle(burnchain_tip.block_height) .ok_or_else(|| {