gupax icon indicating copy to clipboard operation
gupax copied to clipboard

Orphan block payouts are included

Open hinto-janai opened this issue 1 year ago • 1 comments

When P2Pool finds a payout, Gupax immediately saves it into it's own history.

In the case of orphan blocks, this payout is no longer existent, yet Gupax has already has written the data to the file and cannot remove it. There's not really a good way to fix this. Possible solutions and their drawbacks:

Solution Drawback
Wait a few minutes (2-3 blocks) before appending data Payout data will hang in memory, what happens when the user exits Gupax during this time? Flush the possible bad data to disk? Ignore it?
Check each payout for validity via the current monerod connection We have to make tons of connections that are 99.99% of the time useless
Upon Gupax startup, check payout validity via monerod RPC calls Same as above
Upon Gupax startup, check payout validity via a hardcoded list of known orphaned blocks Maintaining this is painful

The first two will also have the drawback of having delayed data, aka, when a payout is received, the user won't immediately see it in the [Status] tab and submenus.

Another solution (that puts the burden on the user) is to have a UI for deleting a payout line from the history, automatically deducting it from the total XMR received, and total payout count:

// Errors that aren't handled:
//   - Parsing `&str` -> `u64/f64`
//   - Subtraction underflows
//   - Writing to disk

for (line, payout) in payout_log_lines.enumerate() {
    if user_clicked_remove {
        subtract_payout(payout);
        remove_payout_log_line(line);
        decrement_total_payout_count();
    }
}

hinto-janai avatar Apr 20 '23 17:04 hinto-janai