Skip to content

mirrornode may excessively forfeit pending reward earned more than 365 days ago #13689

Description

@xin-hedera

Description

Per HIP-406, an account's unclaimed staking rewards is kept up to the past 365 days.

Mirrornode precomputes the pending staking reward for each account and stores the data in database. As a result, mirrornode needs to deduct the pending reward earned by an account more than 365 days ago.

In some corner cases, mirrornode would use the incorrect total balance staked for reward times the reward rate as the amount to deduct. The typical example is:

  • the account started to staked to a node for staking reward 366 days ago, and at the beginning the account has 0 balance
  • a couple of days later, the account got a hbar credit and will start to accumulate staking reward
  • on day 366, mirrornode will try to deduct the staking reward earned by the account on day 1, which should be 0 due to the 0 balance the account had then; however the implementation would use the later non-zero balance times the reward rate on day 1 as the amount to deduct, and this will cause incorrect pending reward from that point on

Steps to reproduce

Check this account, and the pending reward history in entity_stake_history

Additional context

No response

Hedera network

mainnet

Version

v0.155.1

Operating system

None

Metadata

Metadata

Assignees

Labels

bugType: Something isn't workingimporterArea: Importer

Type

Fields

No fields configured for Bug.

Projects

Status
✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions