oxen-io / oxen-core

Oxen core repository, containing oxend and oxen cli wallets
https://oxen.io
Other
317 stars 120 forks source link

Track recent reward balances & implemented lagged reward balance requests #1711

Closed jagerman closed 2 months ago

jagerman commented 2 months ago

This adds a batching rewards table to always keep around the most recent 5 blocks (in addition to current block), and then uses that to implement rewards signing requests that request the reward at a recent height, rather than relying on each SN to use its own current height.

The RPC endpoint now takes a "height" parameter, which can be a <= 0 value to indicate "N blocks ago" (so 0 = most recent, -1 = one block ago). The default, if omitted, is -1 so that requests get lagged by a block by default, which should avoid issues with a request being made at the same time a block is propagating through the network.