Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
8d8928e
Encapsulate tx status in a Confirmation struct
Feb 9, 2021
f7baeaf
Remove SyncTransaction for conflicted txn in CWallet::BlockConnected
Feb 9, 2021
ff04fa6
Modify wallet tx status if has been reorged out
furszy Feb 9, 2021
da78039
[Wallet] Adapting TransactionAddedToMempool and BlockDisconnected to …
furszy Feb 10, 2021
46f0e30
Fixing reindex problem, use mapBlockIndex.find() and not mapBlockIndex[]
furszy Feb 11, 2021
370c200
wallet: simplifying pindexRescan set + added an AssertLockHeld on Fin…
furszy Feb 11, 2021
9e51a48
Add a test wallet_reorgsrestore
Feb 11, 2021
e7c8ca6
wallet: remove unused IsInMainChain method
furszy Feb 11, 2021
33f4788
wallet: refactor GetDepthInMainChain to not return the block index.
furszy Feb 11, 2021
4957051
wallet: cache block hash, height and time inside the wallet.
furszy Feb 11, 2021
6320efb
Update wallet last processed index in every unit test that needs it
furszy Feb 11, 2021
4405ac0
Replace CWalletTx::SetConf by Confirmation initialization list
furszy Feb 11, 2021
8aa2d31
Add block_height field in struct Confirmation
furszy Feb 11, 2021
9adeb61
Only return early from BlockUntilSyncedToCurrentChain if current tip
furszy Feb 11, 2021
1386ab7
Use CWallet::m_last_block_processed_height in GetDepthInMainChain
furszy Feb 11, 2021
239d6a2
wallet: remove the now unneeded cs_main locks
furszy Feb 11, 2021
1bd97ca
wallet::MarkConflicted remove blockIndex and there by cs_main lock de…
furszy Feb 11, 2021
5e06330
Removed IsFinalTx() cs_main lock requirement.
furszy Feb 12, 2021
3dede64
GUI: Remove cs_main lock from balance polling timer
furszy Feb 12, 2021
33588fe
GUI: Remove cs_main lock and chain dependency from transaction update…
furszy Feb 12, 2021
0b61857
GUI: fix coinstake tx ordering.
furszy Feb 12, 2021
65fbad1
GUI: remove cs_main lock dependency from transaction model update.
furszy Feb 12, 2021
fcb20c2
GUI: remove cs_main lock dependency from CWalletModel::isSpent, CWall…
furszy Feb 12, 2021
fcc4c83
Move AutoCombineDust functionality to the wallet background thread
furszy Feb 13, 2021
59ed47d
Wallet: remove cs_main lock from AutoCombineDust plus a redundant mat…
furszy Feb 13, 2021
b9220f4
Wallet: Do not add P2CS utxo to autocombine flow and discard them later.
furszy Feb 13, 2021
2e7cdb2
Wallet: added max value out filter for AvailableCoins.
furszy Feb 13, 2021
1e7ffc2
Wallet: remove cs_main requirement from CreateCoinStake
furszy Feb 13, 2021
a7f6ab1
Wallet: remove cs_main requirement from RelayWalletTransaction and Fu…
furszy Feb 13, 2021
5109c8d
Wallet: remove cs_main from IsSaplingSpent() and GetFilteredNotes()
furszy Feb 14, 2021
45c9471
wallet: split CheckTXAvailability in two.
furszy Feb 15, 2021
f889dcb
test : updating wallet's last block processed manually.
furszy Feb 23, 2021
c4952a2
Wallet::CreateWalletFromFile guard direct chainActive access
furszy Feb 23, 2021
c69e7e8
Adapt sapling_wallet_listreceived.py to the new wtx confirmation stru…
furszy Feb 24, 2021
e0a0d2d
sapling_wallet_tests: locking order refactor, solving inconsistent or…
furszy Feb 24, 2021
4ccec74
wallet: Add IsSpent() cs_wallet lock assertion.
furszy Feb 24, 2021
9720579
SSPKM: remove redundant ReadBlockFromDisk from IncrementNoteWitnesses.
furszy Feb 24, 2021
208a292
wallet: remove last cs_main locks from every signal handler function …
furszy Feb 24, 2021
b73500a
wallet:BlockConnected do not lock cs_wallet for its entire process.
furszy Feb 24, 2021
76bc08b
GUI: balance polling update moved to a background worker thread.
furszy Feb 25, 2021
379e5f2
GUI: send screen, move refresh amounts calculation to a background wo…
furszy Feb 25, 2021
6e49a11
GUI: send screen, initialize coinControlDialog view only when it's be…
furszy Feb 26, 2021
44d9cbe
GUI: dashboard screen, remove stakes filter source model if chart is …
furszy Feb 26, 2021
c2d66d0
GUI: cold staking screen, do not initialize coin control dialog at st…
furszy Feb 26, 2021
0a61f7f
GUI: cold staking, do not refresh delegations if the screen is not vi…
furszy Feb 26, 2021
dee4224
Wallet:GetLockedCoins() loop only over the locked coins, not over the…
furszy Feb 26, 2021
0f197ca
Wallet interface: do not load not used cold staking balances.
furszy Feb 26, 2021
b4ab286
GUI: dashboard, charts update delay time increased for IBD.
furszy Feb 26, 2021
69b3330
GUI: txmodel, do not lock cs_wallet if no wtx status update is needed.
furszy Feb 26, 2021
8762e81
Refactoring with QString::toNSString
hebasto Dec 16, 2018
7cb8276
init: move "Done loading" message and rpc warm up finished after the …
furszy Feb 26, 2021
3fb3f34
GUI dashboard: do not update the staking filter if it's not needed.
furszy Feb 26, 2021
bc76186
wallet model: update delay increased to 5 seconds.
furszy Feb 26, 2021
63f3fa7
GUI: add missing qt metatype declarations.
furszy Feb 26, 2021
5658844
wallet: removing unnecessary `mempool.cs` lock from ReacceptWalletTra…
furszy Feb 26, 2021
62cd35f
GUI: MN model, remove now unneeded cs_main locks.
furszy Feb 28, 2021
32538ae
wallet: Disallow abandon of conflicted txes
furszy Feb 28, 2021
e9c160a
wallet: single loop to calculate the currently required balances.
furszy Mar 1, 2021
ef77fdf
GUI: topbar, removing not used block source.
furszy Mar 1, 2021
cbc5021
Masternode-sync read only function to get the "IsBlockchainSynced" st…
furszy Mar 1, 2021
02eb781
GUI: settings information, do not update block num and block hash if …
furszy Mar 1, 2021
a1390c3
wallet balances, cache total delegated balance and calculate it only …
furszy Mar 11, 2021
ca3edc5
GUI: Update worker type if task already exist.
furszy Mar 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@

bool IsFinalTx(const CTransactionRef& tx, int nBlockHeight, int64_t nBlockTime)
{
AssertLockHeld(cs_main);
// Time based nLockTime implemented in 0.1.6
if (tx->nLockTime == 0)
return true;
if (nBlockHeight == 0)
nBlockHeight = chainActive.Height();
if (nBlockTime == 0)
nBlockTime = GetAdjustedTime();
if ((int64_t)tx->nLockTime < ((int64_t)tx->nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/tx_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& ma
* Check if transaction is final and can be included in a block with the
* specified height and time. Consensus critical.
*/
bool IsFinalTx(const CTransactionRef& tx, int nBlockHeight = 0, int64_t nBlockTime = 0);
bool IsFinalTx(const CTransactionRef& tx, int nBlockHeight, int64_t nBlockTime = 0);

#endif // BITCOIN_CONSENSUS_TX_VERIFY_H
7 changes: 4 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1971,11 +1971,9 @@ bool AppInitMain()

// ********************************************************* Step 12: finished

SetRPCWarmupFinished();
uiInterface.InitMessage(_("Done loading"));

#ifdef ENABLE_WALLET
if (pwalletMain) {
uiInterface.InitMessage(_("Reaccepting wallet transactions..."));
pwalletMain->postInitProcess(scheduler);

// StakeMiner thread disabled by default on regtest
Expand All @@ -1985,5 +1983,8 @@ bool AppInitMain()
}
#endif

SetRPCWarmupFinished();
uiInterface.InitMessage(_("Done loading"));

return true;
}
17 changes: 10 additions & 7 deletions src/interfaces/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ namespace interfaces {

WalletBalances Wallet::getBalances() {
WalletBalances result;
result.balance = m_wallet.GetAvailableBalance();
result.unconfirmed_balance = m_wallet.GetUnconfirmedBalance(ISMINE_SPENDABLE_TRANSPARENT);
result.immature_balance = m_wallet.GetImmatureBalance();
CWallet::Balance balance = m_wallet.GetBalance();
result.balance = balance.m_mine_trusted + balance.m_mine_trusted_shield;
result.unconfirmed_balance = balance.m_mine_untrusted_pending;
result.immature_balance = balance.m_mine_immature;
result.have_watch_only = m_wallet.HaveWatchOnly();
if (result.have_watch_only) {
result.watch_only_balance = m_wallet.GetWatchOnlyBalance();
result.unconfirmed_watch_only_balance = m_wallet.GetUnconfirmedWatchOnlyBalance();
result.immature_watch_only_balance = m_wallet.GetImmatureWatchOnlyBalance();
}
result.delegate_balance = m_wallet.GetDelegatedBalance();
result.coldstaked_balance = m_wallet.GetColdStakingBalance();
result.shielded_balance = m_wallet.GetAvailableShieldedBalance();
result.unconfirmed_shielded_balance = m_wallet.GetUnconfirmedShieldedBalance();
result.delegate_balance = balance.m_mine_cs_delegated_trusted;
if (result.have_coldstaking) { // At the moment, the GUI is not using the cold staked balance.
result.coldstaked_balance = m_wallet.GetColdStakingBalance();
}
result.shielded_balance = balance.m_mine_trusted_shield;
result.unconfirmed_shielded_balance = balance.m_mine_untrusted_shielded_balance;
return result;
}

Expand Down
1 change: 1 addition & 0 deletions src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct WalletBalances
CAmount watch_only_balance{0};
CAmount unconfirmed_watch_only_balance{0};
CAmount immature_watch_only_balance{0};
bool have_coldstaking{false};
CAmount delegate_balance{0};
CAmount coldstaked_balance{0};
CAmount shielded_balance{0};
Expand Down
5 changes: 5 additions & 0 deletions src/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ bool CMasternodeSync::IsBlockchainSynced()
return true;
}

bool CMasternodeSync::IsBlockchainSyncedReadOnly() const
{
return fBlockchainSynced;
}

void CMasternodeSync::Reset()
{
fBlockchainSynced = false;
Expand Down
2 changes: 2 additions & 0 deletions src/masternode-sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class CMasternodeSync
bool IsBlockchainSynced();
void ClearFulfilledRequest();

bool IsBlockchainSyncedReadOnly() const;

// Sync message dispatcher
bool MessageDispatcher(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);

Expand Down
20 changes: 20 additions & 0 deletions src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ QString ClientModel::getLastBlockHash() const
return QString::fromStdString(nHash.GetHex());
}

uint256 ClientModel::getLastBlockProcessed() const
{
return cacheTip == nullptr ? Params().GenesisBlock().GetHash() : cacheTip->GetBlockHash();
}

int ClientModel::getLastBlockProcessedHeight() const
{
return cacheTip == nullptr ? 0 : cacheTip->nHeight;
}

int64_t ClientModel::getLastBlockProcessedTime() const
{
return cacheTip == nullptr ? Params().GenesisBlock().GetBlockTime() : cacheTip->GetBlockTime();
}

bool ClientModel::isTipCached() const
{
return cacheTip;
}

double ClientModel::getVerificationProgress() const
{
return Checkpoints::GuessVerificationProgress(cacheTip);
Expand Down
6 changes: 5 additions & 1 deletion src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ class ClientModel : public QObject
int getNumBlocks();
QDateTime getLastBlockDate() const;
QString getLastBlockHash() const;
uint256 getLastBlockProcessed() const;
int getLastBlockProcessedHeight() const;
int64_t getLastBlockProcessedTime() const;
double getVerificationProgress() const;
bool isTipCached() const;

quint64 getTotalBytesRecv() const;
quint64 getTotalBytesSent() const;
Expand Down Expand Up @@ -114,7 +118,7 @@ class ClientModel : public QObject
QString cachedMasternodeCountString;
bool cachedReindexing;
bool cachedImporting;
bool cachedInitialSync;
std::atomic<bool> cachedInitialSync{false};

int numBlocksAtStartup;

Expand Down
1 change: 1 addition & 0 deletions src/qt/coincontroldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class CoinControlDialog : public QDialog
void clearPayAmounts();
void addPayAmount(const CAmount& amount, bool isShieldedRecipient);
void setSelectionType(bool isTransparent) { fSelectTransparent = isTransparent; }
bool hasModel() { return model; }

CCoinControl* coinControl{nullptr};

Expand Down
23 changes: 4 additions & 19 deletions src/qt/macnotificationhandler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,10 @@ - (NSString *)__bundleIdentifier
{
// check if users OS has support for NSUserNotification
if(this->hasUserNotificationCenterSupport()) {
// okay, seems like 10.8+
QByteArray utf8 = title.toUtf8();
char* cString = (char *)utf8.constData();
NSString *titleMac = [[NSString alloc] initWithUTF8String:cString];

utf8 = text.toUtf8();
cString = (char *)utf8.constData();
NSString *textMac = [[NSString alloc] initWithUTF8String:cString];

// do everything weak linked (because we will keep <10.8 compatibility)
id userNotification = [[NSClassFromString(@"NSUserNotification") alloc] init];
[userNotification performSelector:@selector(setTitle:) withObject:titleMac];
[userNotification performSelector:@selector(setInformativeText:) withObject:textMac];

id notificationCenterInstance = [NSClassFromString(@"NSUserNotificationCenter") performSelector:@selector(defaultUserNotificationCenter)];
[notificationCenterInstance performSelector:@selector(deliverNotification:) withObject:userNotification];

[titleMac release];
[textMac release];
NSUserNotification* userNotification = [[NSUserNotification alloc] init];
userNotification.title = title.toNSString();
userNotification.informativeText = text.toNSString();
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: userNotification];
[userNotification release];
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/qt/pivx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifdef ENABLE_WALLET
#include "paymentserver.h"
#include "walletmodel.h"
#include "interfaces/wallet.h"
#endif
#include "masternodeconfig.h"

Expand Down Expand Up @@ -69,6 +70,8 @@ Q_IMPORT_PLUGIN(QGifPlugin);
// Declare meta types used for QMetaObject::invokeMethod
Q_DECLARE_METATYPE(bool*)
Q_DECLARE_METATYPE(CAmount)
Q_DECLARE_METATYPE(interfaces::WalletBalances);
Q_DECLARE_METATYPE(uint256)

static void InitMessage(const std::string& message)
{
Expand Down Expand Up @@ -449,16 +452,17 @@ void BitcoinApplication::requestShutdown()
qDebug() << __func__ << ": Requesting shutdown";
startThread();
window->hide();
window->setClientModel(0);
if (walletModel) walletModel->stop();
window->setClientModel(nullptr);
pollShutdownTimer->stop();

#ifdef ENABLE_WALLET
window->removeAllWallets();
delete walletModel;
walletModel = 0;
walletModel = nullptr;
#endif
delete clientModel;
clientModel = 0;
clientModel = nullptr;

// Show a simple window indicating shutdown status
ShutdownWindow::showShutdownWindow(window);
Expand Down Expand Up @@ -486,6 +490,7 @@ void BitcoinApplication::initializeResult(int retval)
#ifdef ENABLE_WALLET
if (pwalletMain) {
walletModel = new WalletModel(pwalletMain, optionsModel);
walletModel->setClientModel(clientModel);

window->addWallet(PIVXGUI::DEFAULT_WALLET, walletModel);
window->setCurrentWallet(PIVXGUI::DEFAULT_WALLET);
Expand Down Expand Up @@ -569,6 +574,8 @@ int main(int argc, char* argv[])
// Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)
// IMPORTANT if it is no longer a typedef use the normal variant above
qRegisterMetaType<CAmount>("CAmount");
qRegisterMetaType<CAmount>("interfaces::WalletBalances");
qRegisterMetaType<size_t>("size_t");

/// 3. Application identification
// must be set before OptionsModel is initialized or translations are loaded,
Expand Down
14 changes: 9 additions & 5 deletions src/qt/pivx/coldstakingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ ColdStakingWidget::ColdStakingWidget(PIVXGUI* parent) :
void ColdStakingWidget::loadWalletModel()
{
if (walletModel) {
coinControlDialog->setModel(walletModel);
sendMultiRow->setWalletModel(walletModel);
txModel = walletModel->getTransactionTableModel();
csModel = new ColdStakingModel(walletModel, txModel, walletModel->getAddressTableModel(), this);
Expand All @@ -213,10 +212,10 @@ void ColdStakingWidget::loadWalletModel()

addressTableModel = walletModel->getAddressTableModel();
addressesFilter = new AddressFilterProxyModel(AddressTableModel::ColdStaking, this);
addressesFilter->setSourceModel(addressTableModel);
addressesFilter->sort(sortType, sortOrder);
ui->listViewStakingAddress->setModel(addressesFilter);
addressesFilter->setSourceModel(addressTableModel);
ui->listViewStakingAddress->setModelColumn(AddressTableModel::Address);
ui->listViewStakingAddress->setModel(addressesFilter);

connect(txModel, &TransactionTableModel::txArrived, this, &ColdStakingWidget::onTxArrived);

Expand All @@ -225,8 +224,6 @@ void ColdStakingWidget::loadWalletModel()
ui->containerHistoryLabel->setVisible(false);
ui->emptyContainer->setVisible(false);
ui->listView->setVisible(false);

tryRefreshDelegations();
}

}
Expand All @@ -246,8 +243,14 @@ void ColdStakingWidget::walletSynced(bool sync)
}
}

void ColdStakingWidget::showEvent(QShowEvent *event)
{
tryRefreshDelegations();
}

void ColdStakingWidget::tryRefreshDelegations()
{
if (!isVisible()) return;
// Check for min update time to not reload the UI so often if the node is syncing.
int64_t now = GetTime();
if (lastRefreshTime + LOAD_MIN_TIME_INTERVAL < now) {
Expand Down Expand Up @@ -533,6 +536,7 @@ void ColdStakingWidget::onCoinControlClicked()
{
if (isInDelegation) {
if (walletModel->getBalance() > 0) {
if (!coinControlDialog->hasModel()) coinControlDialog->setModel(walletModel);
coinControlDialog->refreshDialog();
setCoinControlPayAmounts();
coinControlDialog->exec();
Expand Down
2 changes: 2 additions & 0 deletions src/qt/pivx/coldstakingwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ColdStakingWidget : public PWidget
void run(int type) override;
void onError(QString error, int type) override;

void showEvent(QShowEvent *event) override;

public Q_SLOTS:
void walletSynced(bool sync);

Expand Down
Loading