Add an encrypted SQLite transaction history cache with cached tip metadata and per-address shielded scan progress so startup and full refreshes avoid re-scanning every z-address while still invalidating on wallet/address/rescan changes. Improve wallet history loading by paging transparent transactions, preserving cached shielded and sent rows, keeping recent/unconfirmed activity visible, and classifying mining-address receives. Show z_sendmany opid sends immediately in History and Overview, pin pending rows through refreshes, and apply optimistic address/balance debits until opids resolve. Add timestamped RPC console tracing by source/method without logging params or results, reduce redundant refresh/RPC calls, and cache Explorer recent block summaries in SQLite. Expand focused tests for transaction cache encryption, scan-progress persistence/invalidation, history preservation, operation-status parsing, pending send visibility, and Explorer/RPC refresh behavior.
81 lines
2.0 KiB
C++
81 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "ui/sidebar.h"
|
|
|
|
namespace dragonx {
|
|
namespace services {
|
|
|
|
class RefreshScheduler {
|
|
public:
|
|
enum class Timer {
|
|
Core,
|
|
Transactions,
|
|
Addresses,
|
|
Peers,
|
|
Price,
|
|
Fast,
|
|
TxAge,
|
|
Opid
|
|
};
|
|
|
|
struct Intervals {
|
|
float core;
|
|
float transactions;
|
|
float addresses;
|
|
float peers;
|
|
};
|
|
|
|
static constexpr float kCoreDefault = 5.0f;
|
|
static constexpr float kAddressDefault = 15.0f;
|
|
static constexpr float kTransactionDefault = 10.0f;
|
|
static constexpr float kPeerDefault = 10.0f;
|
|
static constexpr float kPrice = 60.0f;
|
|
static constexpr float kFast = 1.0f;
|
|
static constexpr float kTxMaxAge = 15.0f;
|
|
static constexpr float kOpidPoll = 2.0f;
|
|
|
|
static Intervals intervalsForPage(ui::NavPage page);
|
|
|
|
void applyPage(ui::NavPage page);
|
|
void setIntervals(Intervals intervals);
|
|
const Intervals& intervals() const { return intervals_; }
|
|
|
|
void tick(float deltaSeconds);
|
|
|
|
bool isDue(Timer timer) const;
|
|
bool consumeDue(Timer timer);
|
|
void reset(Timer timer);
|
|
void markDue(Timer timer);
|
|
void setTimer(Timer timer, float seconds);
|
|
float timer(Timer timer) const;
|
|
float interval(Timer timer) const;
|
|
|
|
void markImmediateRefresh();
|
|
void markWalletMutationRefresh();
|
|
void resetTxAge();
|
|
bool shouldRefreshTransactions(int lastTxBlockHeight,
|
|
int currentBlockHeight,
|
|
bool transactionsDirty) const;
|
|
|
|
private:
|
|
struct Timers {
|
|
float core = 0.0f;
|
|
float transactions = 0.0f;
|
|
float addresses = 0.0f;
|
|
float peers = 0.0f;
|
|
float price = 0.0f;
|
|
float fast = 0.0f;
|
|
float txAge = 0.0f;
|
|
float opid = 0.0f;
|
|
};
|
|
|
|
float& timerRef(Timer timer);
|
|
const float& timerRef(Timer timer) const;
|
|
|
|
Intervals intervals_{kCoreDefault, kTransactionDefault, kAddressDefault, kPeerDefault};
|
|
Timers timers_;
|
|
};
|
|
|
|
} // namespace services
|
|
} // namespace dragonx
|