fix(core): refresh transaction history on the Mining tab
The Mining tab shows earnings derived from transaction history, but it was not treated as a wallet-data page, so newly mined or paid-out earnings did not appear until the user left the tab and came back. A coinbase row also changes category in place (immature becomes generate at maturity, or orphan on a reorg), and the Recent merge kept both the old and the new row, double-counting the earnings. - The Mining tab now gets the cheap between-blocks Recent poll: one listtransactions per new block, bounded by the 15 s transaction-age timer, once history has loaded. It never runs a full routine scan and never pre-empts an owed dirty cycle; tracked sends still take their normal cycle on any page. - The shielded-payout probe runs only while the pool miner is running, since pool payouts are shielded receives while a solo miner's earnings are transparent coinbase rows. - The Recent merge drops the previous row of the other coinbase category when a coinbase transitions, so maturing or reorged rewards are no longer counted twice. A non-coinbase row sharing the txid is left alone. Behaviour change: mining earnings update on the Mining tab per block instead of only on tab re-entry, and maturing or reorged coinbase rows no longer double-count. Tests: the per-block poll gate (one poll per block, due only after history loads, held while dirty or addresses are dirty), the Mining-page cycle shaping, and the coinbase transition merge for immature to generate, generate to orphan, and a shared-txid non-coinbase row. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -148,5 +148,23 @@ struct TxCycleInputs {
|
||||
// Light cycle, so it can't loop them at one tip.
|
||||
TxCycle decideTxCycle(const TxCycleInputs& in);
|
||||
|
||||
// The Mining tab shows history-derived earnings but is not a wallet-data page: it gets the cheap between-blocks
|
||||
// poll (recent listtransactions rows) and nothing routine. Explicit work (first load, dirty, new addresses) and
|
||||
// tracked sends still go through the normal cycles on any page.
|
||||
TxCycleInputs shapeTxCycleForMiningPage(TxCycleInputs in);
|
||||
|
||||
struct MiningTxPollInputs {
|
||||
int tip = 0; // current chain height
|
||||
int lastPolledTip = -1; // the tip the last Mining poll was dispatched at (-1 = none)
|
||||
bool txAgeDue = false; // RefreshTimer::TxAge due (15 s since the last Recent poll / full cycle)
|
||||
bool historyLoaded = false; // last_tx_block_height_ >= 0
|
||||
bool dirty = false; // transactions_dirty_
|
||||
bool addressesDirty = false; // addresses_dirty_
|
||||
};
|
||||
// One poll per new block (confirmation counts and new coinbase rows only change with a block), after the history
|
||||
// has loaded, never while a dirty cycle is already owed. Unlike the wallet pages, an EMPTY history may poll (a fresh
|
||||
// miner's first block must appear).
|
||||
bool miningTxPollDue(const MiningTxPollInputs& in);
|
||||
|
||||
} // namespace services
|
||||
} // namespace dragonx
|
||||
|
||||
Reference in New Issue
Block a user