Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slot index and reward index mismatch #2068

Closed
friedger opened this issue Aug 30, 2024 · 3 comments
Closed

slot index and reward index mismatch #2068

friedger opened this issue Aug 30, 2024 · 3 comments
Assignees

Comments

@friedger
Copy link
Contributor

friedger commented Aug 30, 2024

Describe the bug
When querying burnchain_rewards and reward_slot_holders the reward_index and slot_index do not match. Example

859045 slot 0 => 31yuSoYmpkV5TDxuMh2GUfchJFef4kHyus

859045 slot 1 => bc1qs0kkdpsrzh3ngqgth7mkavlwlzr7lms2zv3wxe

859045 reward index 0 => bc1qs0kkdpsrzh3ngqgth7mkavlwlzr7lms2zv3wxe

859045 reward index 1 => 31yuSoYmpkV5TDxuMh2GUfchJFef4kHyus

To Reproduce
Steps to reproduce the behavior:

  1. run sql query select * from reward_slot_holders rsh where canonical and burn_block_height = 859045
  2. run sql query select * from burnchain_rewards br where canonical and burn_block_height = 859045
  3. Compare addresses and see that they do not match

Expected behavior
Address in reward_slot_holders and reward recipient in burnchain_rewards should be the same for the same slot index.

@janniks
Copy link
Collaborator

janniks commented Sep 23, 2024

@obycode do we know if these should be matching from a blockchain core perspective? I'm not sure if the concepts reward index and slot are equivalent everywhere.

@janniks
Copy link
Collaborator

janniks commented Oct 14, 2024

Looked up where they come from on the API end:

reward_recipients: [
{
/** Bitcoin address (b58 encoded). */
recipient: string;
/** Amount in BTC satoshis. */
amt: number;
}
];
/**
* Array of the Bitcoin addresses that would validly receive PoX commitments during this block.
* These addresses may not actually receive rewards during this block if the block is faster
* than miners have an opportunity to commit.
*/
reward_slot_holders: string[];

Both are indexes added by the API and show the position in the array given in the event payload.

It seems the mismatch occurs on the node in the functions: calculate_paid_rewards and pick_recipients. I don't think the ordering is important -- just double checking

@janniks
Copy link
Collaborator

janniks commented Oct 21, 2024

Closing as not a bug, if we really would want these to match, it would require a node change. But it's not really expected that they match, so I don't know if that change is wanted.

@janniks janniks closed this as completed Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants