28 #include <QtConcurrent/QtConcurrent>
35 static std::string toHexStr(
const T& obj)
43 optionsModel(optionsModel),
44 cachedEncryptionStatus(Unencrypted),
147 std::vector<COutput> vCoins;
149 for (
const COutput& out : vCoins) {
150 bool fSkip = fUnlockedOnly &&
isLockedCoin(out.tx->GetHash(), out.i);
151 if (out.fSpendable && !fSkip)
152 nBalance += out.tx->tx->vout[out.i].nValue;
163 return getBalance(coinControl, fIncludeDelegated,
true, fIncludeShielded);
168 return MIN_COLDSTAKING_AMOUNT;
208 if (!
wallet)
return false;
215 if (!
wallet)
return false;
220 static bool IsImportingOrReindexing()
239 if (!lockWallet)
return false;
247 QMetaObject::invokeMethod(
this,
"updateTxModelData", Qt::QueuedConnection);
248 QMetaObject::invokeMethod(
this,
"pollFinished", Qt::QueuedConnection);
255 static void processBalanceChange(
WalletModel* walletModel)
268 static uint8_t waitLonger = 0;
287 pollFuture = QtConcurrent::run(processBalanceChange,
this);
307 QMetaObject::invokeMethod(
this,
"balanceNotify", Qt::QueuedConnection);
389 std::cout <<
"Exception updateAddressBook" << std::endl;
402 bool isStaking =
false, isExchange =
false;
404 const auto regDest = boost::get<CTxDestination>(&dest);
416 bool isStaking =
false, isExchange =
false;
431 }
else if (optAdd->name != strName) {
458 QList<SendCoinsRecipient> recipients = transaction->
getRecipients();
459 std::vector<CRecipient> vecSend;
461 if (recipients.empty()) {
469 QSet<QString> setAddress;
478 if (rcp.amount <= 0) {
481 setAddress.insert(rcp.address);
489 if (rcp.ownerAddress.isEmpty()) {
493 ownerAdd = *res.getObjResult();
498 const CKeyID* stakerId = boost::get<CKeyID>(&out);
500 if (!stakerId || !ownerId) {
510 vecSend.emplace_back(scriptPubKey, rcp.amount, rcp.fSubtractFee);
515 if (setAddress.size() != nAddresses) {
521 if (total > nSpendableBalance) {
530 int nChangePosInOut = -1;
531 std::string strFailReason;
547 if ((total + nFeeRequired) > nSpendableBalance) {
551 Q_EMIT
message(tr(
"Send Coins"), tr(
"Transaction creation failed!\n%1").arg(
552 strFailReason ==
"Transaction too large" ?
553 tr(
"The size of the transaction is too big.\nSelect fewer inputs with coin control.") :
554 QString::fromStdString(strFailReason)),
578 QByteArray transaction_array;
591 transaction_array.append(&(ssTx[0]), ssTx.
size());
599 bool isStaking =
false, isExchange =
false, isShielded =
false;
603 std::string strLabel = rcp.label.toStdString();
614 bool fromTransparent,
618 std::vector<SendManyRecipient> recipients;
619 for (
const auto& recipient : modelTransaction->
getRecipients()) {
620 bool fSubtractFeeFromAmount = recipient.fSubtractFee;
621 if (recipient.isShieldedAddr) {
623 if (!pa)
return errorOut(
"Error, invalid shielded address");
624 recipients.emplace_back(*pa, recipient.amount, recipient.message.toStdString(), fSubtractFeeFromAmount);
628 recipients.emplace_back(dest, recipient.amount, fSubtractFeeFromAmount);
634 if (!opResult)
return opResult;
646 if (!operationResult) {
647 return operationResult;
652 txRef = MakeTransactionRef(operation.
getFinalTx());
654 return operationResult;
663 return {
false ,
"Error making fee transaction for proposal. Please check your wallet balance."};
668 extraValues.emplace(
"proposal", toHexStr(proposal));
671 return {
false,
strprintf(
"Cannot commit proposal fee transaction: %s", res.
ToString())};
700 if (!
wallet)
throw std::runtime_error(
"Error, cannot get encryption status. Wallet doesn't exist");
767 return error(
"ERROR: Failed to backup wallet!");
775 static void NotifyKeyStoreStatusChanged(
WalletModel* walletmodel)
777 qDebug() <<
"NotifyKeyStoreStatusChanged";
778 QMetaObject::invokeMethod(walletmodel,
"updateStatus", Qt::QueuedConnection);
783 QString strAddress = QString::fromStdString(wallet->
ParseIntoAddress(address, purpose));
784 QString strLabel = QString::fromStdString(label);
785 QString strPurpose = QString::fromStdString(purpose);
787 qDebug() <<
"NotifyAddressBookChanged : " + strAddress +
" " + strLabel +
" isMine=" + QString::number(isMine) +
" purpose=" + strPurpose +
" status=" + QString::number(status);
788 QMetaObject::invokeMethod(walletmodel,
"updateAddressBook", Qt::QueuedConnection,
789 Q_ARG(QString, strAddress),
790 Q_ARG(QString, strLabel),
792 Q_ARG(QString, strPurpose),
797 static bool fQueueNotifications =
false;
798 static std::vector<std::pair<uint256, ChangeType> > vQueueNotifications;
801 if (fQueueNotifications) {
802 vQueueNotifications.emplace_back(hash, status);
806 QString strHash = QString::fromStdString(hash.
GetHex());
808 qDebug() <<
"NotifyTransactionChanged : " + strHash +
" status= " + QString::number(status);
809 QMetaObject::invokeMethod(walletmodel,
"updateTransaction", Qt::QueuedConnection
814 static void ShowProgress(
WalletModel* walletmodel,
const std::string& title,
int nProgress)
817 QMetaObject::invokeMethod(walletmodel,
"showProgress", Qt::QueuedConnection,
818 Q_ARG(QString, QString::fromStdString(title)),
819 Q_ARG(
int, nProgress));
822 static void NotifyWatchonlyChanged(
WalletModel* walletmodel,
bool fHaveWatchonly)
824 QMetaObject::invokeMethod(walletmodel,
"updateWatchOnlyFlag", Qt::QueuedConnection,
825 Q_ARG(
bool, fHaveWatchonly));
828 static void NotifySSTChanged(
WalletModel* walletmodel,
const CAmount stakeSplitThreshold)
830 const double val =
static_cast<double>(stakeSplitThreshold) / COIN;
834 static void NotifyWalletBacked(
WalletModel* model,
const bool fSuccess,
const std::string& filename)
837 std::string title =
"Backup ";
841 message =
"The wallet data was successfully saved to ";
842 title +=
"Successful: ";
843 method = CClientUIInterface::MessageBoxFlags::MSG_INFORMATION;
845 message =
"There was an error trying to save the wallet data to ";
847 method = CClientUIInterface::MessageBoxFlags::MSG_ERROR;
850 message +=
_(filename.data());
852 QMetaObject::invokeMethod(model,
"message", Qt::QueuedConnection,
853 Q_ARG(QString, QString::fromStdString(title)),
854 Q_ARG(QString, QString::fromStdString(message)),
855 Q_ARG(
unsigned int, (
unsigned int)method));
900 was_status(status_before),
901 relock(status_before == Locked || status_before == UnlockedForStaking)
907 if (valid && relock &&
wallet) {
908 if (was_status ==
Locked)
wallet->setWalletLocked(
true);
937 if (this->
isMine(address)) {
945 bool isStaking =
false, isExchange =
false, isShielded =
false;
951 if (this->
isMine(address)) {
988 bool isStaking =
false, isExchange =
false;
991 return error(
"Invalid PIVX address, cold staking address");
1001 return error(
"Invalid PIVX address");
1003 const CKeyID* inKeyID = boost::get<CKeyID>(&address);
1005 return error(
"Unable to get KeyID from PIVX address");
1013 std::string label =
"";
1026 return ret.left(18) +
"..." + ret.right(18);
1037 std::vector<COutput> vCoins;
1039 for (
const COutput& out : vCoins) {
1042 outPoint =
COutPoint(out.tx->GetHash(), out.i);
1081 mapCoins[key].emplace_back(note.
op.
hash,
1094 const std::pair<CTxDestination, Optional<CTxDestination>>& addresses = it.first;
1095 const std::vector<COutput>& coins = it.second;
1097 const QString& address = QString::fromStdString(
EncodeDestination(addresses.first));
1101 const bool isChange = stakerAddr == nullopt ?
wallet->
IsChange(addresses.first) :
false;
1105 for (
const COutput& out: coins) {
1106 mapCoins[key].emplace_back(out.tx->GetHash(),
1108 out.tx->tx->vout[out.i].nValue,
1109 out.tx->GetTxTime(),
1157 std::stringstream ss;
1159 std::string key =
"rr" + ss.str();
1162 if (sRequest.empty())
1180 return boost::get<libzcash::SaplingPaymentAddress>(&address);
int64_t CAmount
Amount in PIV (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
Qt model of the address book in the core.
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
virtual bool HaveWatchOnly(const CScript &dest) const
The block chain is a tree shaped structure starting with the genesis block at the root,...
void SetFeeTxHash(const uint256 &txid)
CBlockIndex * Genesis() const
Returns the index entry for the genesis block of this chain, or nullptr if none.
const Consensus::Params & GetConsensus() const
bool IsRegTestNet() const
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
Wallet status (encrypted, locked) changed.
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
Fee rate in PIV per kilobyte: CAmount / kB.
CAmount GetFee(size_t size) const
An encapsulated private key.
A reference to a CKey: the Hash160 of its serialized public key.
An outpoint - a combination of a transaction hash and an index n into its vout.
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
A key allocated from the key pool.
Serialized script, used inside transaction inputs and outputs.
bool IsSporkActive(SporkId nSporkID)
Capture information about block/transaction validation.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
boost::signals2::signal< void(const CAmount stakeSplitThreshold)> NotifySSTChanged
notify stake-split threshold changed
fs::path GetPathToDBFile()
Get the path to the wallet's db file.
CStakerStatus * pStakerStatus
int GetVersion()
get the current wallet format (the oldest client version guaranteed to understand this wallet)
boost::signals2::signal< void(const bool fSuccess, const std::string &filename)> NotifyWalletBacked
notify wallet file backed up
boost::signals2::signal< void(CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
static CAmount minStakeSplitThreshold
minimum accpeted value for stake split threshold
bool BackupWallet(const std::string &strDest)
Creates a wallet backup in strDest path.
std::vector< std::string > GetDestValues(const std::string &prefix) const
Get all destination values matching a prefix.
bool EraseDestData(const CTxDestination &dest, const std::string &key)
Erases a destination data tuple in the store and on disk.
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
bool fWalletUnlockStaking
SaplingScriptPubKeyMan * GetSaplingScriptPubKeyMan() const
bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value)
Adds a destination data tuple to the store, and saves it to disk.
std::map< CKeyID, CKeyMetadata > mapKeyMetadata
libzcash::SaplingPaymentAddress GenerateNewSaplingZKey(std::string label="")
Generates new Sapling key.
static const CAmount DEFAULT_STAKE_SPLIT_THRESHOLD
CAmount GetStakeSplitThreshold() const
boost::signals2::signal< void(CWallet *wallet, const CWDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)> NotifyAddressBookChanged
Address book entry changed.
WalletDatabase & GetDBHandle() const
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
A transaction with a bunch of additional info that only the owner cares about.
int GetDepthInMainChain() const NO_THREAD_SAFETY_ANALYSIS
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
Model for PIVX network client.
int64_t getLastBlockProcessedTime() const
uint256 getLastBlockProcessed() const
int getLastBlockProcessedHeight() const
bool inInitialBlockDownload() const
Return true if core is doing initial block download.
Wrapper class for every supported address.
const CKeyID * getKeyID()
Interface from Qt to configuration data structure for PIVX client.
void setWalletDefaultOptions(QSettings &settings, bool reset=false)
CTransaction getFinalTx()
SaplingOperation * setSelectShieldedCoins(const bool select)
SaplingOperation * setCoinControl(const CCoinControl *_coinControl)
SaplingOperation * setRecipients(std::vector< SendManyRecipient > &vec)
SaplingOperation * setMinDepth(int _mindepth)
SaplingOperation * setSelectTransparentCoins(const bool select, const bool _fIncludeDelegated=false)
SaplingOperation * setTransparentKeyChange(CReserveKey *reserveKey)
An outpoint - a combination of a transaction hash and an index n into its sapling output description ...
Optional< libzcash::SaplingPaymentAddress > GetOutPointAddress(const CWalletTx &tx, const SaplingOutPoint &op) const
Return the shielded address of a specific outpoint of wallet transaction.
Optional< libzcash::SaplingPaymentAddress > GetAddressFromInputIfPossible(const CWalletTx *wtx, int index) const
Return the address from where the shielded spend is taking the funds from (if possible)
UI model for the transaction table of a wallet.
void updateConfirmations()
Access to the wallet database.
bool WriteCustomFeeValue(const CAmount &nCustomFee)
bool WriteUseCustomFee(bool fUse)
UnlockContext(WalletModel *wallet, bool valid, const WalletModel::EncryptionStatus &status_before)
void CopyFrom(UnlockContext &&rhs)
Interface to PIVX wallet from Qt view code.
OptionsModel * optionsModel
int getLastBlockProcessedNum() const
bool validateAddress(const QString &address)
AddressTableModel * addressTableModel
void getAvailableP2CSCoins(std::vector< COutput > &vCoins) const
bool isStakingStatusActive() const
void balanceChanged(const interfaces::WalletBalances &walletBalances)
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
std::unique_ptr< interfaces::Handler > m_handler_notify_watch_only_changed
void lockCoin(uint256 hash, unsigned int n, bool isTransparent=true)
EncryptionStatus cachedEncryptionStatus
QString getSaplingAddressString(const CWalletTx *wtx, const SaplingOutPoint &op) const
void coinsSent(CWallet *wallet, const SendCoinsRecipient &recipient, const QByteArray &transaction)
void message(const QString &title, const QString &body, unsigned int style, bool *ret=nullptr)
CallResult< Destination > getNewAddress(const std::string &label="") const
ClientModel * m_client_model
bool isWalletLocked(bool fFullUnlocked=true) const
bool isMine(const CWDestination &address)
bool isTestNetwork() const
std::string getLabelForAddress(const CTxDestination &address)
bool updateAddressBookLabels(const CWDestination &address, const std::string &strName, const std::string &strPurpose)
bool isSaplingInMaintenance() const
void resetWalletOptions(QSettings &settings)
CAmount getLockedBalance(bool isTransparent) const
bool isShutdownRequested()
void unlockCoin(uint256 hash, unsigned int n, bool isTransparent=true)
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
CAmount getUnlockedBalance(const CCoinControl *coinControl=nullptr, bool fIncludeDelegated=true, bool fIncludeShielded=true) const
void listCoins(std::map< ListCoinsKey, std::vector< ListCoinsValue >> &mapCoins, bool fSelectTransparent) const
void listAvailableNotes(std::map< ListCoinsKey, std::vector< ListCoinsValue >> &mapCoins) const
void setWalletCustomFee(bool fUseCustomFee, const CAmount nFee=DEFAULT_TRANSACTION_FEE)
void encryptionStatusChanged(int status)
void pollBalanceChanged()
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
bool isV6Enforced() const
CallResult< Destination > getNewShieldedAddress(std::string strLabel="")
Return a new shielded address.
bool getWalletCustomFee(CAmount &nFeeRet)
bool addKeys(const CKey &key, const CPubKey &pubkey, WalletRescanReserver &reserver)
bool upgradeWallet(std::string &upgradeError)
TransactionTableModel * transactionTableModel
std::unique_ptr< interfaces::Handler > m_handler_notify_transaction_changed
ClientModel & clientModel() const
void notifyWatchonlyChanged(bool fHaveWatchonly)
bool updateAddressBookPurpose(const QString &addressStr, const std::string &purpose)
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
void notifyReceiveAddressChanged()
bool isStakingOnlyUnlocked()
bool getKeyId(const CTxDestination &address, CKeyID &keyID)
void emitBalanceChanged()
void setCacheNumBlocks(int _cachedNumBlocks)
CAmount getMinColdStakingAmount() const
bool isWalletUnlocked() const
void setClientModel(ClientModel *client_model)
OperationResult PrepareShieldedTransaction(WalletModelTransaction *modelTransaction, bool fromTransparent, const CCoinControl *coinControl=nullptr)
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
AddressTableModel * getAddressTableModel()
bool blacklistAddressFromColdStaking(const QString &address)
CAmount getWalletStakeSplitThreshold() const
OptionsModel * getOptionsModel()
int getWalletTxDepth(const uint256 &txHash) const
SendCoinsReturn prepareTransaction(WalletModelTransaction *transaction, const CCoinControl *coinControl=nullptr, bool fIncludeDelegations=true)
std::set< COutPoint > listLockedCoins()
bool whitelistAddressFromColdStaking(const QString &addressStr)
bool getMNCollateralCandidate(COutPoint &outPoint)
bool processBalanceChangeInternal()
bool isColdStaking() const
bool backupWallet(const QString &filename)
std::unique_ptr< interfaces::Handler > m_handler_notify_status_changed
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString(), bool stakingOnly=false)
std::unique_ptr< interfaces::Handler > m_handler_notify_sst_changed
double getSSTMinimum() const
EncryptionStatus getEncryptionStatus() const
CAmount getDelegatedBalance() const
bool isColdStakingNetworkelyEnabled() const
Whether cold staking is enabled or disabled in the network.
uint256 m_cached_best_block_hash
interfaces::WalletBalances m_cached_balances
int64_t getKeyCreationTime(const CPubKey &key)
bool fForceCheckBalanceChanged
bool haveWatchOnly() const
interfaces::WalletBalances getBalances()
void notifySSTChanged(const double sstVal)
notify stake-split threshold changed
bool getPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
Q_INVOKABLE void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
OperationResult createAndSendProposalFeeTx(CBudgetProposal &prop)
void unsubscribeFromCoreSignals()
bool isSpent(const COutPoint &outpoint) const
bool IsShieldedDestination(const CWDestination &address)
bool isLockedCoin(uint256 hash, unsigned int n, bool isTransparent=true) const
Optional< QString > getShieldedAddressFromSpendDesc(const uint256 &txHash, int index)
std::unique_ptr< interfaces::Handler > m_handler_notify_walletbacked
int64_t getCreationTime() const
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
uint256 getLastBlockProcessed() const
void updateWatchOnlyFlag(bool fHaveWatchonly)
CallResult< Destination > getNewStakingAddress(const std::string &label="") const
Return a new address used to receive for delegated cold stake purpose.
void setCacheBlockHash(const uint256 &_blockHash)
void setWalletDefaultFee(CAmount fee=DEFAULT_TRANSACTION_FEE)
CAmount getBalance(const CCoinControl *coinControl=nullptr, bool fIncludeDelegated=true, bool fUnlockedOnly=false, bool fIncludeShielded=true) const
std::set< SaplingOutPoint > listLockedNotes()
UnlockContext requestUnlock()
QFuture< void > pollFuture
void setWalletStakeSplitThreshold(const CAmount nStakeSplitThreshold)
std::unique_ptr< interfaces::Handler > m_handler_notify_addressbook_changed
WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
bool isRegTestNetwork() const
const CWalletTx * getTx(uint256 id)
void setfForceCheckBalanceChanged(bool _fForceCheckBalanceChanged)
std::unique_ptr< interfaces::Handler > m_handler_show_progress
bool lockForStakingOnly(const SecureString &passPhrase=SecureString())
bool isUsed(CTxDestination address)
bool isSaplingWalletEnabled() const
@ AmountWithFeeExceedsBalance
@ TransactionCreationFailed
@ CannotCreateInternalAddress
void subscribeToCoreSignals()
bool hasWalletCustomFee()
TransactionTableModel * getTransactionTableModel()
Data model for a walletmodel transaction.
void setTransactionFee(const CAmount &newFee)
QList< SendCoinsRecipient > getRecipients()
CReserveKey * getPossibleKeyChange()
CReserveKey * newPossibleKeyChange(CWallet *wallet)
unsigned int getTransactionSize()
CTransactionRef & getTransaction()
bool fIsStakeDelegationVoided
RAII object to check and reserve a wallet rescan.
std::string GetHex() const
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
void UnlockCoin(const COutPoint &output)
void GetAvailableP2CSCoins(std::vector< COutput > &vCoins) const
Available coins (P2CS)
static std::string ParseIntoAddress(const CWDestination &dest, const std::string &purpose)
CAmount GetDelegatedBalance() const
std::map< std::pair< CTxDestination, Optional< CTxDestination > >, std::vector< COutput > > ListCoins() const
Return list of available coins and locked coins grouped by non-change output address.
void LockNote(const SaplingOutPoint &op)
CWallet::CommitResult CommitTransaction(CTransactionRef tx, CReserveKey &opReservekey, CConnman *connman)
bool CreateTransaction(const std::vector< CRecipient > &vecSend, CTransactionRef &txRet, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl *coinControl=nullptr, bool sign=true, CAmount nFeePay=0, bool fIncludeDelegated=false, bool *fStakeDelegationVoided=nullptr, int nExtraSize=0, int nMinDepth=0)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
CAmount GetLockedShieldCoins() const
bool IsLockedNote(const SaplingOutPoint &op) const
CAmount GetLockedCoins() const
std::set< SaplingOutPoint > ListLockedNotes()
bool AvailableCoins(std::vector< COutput > *pCoins, const CCoinControl *coinControl=nullptr, AvailableCoinsFilter coinsFilter=AvailableCoinsFilter()) const
populate vCoins with vector of available COutputs.
bool SetStakeSplitThreshold(const CAmount sst)
bool CreateBudgetFeeTX(CTransactionRef &tx, const uint256 &hash, CReserveKey &keyChange, CAmount fee)
std::string GetNameForAddressBookEntry(const CWDestination &address) const
std::map< libzcash::SaplingPaymentAddress, std::vector< SaplingNoteEntry > > ListNotes() const
Return list of available shield notes and locked shield notes grouped by sapling address.
CAmount GetAvailableBalance(bool fIncludeDelegated=true, bool fIncludeShielded=true) const
std::set< COutPoint > ListLockedCoins()
bool SetAddressBook(const CWDestination &address, const std::string &strName, const std::string &purpose)
bool IsLockedCoin(const uint256 &hash, unsigned int n) const
std::string ToString() const
void LockCoin(const COutPoint &output)
Optional< AddressBook::CAddressBookData > GetAddressBookEntry(const CWDestination &address) const
void UnlockNote(const SaplingOutPoint &op)
CallResult< CTxDestination > getNewAddress(const std::string &addressLabel, const std::string purpose, const CChainParams::Base58Type addrType=CChainParams::PUBKEY_ADDRESS)
bool SetMaxVersion(int nVersion)
change which version we're allowed to upgrade to (note that this does not immediately imply upgrading...
bool Upgrade(std::string &error, const int prevVersion)
Upgrade wallet to HD and Sapling if needed.
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
CBlockIndex * ScanForWalletTransactions(CBlockIndex *pindexStart, CBlockIndex *pindexStop, const WalletRescanReserver &reserver, bool fUpdate=false, bool fromStartup=false)
Scan the block chain (starting in pindexStart) for transactions from or to us.
bool SetMinVersion(enum WalletFeature, WalletBatch *batch_in=nullptr, bool fExplicit=false)
signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVe...
bool Unlock(const SecureString &strWalletPassphrase, bool anonimizeOnly=false)
CallResult< CTxDestination > getNewStakingAddress(const std::string &label)
bool IsHDEnabled() const
Whether the wallet is hd or not //.
bool EncryptWallet(const SecureString &strWalletPassphrase)
bool IsChange(const CTxOut &txout) const
int64_t GetKeyCreationTime(const CWDestination &dest)
const CWalletTx * GetWalletTx(const uint256 &hash) const
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override
Adds a key to the store, and saves it to disk.
bool IsUsed(const CTxDestination address) const
bool IsSaplingUpgradeEnabled() const
Whether the wallet supports Sapling or not //.
bool IsSpent(const COutPoint &outpoint) const
Outpoint is spent if any non-conflicted transaction spends it:
ChangeType
General change type (added, updated, removed).
#define T(expected, seed, data)
std::unique_ptr< CConnman > g_connman
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
bool IsValidDestinationString(const std::string &str, bool fStaking, const CChainParams ¶ms)
const std::string DELEGABLE
const std::string COLD_STAKING_SEND
const std::string DELEGATOR
const std::string SHIELDED_SEND
std::string EncodePaymentAddress(const libzcash::PaymentAddress &zaddr)
Optional< libzcash::SaplingPaymentAddress > DecodeSaplingPaymentAddress(const std::string &strAddress)
bool IsValidDestination(const CWDestination &address)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
CWDestination DecodeDestination(const std::string &strAddress)
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
RecursiveMutex cs_main
Global state.
OperationResult errorOut(const std::string &errorStr)
boost::optional< T > Optional
Substitute for C++17 std::optional.
OperationResult CheckTransactionSize(std::vector< SendManyRecipient > &recipients, bool fromTaddr)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
CSporkManager sporkManager
@ SPORK_19_COLDSTAKING_MAINTENANCE
@ SPORK_20_SAPLING_MAINTENANCE
CScript GetScriptForStakeDelegation(const CKeyID &stakingKey, const CKeyID &spendingKey)
Generate a P2CS script for the given staker and owner keys.
CScript GetScriptForStakeDelegationLOF(const CKeyID &stakingKey, const CKeyID &spendingKey)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a PIVX scriptPubKey for the given CTxDestination.
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
CWallet::CommitStatus status
bool NetworkUpgradeActive(int nHeight, Consensus::UpgradeIndex idx) const
Returns true if the given network upgrade is active as of the given block height.
Sapling note, its location in a transaction, and number of confirmations.
libzcash::SaplingNote note
Collection of wallet balances.
bool balanceChanged(const WalletBalances &prev) const
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define TRY_LOCK(cs, name)
bool error(const char *fmt, const Args &... args)
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a Optional result.
std::shared_ptr< const CTransaction > CTransactionRef
bool CheckTransaction(const CTransaction &tx, CValidationState &state, bool fColdStakingActive)
Transaction validation functions.
const uint256 UINT256_ZERO
constant uint256 instances
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
CFeeRate minRelayTxFee
Fees smaller than this (in upiv) are considered zero fee (for relaying, mining and transaction creati...
std::atomic< bool > fImporting
std::atomic< bool > fReindex
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
CAmount GetRequiredFee(unsigned int nTxBytes)
Return the minimum required fee taking into account the floating relay fee and user set minimum trans...
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE)
Settings.
std::map< std::string, std::string > mapValue_t
std::atomic< bool > processingBalance