7 #ifndef RAVEN_WALLET_WALLET_H 8 #define RAVEN_WALLET_WALLET_H 46 static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
48 static const CAmount DEFAULT_TRANSACTION_FEE = 0;
50 static const CAmount DEFAULT_FALLBACK_FEE = 1025000;
52 static const CAmount DEFAULT_DISCARD_FEE = 25000;
54 static const CAmount DEFAULT_TRANSACTION_MINFEE = 1000000;
56 static const CAmount WALLET_INCREMENTAL_RELAY_FEE = 5000;
58 static const CAmount MIN_CHANGE = CENT;
60 static const CAmount MIN_FINAL_CHANGE = MIN_CHANGE/2;
62 static const bool DEFAULT_SPEND_ZEROCONF_CHANGE =
true;
64 static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS =
false;
66 static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 6;
68 static const bool DEFAULT_WALLET_RBF =
false;
69 static const bool DEFAULT_WALLETBROADCAST =
true;
70 static const bool DEFAULT_DISABLE_WALLET =
false;
74 static const int64_t TIMESTAMP_MIN = 0;
119 template <
typename Stream,
typename Operation>
121 int nVersion = s.GetVersion();
126 if (ser_action.ForRead()) {
130 catch (std::ios_base::failure&) {
165 static inline void ReadOrderPos(int64_t& nOrderPos,
mapValue_t& mapValue)
167 if (!mapValue.count(
"n"))
172 nOrderPos =
atoi64(mapValue[
"n"].c_str());
176 static inline void WriteOrderPos(
const int64_t& nOrderPos,
mapValue_t& mapValue)
180 mapValue[
"n"] =
i64tostr(nOrderPos);
223 SetTx(MakeTransactionRef());
229 SetTx(std::move(arg));
250 template <
typename Stream,
typename Operation>
252 std::vector<uint256> vMerkleBranch;
259 void SetMerkleBranch(
const CBlockIndex* pIndex,
int posInBlock);
267 int GetDepthInMainChain(
const CBlockIndex* &pindexRet)
const;
270 int GetBlocksToMaturity()
const;
317 std::vector<std::pair<std::string, std::string> >
vOrderForm;
374 fTimeReceivedIsTxTime =
false;
378 strFromAccount.clear();
379 fDebitCached =
false;
380 fCreditCached =
false;
381 fImmatureCreditCached =
false;
382 fAvailableCreditCached =
false;
383 fWatchDebitCached =
false;
384 fWatchCreditCached =
false;
385 fImmatureWatchCreditCached =
false;
386 fAvailableWatchCreditCached =
false;
387 fChangeCached =
false;
390 nImmatureCreditCached = 0;
391 nAvailableCreditCached = 0;
392 nWatchDebitCached = 0;
393 nWatchCreditCached = 0;
394 nAvailableWatchCreditCached = 0;
395 nImmatureWatchCreditCached = 0;
402 template <
typename Stream,
typename Operation>
404 if (ser_action.ForRead())
408 if (!ser_action.ForRead())
410 mapValue[
"fromaccount"] = strFromAccount;
412 WriteOrderPos(nOrderPos, mapValue);
415 mapValue[
"timesmart"] =
strprintf(
"%u", nTimeSmart);
419 std::vector<CMerkleTx> vUnused;
428 if (ser_action.ForRead())
430 strFromAccount = mapValue[
"fromaccount"];
432 ReadOrderPos(nOrderPos, mapValue);
434 nTimeSmart = mapValue.count(
"timesmart") ? (
unsigned int)
atoi64(mapValue[
"timesmart"]) : 0;
437 mapValue.erase(
"fromaccount");
438 mapValue.erase(
"spent");
440 mapValue.erase(
"timesmart");
446 fCreditCached =
false;
447 fAvailableCreditCached =
false;
448 fImmatureCreditCached =
false;
449 fWatchDebitCached =
false;
450 fWatchCreditCached =
false;
451 fAvailableWatchCreditCached =
false;
452 fImmatureWatchCreditCached =
false;
453 fDebitCached =
false;
454 fChangeCached =
false;
466 CAmount GetImmatureCredit(
bool fUseCache=
true)
const;
467 CAmount GetAvailableCredit(
bool fUseCache=
true)
const;
468 CAmount GetImmatureWatchOnlyCredit(
const bool& fUseCache=
true)
const;
469 CAmount GetAvailableWatchOnlyCredit(
const bool& fUseCache=
true)
const;
472 void GetAmounts(std::list<COutputEntry>& listReceived,
473 std::list<COutputEntry>& listSent,
CAmount& nFee, std::string& strSentAccount,
const isminefilter& filter)
const;
475 void GetAmounts(std::list<COutputEntry>& listReceived,
476 std::list<COutputEntry>& listSent,
CAmount& nFee, std::string& strSentAccount,
const isminefilter& filter, std::list<CAssetOutputEntry>& assetsReceived, std::list<CAssetOutputEntry>& assetsSent)
const;
480 return (GetDebit(filter) > 0);
484 bool IsEquivalentTo(
const CWalletTx& tx)
const;
486 bool InMempool()
const;
487 bool IsTrusted()
const;
489 int64_t GetTxTime()
const;
490 int GetRequestCount()
const;
493 bool RelayWalletTransaction(
CConnman* connman);
495 std::set<uint256> GetConflicts()
const;
504 throw std::invalid_argument(
"walletTx should not be null");
505 if (i >= walletTx->
tx->vout.size())
506 throw std::out_of_range(
"The output index is out of range");
509 txout = walletTx->
tx->vout[i];
548 COutput(
const CWalletTx *txIn,
int iIn,
int nDepthIn,
bool fSpendableIn,
bool fSolvableIn,
bool fSafeIn)
550 tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn;
553 std::string ToString()
const;
574 template <
typename Stream,
typename Operation>
576 int nVersion = s.GetVersion();
612 strOtherAccount.clear();
620 template <
typename Stream,
typename Operation>
622 int nVersion = s.GetVersion();
630 if (!ser_action.ForRead())
632 WriteOrderPos(nOrderPos, mapValue);
634 if (!(mapValue.empty() && _ssExtra.empty()))
637 ss.
insert(ss.begin(),
'\0');
639 ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end());
640 strComment.append(ss.str());
646 size_t nSepPos = strComment.find(
"\0", 0, 1);
647 if (ser_action.ForRead())
650 if (std::string::npos != nSepPos)
652 CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), s.GetType(), s.GetVersion());
654 _ssExtra = std::vector<char>(ss.begin(), ss.end());
656 ReadOrderPos(nOrderPos, mapValue);
658 if (std::string::npos != nSepPos)
659 strComment.erase(nSepPos);
685 bool SelectCoins(
const std::vector<COutput>& vAvailableCoins,
const CAmount& nTargetValue, std::set<CInputCoin>& setCoinsRet,
CAmount& nValueRet,
const CCoinControl *coinControl =
nullptr)
const;
687 bool SelectAssets(
const std::map<std::string, std::vector<COutput> >& mapAvailableAssets,
const std::map<std::string, CAmount>& mapAssetTargetValue, std::set<CInputCoin>& setCoinsRet, std::map<std::string, CAmount>& nValueRet)
const;
706 typedef std::multimap<COutPoint, uint256>
TxSpends;
709 void AddToSpends(
const uint256& wtxid);
712 void MarkConflicted(
const uint256& hashBlock,
const uint256& hashTx);
714 void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>);
742 bool AddWatchOnly(
const CScript& dest)
override;
744 std::unique_ptr<CWalletDBWrapper>
dbw;
766 return dbw->GetName();
772 void LoadKeyPool(int64_t nIndex,
const CKeyPool &keypool);
789 explicit CWallet(std::unique_ptr<CWalletDBWrapper> dbw_in) : dbw(
std::move(dbw_in))
796 delete pwalletdbEncryption;
797 pwalletdbEncryption =
nullptr;
805 pwalletdbEncryption =
nullptr;
807 nAccountingEntryNumber = 0;
810 m_max_keypool_index = 0;
812 fBroadcastTransactions =
false;
814 fAbortRescan =
false;
815 fScanningWallet =
false;
821 typedef std::pair<CWalletTx*, CAccountingEntry*>
TxPair;
822 typedef std::multimap<int64_t, TxPair >
TxItems;
841 void AvailableCoinsAll(std::vector<COutput>& vCoins, std::map<std::string, std::vector<COutput> >& mapAssetCoins,
842 bool fGetRVN =
true,
bool fOnlyAssets =
false,
843 bool fOnlySafe =
true,
const CCoinControl *coinControl =
nullptr,
844 const CAmount& nMinimumAmount = 1,
const CAmount& nMaximumAmount = MAX_MONEY,
845 const CAmount& nMinimumSumAmount = MAX_MONEY,
const uint64_t& nMaximumCount = 0,
846 const int& nMinDepth = 0,
const int& nMaxDepth = 9999999)
const;
851 void AvailableAssets(std::map<std::string, std::vector<COutput> > &mapAssetCoins,
bool fOnlySafe =
true,
853 const CAmount &nMaximumAmount = MAX_MONEY,
const CAmount &nMinimumSumAmount = MAX_MONEY,
854 const uint64_t &nMaximumCount = 0,
const int &nMinDepth = 0,
const int &nMaxDepth = 9999999)
const;
859 void AvailableCoinsWithAssets(std::vector<COutput> &vCoins, std::map<std::string, std::vector<COutput> > &mapAssetCoins,
860 bool fOnlySafe =
true,
const CCoinControl *coinControl =
nullptr,
const CAmount &nMinimumAmount = 1,
861 const CAmount &nMaximumAmount = MAX_MONEY,
const CAmount &nMinimumSumAmount = MAX_MONEY,
862 const uint64_t &nMaximumCount = 0,
const int &nMinDepth = 0,
const int &nMaxDepth = 9999999)
const;
866 void AvailableCoins(std::vector<COutput>& vCoins,
bool fOnlySafe=
true,
const CCoinControl *coinControl =
nullptr,
867 const CAmount& nMinimumAmount = 1,
const CAmount& nMaximumAmount = MAX_MONEY,
868 const CAmount& nMinimumSumAmount = MAX_MONEY,
const uint64_t& nMaximumCount = 0,
869 const int& nMinDepth = 0,
const int& nMaxDepth = 9999999)
const;
874 std::map<CTxDestination, std::vector<COutput>> ListCoins()
const;
879 std::map<CTxDestination, std::vector<COutput>> ListAssets()
const;
893 bool SelectCoinsMinConf(
const CAmount& nTargetValue,
int nConfMine,
int nConfTheirs, uint64_t nMaxAncestors, std::vector<COutput> vCoins, std::set<CInputCoin>& setCoinsRet,
CAmount& nValueRet)
const;
894 bool SelectAssetsMinConf(
const CAmount& nTargetValue,
const int nConfMine,
const int nConfTheirs,
const uint64_t nMaxAncestors,
const std::string& strAssetName, std::vector<COutput> vCoins, std::set<CInputCoin>& setCoinsRet,
CAmount& nValueRet)
const;
896 bool IsSpent(
const uint256& hash,
unsigned int n)
const;
898 bool IsLockedCoin(
uint256 hash,
unsigned int n)
const;
900 void UnlockCoin(
const COutPoint& output);
901 void UnlockAllCoins();
902 void ListLockedCoins(std::vector<COutPoint>& vOutpts)
const;
917 bool AddKeyPubKey(
const CKey& key,
const CPubKey &pubkey)
override;
924 bool LoadMinVersion(
int nVersion) {
AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion);
return true; }
925 void UpdateTimeFirstKey(int64_t nCreateTime);
928 bool AddCryptedKey(
const CPubKey &
vchPubKey,
const std::vector<unsigned char> &vchCryptedSecret)
override;
930 bool LoadCryptedKey(
const CPubKey &vchPubKey,
const std::vector<unsigned char> &vchCryptedSecret);
931 bool AddCScript(
const CScript& redeemScript)
override;
932 bool LoadCScript(
const CScript& redeemScript);
935 bool AddDestData(
const CTxDestination &dest,
const std::string &key,
const std::string &value);
937 bool EraseDestData(
const CTxDestination &dest,
const std::string &key);
939 bool LoadDestData(
const CTxDestination &dest,
const std::string &key,
const std::string &value);
941 bool GetDestData(
const CTxDestination &dest,
const std::string &key, std::string *value)
const;
943 std::vector<std::string> GetDestValues(
const std::string&
prefix)
const;
946 bool AddWatchOnly(
const CScript& dest, int64_t nCreateTime);
947 bool RemoveWatchOnly(
const CScript &dest)
override;
949 bool LoadWatchOnly(
const CScript &dest);
955 bool ChangeWalletPassphrase(
const SecureString& strOldWalletPassphrase,
const SecureString& strNewWalletPassphrase);
956 bool EncryptWallet(
const SecureString& strWalletPassphrase);
958 void GetKeyBirthTimes(std::map<CTxDestination, int64_t> &mapKeyBirth)
const;
959 unsigned int ComputeTimeSmart(
const CWalletTx& wtx)
const;
965 int64_t IncOrderPosNext(
CWalletDB *pwalletdb =
nullptr);
967 bool AccountMove(std::string strFrom, std::string strTo,
CAmount nAmount, std::string strComment =
"");
968 bool GetAccountPubkey(
CPubKey &pubKey, std::string strAccount,
bool bForceNew =
false);
971 bool AddToWallet(
const CWalletTx& wtxIn,
bool fFlushOnClose=
true);
972 bool LoadToWallet(
const CWalletTx& wtxIn);
974 void BlockConnected(
const std::shared_ptr<const CBlock>& pblock,
const CBlockIndex *pindex,
const std::vector<CTransactionRef>& vtxConflicted)
override;
975 void BlockDisconnected(
const std::shared_ptr<const CBlock>& pblock)
override;
977 int64_t RescanFromTime(int64_t startTime,
bool update);
979 void ReacceptWalletTransactions();
980 void ResendWalletTransactions(int64_t nBestBlockTime,
CConnman* connman)
override;
982 std::vector<uint256> ResendWalletTransactionsBefore(int64_t
nTime,
CConnman* connman);
984 CAmount GetUnconfirmedBalance()
const;
985 CAmount GetImmatureBalance()
const;
986 CAmount GetWatchOnlyBalance()
const;
987 CAmount GetUnconfirmedWatchOnlyBalance()
const;
988 CAmount GetImmatureWatchOnlyBalance()
const;
989 CAmount GetLegacyBalance(
const isminefilter& filter,
int minDepth,
const std::string* account)
const;
996 bool FundTransaction(
CMutableTransaction& tx,
CAmount& nFeeRet,
int& nChangePosInOut, std::string& strFailReason,
bool lockUnspents,
const std::set<int>& setSubtractFeeFromOutputs,
CCoinControl);
1000 bool CreateTransactionWithAssets(
const std::vector<CRecipient>& vecSend,
CWalletTx& wtxNew,
CReserveKey& reservekey,
CAmount& nFeeRet,
int& nChangePosInOut,
1001 std::string& strFailReason,
const CCoinControl& coin_control,
const std::vector<CNewAsset> assets,
const CTxDestination destination,
const AssetType& assetType,
bool sign =
true);
1003 bool CreateTransactionWithTransferAsset(
const std::vector<CRecipient>& vecSend,
CWalletTx& wtxNew,
CReserveKey& reservekey,
CAmount& nFeeRet,
int& nChangePosInOut,
1004 std::string& strFailReason,
const CCoinControl& coin_control,
bool sign =
true);
1006 bool CreateTransactionWithReissueAsset(
const std::vector<CRecipient>& vecSend,
CWalletTx& wtxNew,
CReserveKey& reservekey,
CAmount& nFeeRet,
int& nChangePosInOut,
1009 bool CreateTransaction(
const std::vector<CRecipient>& vecSend,
CWalletTx& wtxNew,
CReserveKey& reservekey,
CAmount& nFeeRet,
int& nChangePosInOut,
1010 std::string& strFailReason,
const CCoinControl& coin_control,
bool sign =
true);
1017 bool CreateTransactionAll(
const std::vector<CRecipient>& vecSend,
CWalletTx& wtxNew,
CReserveKey& reservekey,
CAmount& nFeeRet,
int& nChangePosInOut,
1021 int& nChangePosInOut, std::string& strFailReason,
const CCoinControl& coin_control,
bool fNewAsset,
const std::vector<CNewAsset> assets,
const CTxDestination destination,
bool fTransferAsset,
bool fReissueAsset,
const CReissueAsset& reissueAsset,
const AssetType& assetType,
bool sign);
1023 bool CreateNewChangeAddress(
CReserveKey& reservekey,
CKeyID& keyID, std::string& strFailReason);
1029 void ListAccountCreditDebit(
const std::string& strAccount, std::list<CAccountingEntry>& entries);
1032 template <
typename ContainerType>
1040 size_t KeypoolCountExternalKeys();
1041 bool TopUpKeyPool(
unsigned int kpSize = 0);
1042 void ReserveKeyFromKeyPool(int64_t& nIndex,
CKeyPool& keypool,
bool fRequestedInternal);
1043 void KeepKey(int64_t nIndex);
1045 bool GetKeyFromPool(
CPubKey &key,
bool internal =
false);
1046 int64_t GetOldestKeyPoolTime();
1050 void MarkReserveKeysAsUsed(int64_t keypool_id);
1053 std::set< std::set<CTxDestination> > GetAddressGroupings();
1054 std::map<CTxDestination, CAmount> GetAddressBalances();
1056 std::set<CTxDestination> GetAccountAddresses(
const std::string& strAccount)
const;
1067 bool IsChange(
const CTxOut& txout)
const;
1079 DBErrors LoadWallet(
bool& fFirstRunRet);
1080 DBErrors ZapWalletTx(std::vector<CWalletTx>& vWtx);
1081 DBErrors ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut);
1083 bool SetAddressBook(
const CTxDestination& address,
const std::string& strName,
const std::string& purpose);
1087 const std::string& GetAccountName(
const CScript& scriptPubKey)
const;
1093 std::map<uint256, int>::iterator mi = mapRequestCount.find(hash);
1094 if (mi != mapRequestCount.end())
1099 void GetScriptForMining(std::shared_ptr<CReserveScript> &script);
1104 return setInternalKeyPool.size() + setExternalKeyPool.size();
1111 bool SetMaxVersion(
int nVersion);
1117 std::set<uint256> GetConflicts(
const uint256& txid)
const;
1120 bool HasWalletSpend(
const uint256& txid)
const;
1123 void Flush(
bool shutdown=
false);
1130 &address,
const std::string &label,
bool isMine,
1131 const std::string &purpose,
1138 boost::signals2::signal<void (
CWallet *wallet,
const uint256 &hashTx,
1142 boost::signals2::signal<void (const std::string &title, int nProgress)>
ShowProgress;
1153 bool TransactionCanBeAbandoned(
const uint256& hashTx)
const;
1156 bool AbandonTransaction(
const uint256& hashTx);
1159 bool MarkReplaced(
const uint256& originalHash,
const uint256& newHash);
1162 static CWallet* CreateWalletFromFile(
const std::string walletFile);
1170 bool BackupWallet(
const std::string& strDest);
1173 bool SetHDChain(
const CHDChain& chain,
bool memonly);
1177 bool IsHDEnabled()
const;
1189 bool SetHDSeed(
const CPubKey& key);
1204 pwallet = pwalletIn;
1218 bool GetReservedKey(
CPubKey &pubkey,
bool internal =
false);
1245 template <
typename Stream,
typename Operation>
1247 int nVersion = s.GetVersion();
1258 template <
typename ContainerType>
1261 bool allSigned =
true;
1264 const std::string zeros =
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
1265 const unsigned char* cstrZeros = (
unsigned char*)zeros.c_str();
1269 for (
const auto& coin : coins)
1271 const CScript& scriptPubKey = coin.txout.scriptPubKey;
1290 #endif // RAVEN_WALLET_WALLET_H
std::atomic< bool > fScanningWallet
void UpdateTransaction(CMutableTransaction &tx, unsigned int nIn, const SignatureData &data)
void SetTx(CTransactionRef arg)
static const uint256 ABANDON_HASH
Constant used in hashBlock to indicate tx has been abandoned.
bool CanSupportFeature(enum WalletFeature wf) const
check whether we are allowed to upgrade (or already support) to the named feature ...
void SerializationOp(Stream &s, Operation ser_action)
void SerializationOp(Stream &s, Operation ser_action)
void SerializationOp(Stream &s, Operation ser_action)
int64_t nOrderPos
position in ordered transaction list
CAmount nImmatureWatchCreditCached
bool DummySignTx(CMutableTransaction &txNew, const ContainerType &coins) const
void BindWallet(CWallet *pwalletIn)
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
bool fSolvable
Whether we know how to spend this output, ignoring the lack of keys.
const char * DEFAULT_WALLET_DAT
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
uint64_t nAccountingEntryNumber
const std::map< CKeyID, int64_t > & GetAllReserveKeys() const
char fFromMe
From me flag is set to 1 for transactions that were created by the wallet on this raven node...
std::map< CTxDestination, CAddressBookData > mapAddressBook
CCriticalSection cs_wallet
std::unique_ptr< CWalletDBWrapper > dbw
const uint256 & GetHash() const
bool IsFromMe(const isminefilter &filter) const
std::vector< char > _ssExtra
bool fImmatureCreditCached
std::string strFromAccount
WalletFeature
(client) version numbers for particular wallet features
CWalletDB * pwalletdbEncryption
std::multimap< COutPoint, uint256 > TxSpends
Used to keep track of spent outpoints, and detect and report conflicts (double-spends or mutated tran...
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
int64_t nOrderPos
position in ordered transaction list
std::set< int64_t > setInternalKeyPool
isminetype IsMine(const CKeyStore &keystore, const CScript &scriptPubKey, SigVersion sigversion)
CMerkleTx(CTransactionRef arg)
uint8_t isminefilter
used for bitflags of isminetype
std::map< CKeyID, int64_t > m_pool_key_to_index
void MarkDirty()
make sure balances are recalculated
bool fSubtractFeeFromAmount
unsigned int GetKeyPoolSize()
std::map< unsigned int, CMasterKey > MasterKeyMap
Double ended buffer combining vector and stream-like interfaces.
CFeeRate payTxFee
Settings.
std::map< CTxDestination, CKeyMetadata > mapKeyMetadata
std::atomic< bool > fAbortRescan
DBErrors
Error statuses for the wallet database.
CAmount nWatchDebitCached
Keystore which keeps the private keys encrypted.
int64_t m_max_keypool_index
bool fSpendable
Whether we have the private keys to spend this output.
std::shared_ptr< const CTransaction > CTransactionRef
bool ProduceSignature(const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
bool fAvailableCreditCached
unsigned int nTxConfirmTarget
mapValue_t mapValue
Key/value map with information about the transaction.
std::list< CAccountingEntry > laccentries
int64_t CAmount
Amount in corbies (Can be negative)
std::multimap< int64_t, TxPair > TxItems
bool fAvailableWatchCreditCached
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override
Add a key to the store.
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
secp256k1: const unsigned int PRIVATE_KEY_SIZE = 279; const unsigned int PUBLIC_KEY_SIZE = 65; const ...
boost::signals2::signal< void(CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
#define AssertLockHeld(cs)
void SetBroadcastTransactions(bool broadcast)
Set whether this wallet broadcasts transactions.
An instance of this class represents one database.
unsigned int nMasterKeyMaxID
static CFeeRate m_discard_rate
int GetDepthInMainChain() const
bool AcceptToMemoryPool(CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool *pfMissingInputs, std::list< CTransactionRef > *plTxnReplaced, bool bypass_limits, const CAmount nAbsurdFee)
(try to) add transaction to memory pool plTxnReplaced will be appended to with all transactions repla...
std::string GetName() const
Get a name for this wallet for logging/debugging purposes.
ChangeType
General change type (added, updated, removed).
isminetype
IsMine() return codes.
An input of a transaction.
We want to be able to estimate feerates that are needed on tx's to be included in a certain number of...
int GetVersion()
get the current wallet format (the oldest client version guaranteed to understand this wallet) ...
void SerializationOp(Stream &s, Operation ser_action)
An encapsulated public key.
bool fSafe
Whether this output is considered safe to spend.
std::set< COutPoint > setLockedCoins
void KeepScript() override
std::map< std::string, std::string > StringMap
bool LoadKey(const CKey &key, const CPubKey &pubkey)
Adds a key to the store, without saving it to disk (used by LoadWallet)
bool bSpendZeroConfChange
An output of a transaction.
std::map< uint256, int > mapRequestCount
std::set< int64_t > setExternalKeyPool
An outpoint - a combination of a transaction hash and an index n into its vout.
void Inventory(const uint256 &hash) override
Notifies listeners about an inventory item being seen on the network.
unsigned int fTimeReceivedIsTxTime
bool LoadMinVersion(int nVersion)
Access to the wallet database.
CWalletDBWrapper & GetDBHandle()
Get database handle used by this wallet.
int nWalletMaxVersion
the maximum wallet format version: memory-only variable that specifies to what version this wallet ma...
std::vector< CWalletRef > vpwallets
A transaction with a bunch of additional info that only the owner cares about.
bool IsInMainChain() const
bool GetBroadcastTransactions() const
Inquire whether this wallet broadcasts transactions.
bool fBroadcastTransactions
void Init(const CWallet *pwalletIn)
CAmount nWatchCreditCached
CWalletTx(const CWallet *pwalletIn, CTransactionRef arg)
static std::atomic< bool > fFlushScheduled
CAmount nAvailableCreditCached
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
iterator insert(iterator it, const char &x=char())
boost::signals2::signal< void(CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)> NotifyAddressBookChanged
Address book entry changed.
static CFeeRate fallbackFee
If fee estimation does not have enough data to provide estimates, use this fee instead.
MasterKeyMap mapMasterKeys
A key allocated from the key pool.
The block chain is a tree shaped structure starting with the genesis block at the root...
Serialized script, used inside transaction inputs and outputs.
CTxDestination destination
unsigned int nTimeSmart
Stable timestamp that never changes, and reflects the order a transaction was added to the wallet...
void SerializationOp(Stream &s, Operation ser_action)
Private key that includes an expiration date in case it never gets used.
A reference to a CKey: the Hash160 of its serialized public key.
#define LIMITED_STRING(obj, n)
static CFeeRate minTxFee
Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) Override with ...
int64_t atoi64(const char *psz)
int nWalletVersion
the current wallet version: clients below this version are not able to load the wallet ...
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Fee rate in satoshis per kilobyte: CAmount / kB.
std::string i64tostr(int64_t n)
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn)
CReserveKey(CWallet *pwalletIn)
CWallet(std::unique_ptr< CWalletDBWrapper > dbw_in)
std::map< uint256, CWalletTx > mapWallet
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
void SerializationOp(Stream &s, Operation ser_action)
A mutable version of CTransaction.
CAmount nAvailableWatchCreditCached
unsigned int nTimeReceived
time received by this node
An encapsulated private key.
The basic transaction that is broadcasted on the network and contained in blocks. ...
bool fImmatureWatchCreditCached
const CHDChain & GetHDChain() const
CTxDestination destination
std::pair< CWalletTx *, CAccountingEntry * > TxPair
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
std::string strOtherAccount
int64_t nRelockTime
Holds a timestamp at which point the wallet is scheduled (externally) to be relocked. Caller must arrange for actual relocking to occur via Lock().
Wrapped boost mutex: supports recursive locking, but no waiting TODO: We should move away from using ...
CAmount nImmatureCreditCached
std::map< std::string, std::string > mapValue_t
A signature creator that just produces 72-byte empty signatures.
std::vector< std::pair< std::string, std::string > > vOrderForm