hinto-janai / gupax

GUI Uniting P2Pool And XMRig
https://gupax.io
GNU General Public License v3.0
261 stars 18 forks source link

Orphan block payouts are included #27

Open hinto-janai opened 1 year ago

hinto-janai commented 1 year ago

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();
    }
}
R3yn4ld commented 1 year ago

Hi, very nice work overall, I used to use docker p2pool+monerod+xmrig, now I rely on your awsome gui.

Actually I check payout for validity via the monerod gui-wallet and edit Gupax files by hand. I'd prefer 99.99% useless connection. Some ideas:

Also, if a payout occurs while gupax is closed, it is missing from history (Same effect with your first solution). My workaround is to export monero transaction with gui-wallet, and then doing manual work with a spreadsheet.