7 #ifndef BITCOIN_WALLET_WALLET_H 8 #define BITCOIN_WALLET_WALLET_H 42 #include <boost/signals2/signal.hpp> 45 std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
56 bool AddWallet(
const std::shared_ptr<CWallet> &wallet);
57 bool RemoveWallet(
const std::shared_ptr<CWallet> &wallet);
59 std::vector<std::shared_ptr<CWallet>>
GetWallets();
65 std::vector<bilingual_str> &warnings);
73 uint64_t wallet_creation_flags,
75 std::vector<bilingual_str> &warnings,
76 std::shared_ptr<CWallet> &result);
174 bool fInternal{
false};
180 : pwallet(_pwallet), type(_type) {}
190 bool GetReservedDestination(
CTxDestination &pubkey,
bool internal);
192 void ReturnDestination();
195 void KeepDestination();
213 const std::string &
GetLabel()
const {
return m_label; }
229 if (!mapValue.count(
"n")) {
235 nOrderPos =
atoi64(mapValue[
"n"].c_str());
240 if (nOrderPos == -1) {
243 mapValue[
"n"] =
ToString(nOrderPos);
264 std::vector<uint256> vMerkleBranch;
267 s >> tx >> hashBlock >> vMerkleBranch >> nIndex;
273 bool use_max_sig =
false);
347 AMOUNTTYPE_ENUM_ELEMENTS
350 bool recalculate =
false)
const;
358 mutable bool m_is_cache_empty{
true};
364 : tx(
std::move(arg)) {
372 fTimeReceivedIsTxTime =
false;
376 fChangeCached =
false;
411 : status(s), block_height(b), hashBlock(h), nIndex(i) {}
416 template <
typename Stream>
void Serialize(Stream &s)
const {
419 mapValueCopy[
"fromaccount"] =
"";
422 mapValueCopy[
"timesmart"] =
strprintf(
"%u", nTimeSmart);
426 std::vector<char> dummy_vector1;
428 std::vector<char> dummy_vector2;
430 bool dummy_bool =
false;
432 isAbandoned() ? ABANDON_HASH : m_confirm.
hashBlock;
433 int serializedIndex =
434 isAbandoned() || isConflicted() ? -1 : m_confirm.
nIndex;
435 s << tx << serializedHash << dummy_vector1 << serializedIndex
436 << dummy_vector2 << mapValueCopy << vOrderForm
437 << fTimeReceivedIsTxTime << nTimeReceived << fFromMe << dummy_bool;
444 std::vector<uint256> dummy_vector1;
446 std::vector<CMerkleTx> dummy_vector2;
450 s >> tx >> m_confirm.
hashBlock >> dummy_vector1 >> serializedIndex >>
451 dummy_vector2 >> mapValue >> vOrderForm >> fTimeReceivedIsTxTime >>
452 nTimeReceived >> fFromMe >> dummy_bool;
463 if (serializedIndex == -1 && m_confirm.
hashBlock == ABANDON_HASH) {
465 }
else if (serializedIndex == -1) {
468 m_confirm.
nIndex = serializedIndex;
473 nTimeSmart = mapValue.count(
"timesmart")
474 ? (
unsigned int)
atoi64(mapValue[
"timesmart"])
477 mapValue.erase(
"fromaccount");
478 mapValue.erase(
"spent");
480 mapValue.erase(
"timesmart");
487 m_amounts[DEBIT].
Reset();
488 m_amounts[CREDIT].
Reset();
489 m_amounts[IMMATURE_CREDIT].
Reset();
490 m_amounts[AVAILABLE_CREDIT].
Reset();
491 fChangeCached =
false;
492 m_is_cache_empty =
true;
503 Amount GetImmatureCredit(
bool fUseCache =
true)
const;
509 Amount GetAvailableCredit(
bool fUseCache =
true,
512 Amount GetImmatureWatchOnlyCredit(
const bool fUseCache =
true)
const;
522 void GetAmounts(std::list<COutputEntry> &listReceived,
523 std::list<COutputEntry> &listSent,
Amount &nFee,
531 bool IsEquivalentTo(
const CWalletTx &tx)
const;
533 bool InMempool()
const;
534 bool IsTrusted()
const;
535 bool IsTrusted(std::set<TxId> &trusted_parents)
const;
537 int64_t GetTxTime()
const;
541 bool SubmitMemoryPoolAndRelay(std::string &err_string,
bool relay);
571 int GetBlocksToMaturity()
const;
595 bool IsImmatureCoinBase()
const;
631 bool fSolvableIn,
bool fSafeIn,
bool use_max_sig_in =
false) {
635 fSpendable = fSpendableIn;
636 fSolvable = fSolvableIn;
639 use_max_sig = use_max_sig_in;
642 if (fSpendable && tx) {
656 size_t change_output_size = 0;
657 size_t change_spend_size = 0;
659 size_t tx_noinputs_size = 0;
661 bool m_subtract_fee_outputs =
false;
664 size_t change_spend_size_,
CFeeRate effective_fee_,
665 size_t tx_noinputs_size_)
666 : use_bnb(use_bnb_), change_output_size(change_output_size_),
667 change_spend_size(change_spend_size_), effective_fee(effective_fee_),
668 tx_noinputs_size(tx_noinputs_size_) {}
685 bool accept_no_keys =
false);
687 std::atomic<bool> fAbortRescan{
false};
689 std::atomic<bool> fScanningWallet{
false};
690 std::atomic<int64_t> m_scanning_start{0};
691 std::atomic<double> m_scanning_progress{0};
702 int64_t nNextResend = 0;
703 bool fBroadcastTransactions =
false;
706 std::atomic<int64_t> m_best_block_time{0};
714 void AddToSpends(
const COutPoint &outpoint,
const TxId &wtxid)
741 void MarkConflicted(
const BlockHash &hashBlock,
int conflicting_height,
751 void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>)
764 std::atomic<uint64_t> m_wallet_flags{0};
767 const std::string &strName,
768 const std::string &strPurpose);
771 void UnsetWalletFlagWithDB(
WalletBatch &batch, uint64_t flag);
774 void UnsetBlankWalletFlag(
WalletBatch &batch)
override;
802 int m_last_block_processed_height
GUARDED_BY(cs_wallet) = -1;
804 bool CreateTransactionInternal(
const std::vector<CRecipient> &vecSend,
836 bool SelectCoins(
const std::vector<COutput> &vAvailableCoins,
837 const Amount nTargetValue,
838 std::set<CInputCoin> &setCoinsRet,
Amount &nValueRet,
852 unsigned int nMasterKeyMaxID = 0;
856 std::unique_ptr<WalletDatabase> _database)
857 : m_chain(chain), m_location(location), database(
std::move(_database)) {
868 bool IsCrypted()
const;
869 bool IsLocked()
const override;
873 bool HaveChain()
const {
return m_chain ? true :
false; }
875 std::map<TxId, CWalletTx> mapWallet
GUARDED_BY(cs_wallet);
877 typedef std::multimap<int64_t, CWalletTx *>
TxItems;
880 int64_t nOrderPosNext
GUARDED_BY(cs_wallet) = 0;
881 uint64_t nAccountingEntryNumber = 0;
883 std::map<CTxDestination, CAddressBookData>
887 bool allow_change =
false) const
888 EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
890 std::set<
COutPoint> setLockedCoins GUARDED_BY(cs_wallet);
908 return nWalletMaxVersion >= wf;
914 void AvailableCoins(std::vector<COutput> &
vCoins,
bool fOnlySafe =
true,
919 const uint64_t nMaximumCount = 0)
const 926 std::map<CTxDestination, std::vector<COutput>> ListCoins()
const 942 bool SelectCoinsMinConf(
const Amount nTargetValue,
944 std::vector<OutputGroup> groups,
945 std::set<CInputCoin> &setCoinsRet,
948 bool &bnb_used)
const;
950 bool IsSpent(
const COutPoint &outpoint)
const 954 bool IsSpentKey(
const TxId &txid,
unsigned int n)
const 956 void SetSpentKeyState(
WalletBatch &batch,
const TxId &txid,
unsigned int n,
957 bool used, std::set<CTxDestination> &tx_destinations)
960 std::vector<OutputGroup> GroupOutputs(
const std::vector<COutput> &outputs,
962 const size_t max_ancestors)
const;
964 bool IsLockedCoin(
const COutPoint &outpoint)
const 970 void ListLockedCoins(std::vector<COutPoint> &vOutpts)
const 980 return fScanningWallet ?
GetTimeMillis() - m_scanning_start : 0;
983 return fScanningWallet ? double(m_scanning_progress) : 0;
992 nWalletVersion = nVersion;
993 nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion);
1003 const std::string &key,
const std::string &value)
1007 const std::string &key)
1010 void LoadDestData(
const CTxDestination &dest,
const std::string &key,
1011 const std::string &value)
1015 bool GetDestData(
const CTxDestination &dest,
const std::string &key,
1016 std::string *value)
const 1019 std::vector<std::string> GetDestValues(
const std::string &
prefix)
const 1030 bool accept_no_keys =
false);
1031 bool ChangeWalletPassphrase(
const SecureString &strOldWalletPassphrase,
1033 bool EncryptWallet(
const SecureString &strWalletPassphrase);
1035 void GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth)
const 1037 unsigned int ComputeTimeSmart(
const CWalletTx &wtx)
const;
1043 int64_t IncOrderPosNext(
WalletBatch *batch =
nullptr)
1048 bool AddToWallet(
const CWalletTx &wtxIn,
bool fFlushOnClose =
true);
1051 void blockConnected(
const CBlock &block,
int height)
override;
1052 void blockDisconnected(
const CBlock &block,
int height)
override;
1053 void updatedBlockTip()
override;
1054 int64_t RescanFromTime(int64_t startTime,
1074 std::optional<int> max_height,
1077 void transactionRemovedFromMempool(
const CTransactionRef &ptx)
override;
1078 void ReacceptWalletTransactions() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
1079 void ResendWalletTransactions();
1091 Balance GetBalance(
int min_depth = 0,
bool avoid_reuse =
true)
const;
1095 const std::vector<CRecipient> &vecSend);
1104 const std::set<int> &setSubtractFeeFromOutputs,
1111 const std::map<COutPoint, Coin> &coins,
1113 std::map<int, std::string> &input_errors)
const;
1115 std::string &str_sig)
const;
1135 bool sign =
true,
bool bip32derivs =
true)
const;
1143 bool CreateTransaction(
const std::vector<CRecipient> &vecSend,
1158 void CommitTransaction(
1160 std::vector<std::pair<std::string, std::string>> orderForm);
1163 bool use_max_sig =
false)
const {
1164 std::vector<CTxOut> v_txouts(txouts.size());
1165 std::copy(txouts.begin(), txouts.end(), v_txouts.begin());
1166 return DummySignTx(txNew, v_txouts, use_max_sig);
1169 const std::vector<CTxOut> &txouts,
1170 bool use_max_sig =
false)
const;
1171 bool DummySignInput(
CTxIn &tx_in,
const CTxOut &txout,
1172 bool use_max_sig =
false)
const;
1174 bool ImportScripts(
const std::set<CScript> scripts, int64_t timestamp)
1176 bool ImportPrivKeys(
const std::map<CKeyID, CKey> &privkey_map,
1177 const int64_t timestamp)
1180 const std::vector<CKeyID> &ordered_pubkeys,
1181 const std::map<CKeyID, CPubKey> &pubkey_map,
1182 const std::map<
CKeyID, std::pair<CPubKey, KeyOriginInfo>> &key_origins,
1183 const bool add_keypool,
const bool internal,
const int64_t timestamp)
1185 bool ImportScriptPubKeys(
const std::string &label,
1186 const std::set<CScript> &script_pub_keys,
1187 const bool have_solving_data,
1188 const bool apply_label,
const int64_t timestamp)
1194 bool m_allow_fallback_fee{
true};
1204 Amount m_max_aps_fee{DEFAULT_MAX_AVOIDPARTIALSPEND_FEE};
1214 bool TopUpKeyPool(
unsigned int kpSize = 0);
1216 int64_t GetOldestKeyPoolTime()
const;
1218 std::set<std::set<CTxDestination>> GetAddressGroupings()
const 1220 std::map<CTxDestination, Amount> GetAddressBalances()
const;
1222 std::set<CTxDestination> GetLabelAddresses(
const std::string &label)
const;
1228 void MarkDestinationsDirty(
const std::set<CTxDestination> &destinations)
1231 bool GetNewDestination(
const OutputType type,
const std::string label,
1234 std::string &error);
1246 bool IsChange(
const CTxOut &txout)
const;
1247 bool IsChange(
const CScript &script)
const;
1260 DBErrors ZapWalletTx(std::vector<CWalletTx> &vWtx);
1261 DBErrors ZapSelectTx(std::vector<TxId> &txIdsIn,
1262 std::vector<TxId> &txIdsOut)
1266 const std::string &strName,
const std::string &purpose);
1275 bool fExplicit =
false)
override;
1279 bool SetMaxVersion(
int nVersion);
1285 return nWalletVersion;
1290 std::set<TxId> GetConflicts(
const TxId &txid)
const 1295 bool HasWalletSpend(
const TxId &txid)
const 1299 void Flush(
bool shutdown =
false);
1309 const std::string &label,
bool isMine,
1310 const std::string &purpose,
ChangeType status)>
1317 boost::signals2::signal<void(
CWallet *wallet,
const TxId &txid,
1322 boost::signals2::signal<void(const std::string &title, int nProgress)>
1341 fBroadcastTransactions = broadcast;
1345 bool TransactionCanBeAbandoned(
const TxId &txid)
const;
1351 bool AbandonTransaction(
const TxId &txid);
1357 std::vector<bilingual_str> &warnings);
1363 static std::shared_ptr<CWallet>
1367 std::vector<bilingual_str> &warnings,
1368 uint64_t wallet_creation_flags = 0);
1375 void postInitProcess();
1377 bool BackupWallet(
const std::string &strDest)
const;
1380 bool IsHDEnabled()
const;
1386 bool CanGetAddresses(
bool internal =
false)
const;
1394 void BlockUntilSyncedToCurrentChain()
const 1400 void SetWalletFlag(uint64_t
flags);
1405 void UnsetWalletFlag(uint64_t flag);
1410 bool IsWalletFlagSet(uint64_t flag)
const override;
1416 bool SetWalletFlags(uint64_t overwriteFlags,
bool memOnly);
1419 bool IsLegacy()
const;
1426 std::string wallet_name =
1427 GetName().length() == 0 ?
"default wallet" : GetName();
1435 template <
typename...
Params>
1437 LogPrintf((
"%s " + fmt).c_str(), GetDisplayName(), parameters...);
1440 template <
typename...
Params>
1442 Params... parameters)
const {
1449 std::vector<bilingual_str> &warnings);
1453 std::set<ScriptPubKeyMan *> GetActiveScriptPubKeyMans()
const;
1456 std::set<ScriptPubKeyMan *> GetAllScriptPubKeyMans()
const;
1461 bool internal)
const;
1470 std::set<ScriptPubKeyMan *>
1474 std::unique_ptr<SigningProvider>
1475 GetSolvingProvider(
const CScript &script)
const;
1476 std::unique_ptr<SigningProvider>
1486 void SetupLegacyScriptPubKeyMan();
1489 bool HasEncryptionKeys()
const override;
1494 assert(m_last_block_processed_height >= 0);
1495 return m_last_block_processed_height;
1499 assert(m_last_block_processed_height >= 0);
1500 return m_last_block_processed;
1506 m_last_block_processed_height = block_height;
1507 m_last_block_processed = block_hash;
1511 void ConnectScriptPubKeyManNotifiers();
1527 bool memonly =
false);
1530 void SetupDescriptorScriptPubKeyMans();
1542 const std::string &label);
1560 : m_wallet(w), m_could_reserve(false) {}
1563 assert(!m_could_reserve);
1569 m_could_reserve =
true;
1578 if (m_could_reserve) {
1590 bool use_max_sig =
false)
1594 const std::vector<CTxOut> &txouts,
1595 bool use_max_sig =
false);
1597 #endif // BITCOIN_WALLET_WALLET_H std::shared_ptr< const CTransaction > CTransactionRef
void SetLastBlockProcessed(int block_height, BlockHash block_hash) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Set last block processed height, currently only use in unit test.
std::atomic< bool > fScanningWallet
#define NO_THREAD_SAFETY_ANALYSIS
std::multimap< COutPoint, TxId > TxSpends
Used to keep track of spent outpoints, and detect and report conflicts (double-spends or mutated tran...
std::unique_ptr< WalletDatabase > database
Internal database handle.
std::map< OutputType, ScriptPubKeyMan * > m_external_spk_managers
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.
void BindWallet(CWallet *pwalletIn)
void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
Sign a transaction with the given keystore and previous transactions.
const std::map< uint64_t, std::string > WALLET_FLAG_CAVEATS
static constexpr Amount zero()
std::map< std::string, std::string > mapValue_t
#define LogPrintfToBeContinued
These are aliases used to explicitly state that the message should not end with a newline character...
bool fSolvable
Whether we know how to spend this output, ignoring the lack of keys.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
CWallet(interfaces::Chain *chain, const WalletLocation &location, std::unique_ptr< WalletDatabase > _database)
Construct wallet with specified name and database implementation.
CTxDestination address
The destination.
int64_t GetTimeMillis()
Returns the system time (not mockable)
const std::string & GetLabel() const
bool IsFromMe(const isminefilter &filter) const
std::vector< uint8_t, secure_allocator< uint8_t > > CKeyingMaterial
std::optional< int > last_scanned_height
bool DummySignTx(CMutableTransaction &txNew, const std::set< CTxOut > &txouts, bool use_max_sig=false) const
constexpr OutputType DEFAULT_CHANGE_TYPE
Default for -changetype.
bool use_max_sig
Whether to use the maximum sized, 72 byte signature when calculating the size of the input spend...
CoinSelectionParams coin_selection_params(false, 0, 0, CFeeRate(Amount::zero()), 0)
bool AddWallet(const std::shared_ptr< CWallet > &wallet)
WalletCreationStatus CreateWallet(const CChainParams ¶ms, interfaces::Chain &chain, const SecureString &passphrase, uint64_t wallet_creation_flags, const std::string &name, bilingual_str &error, std::vector< bilingual_str > &warnings, std::shared_ptr< CWallet > &result)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
Keypool has new keys.
int64_t nOrderPos
position in ordered transaction list
bool isConflicted() const
ReserveDestination(CWallet *_pwallet, OutputType _type)
Construct a ReserveDestination object.
An instance of this class represents one database.
bool IsInMainChain() const
static void ReadOrderPos(int64_t &nOrderPos, mapValue_t &mapValue)
static void LogPrintf(const char *fmt, const Args &... args)
static constexpr Amount SATOSHI
static const bool DEFAULT_DISABLE_WALLET
static const Amount MAX_MONEY
No amount larger than this (in satoshi) is valid.
void MarkDirty()
make sure balances are recalculated
bool fSubtractFeeFromAmount
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
A version of CTransaction with the PSBT format.
std::map< unsigned int, CMasterKey > MasterKeyMap
constexpr Amount HIGH_TX_FEE_PER_KB
Discourage users to set fees higher than this amount (in satoshis) per kB.
int nInputBytes
Pre-computed estimated size of this output as a fully-signed input in a transaction.
BlockHash last_scanned_block
Hash and height of most recent block that was successfully scanned.
void WalletLogPrintfToBeContinued(std::string fmt, Params... parameters) const
void UnloadWallet(std::shared_ptr< CWallet > &&wallet)
Explicitly unload and delete the wallet.
int64_t ScanningDuration() const
bool isUnconfirmed() const
DBErrors
Error statuses for the wallet database.
bool fSpendable
Whether we have the private keys to spend this output.
BlockHash last_failed_block
Hash of the most recent block that could not be scanned due to read errors or pruning.
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get last block processed height.
constexpr Amount HIGH_APS_FEE
discourage APS fee higher than this amount
bool fFromMe
From me flag is set to 1 for transactions that were created by the wallet on this bitcoin node...
WalletFeature
(client) version numbers for particular wallet features
double ScanningProgress() const
WalletDatabase & GetDatabase() override
Access to the wallet database.
mapValue_t mapValue
Key/value map with information about the transaction.
std::unique_ptr< interfaces::Handler > HandleLoadWallet(LoadWalletFn load_wallet)
void SetBroadcastTransactions(bool broadcast)
Set whether this wallet broadcasts transactions.
std::string ToString(const T &t)
Locale-independent version of std::to_string.
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn, bool use_max_sig_in=false)
boost::signals2::signal< void(CWallet *wallet)> NotifyStatusChanged
Wallet status (encrypted, locked) changed.
constexpr Amount HIGH_MAX_TX_FEE
-maxtxfee will warn if called with a higher fee than this amount (in satoshis)
void Unserialize(Stream &s)
A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used in a wallet...
static const Amount DEFAULT_FALLBACK_FEE
-fallbackfee default
static constexpr Amount COIN
const std::string & GetName() const
Get wallet name.
void WalletLogPrintf(std::string fmt, Params... parameters) const
Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
constexpr Amount DEFAULT_PAY_TX_FEE
-paytxfee default
An input of a transaction.
int CalculateMaximumSignedInputSize(const CTxOut &txout, const CWallet *pwallet, bool use_max_sig=false)
void SetTx(CTransactionRef arg)
static const BlockHash ABANDON_HASH
Constant used in hashBlock to indicate tx has been abandoned, only used at serialization/deserializat...
bool fSafe
Whether this output is considered safe to spend.
interfaces::Chain * m_chain
Interface for accessing chain state.
static const bool DEFAULT_WALLETBROADCAST
std::map< std::string, std::string > StringMap
Flag set when a wallet contains no HD seed and no private keys, scripts, addresses, and other watch only things, and is therefore "blank.".
WalletDatabase & GetDBHandle()
Get database handle used by this wallet.
RecursiveMutex cs_main
Global state.
bool HaveChain() const
Interface to assert chain access.
Status
New transactions start as UNCONFIRMED.
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE
Default for -spendzeroconfchange.
constexpr OutputType DEFAULT_ADDRESS_TYPE
Default for -addresstype.
isminetype
IsMine() return codes.
An output of a transaction.
const WalletLocation & GetLocation() const
std::shared_ptr< CWallet > GetWallet(const std::string &name)
Descriptor with some wallet metadata.
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
An outpoint - a combination of a transaction hash and an index n into its vout.
void FundTransaction(CWallet *const pwallet, CMutableTransaction &tx, Amount &fee_out, int &change_position, UniValue options, CCoinControl &coinControl)
std::multimap< int64_t, CWalletTx * >::const_iterator m_it_wtxOrdered
unsigned int fTimeReceivedIsTxTime
Special output type for change outputs only.
~ReserveDestination()
Destructor.
RAII object to check and reserve a wallet rescan.
A transaction with a bunch of additional info that only the owner cares about.
std::map< uint256, std::unique_ptr< ScriptPubKeyMan > > m_spk_managers
bool GetBroadcastTransactions() const
Inquire whether this wallet broadcasts transactions.
static constexpr uint64_t MUTABLE_WALLET_FLAGS
bool RemoveWallet(const std::shared_ptr< CWallet > &wallet)
void Serialize(Stream &s) const
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS
Default for -walletrejectlongchains.
static const std::map< std::string, WalletFlags > WALLET_FLAG_MAP
static void NotifyUnload(WalletModel *walletModel)
void Init(const CWallet *pwalletIn)
int64_t atoi64(const char *psz)
CWalletTx(const CWallet *pwalletIn, CTransactionRef arg)
Cachable amount subdivided into watchonly and spendable parts.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
WalletLocation m_location
Wallet location which includes wallet name (see WalletLocation).
static void WriteOrderPos(const int64_t &nOrderPos, mapValue_t &mapValue)
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
static const Amount WALLET_INCREMENTAL_RELAY_FEE(5000 *SATOSHI)
minimum recommended increment for BIP 125 replacement txs
#define LOCKS_EXCLUDED(...)
A BlockHash is a unqiue identifier for a block.
const std::string & GetName() const
Get a name for this wallet for logging/debugging purposes.
MasterKeyMap mapMasterKeys
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
int GetVersion() const
get the current wallet format (the oldest client version guaranteed to understand this wallet) ...
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
A TxId is the identifier of a transaction.
CTxDestination destination
static const Amount DEFAULT_MAX_AVOIDPARTIALSPEND_FEE
maximum fee increase allowed to do partial spend avoidance, even for nodes with this feature disabled...
unsigned int nTimeSmart
Stable timestamp that never changes, and reflects the order a transaction was added to the wallet...
CInputCoin GetInputCoin() const
int GetSpendSize(unsigned int out, bool use_max_sig=false) const
A mutable version of CTransaction.
BlockHash GetLastBlockHash() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
A reference to a CKey: the Hash160 of its serialized public key.
void Unserialize(Stream &s)
Confirmation(Status s=UNCONFIRMED, int b=0, BlockHash h=BlockHash(), int i=0)
void SetLabel(const std::string &label)
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Fee rate in satoshis per kilobyte: Amount / kB.
const std::string GetDisplayName() const override
Returns a bracketed wallet name for displaying in logs, will return [default wallet] if the wallet ha...
void MaybeResendWalletTxs()
Called periodically by the schedule thread.
std::map< OutputType, ScriptPubKeyMan * > m_internal_spk_managers
A wrapper to reserve an address from a wallet.
std::multimap< int64_t, CWalletTx * > TxItems
boost::signals2::signal< void()> NotifyUnload
Wallet is about to be unloaded.
bool CanSupportFeature(enum WalletFeature wf) const override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
check whether we are allowed to upgrade (or already support) to the named feature ...
bool LoadMinVersion(int nVersion) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
static std::vector< COutput > vCoins
The WalletLocation class provides wallet information.
std::atomic< int64_t > m_scanning_start
unsigned int nTimeReceived
time received by this node
The basic transaction that is broadcasted on the network and contained in blocks. ...
Confirmation includes tx status and a triplet of {block height/block hash/tx index in block} at which...
std::atomic< double > m_scanning_progress
ChangeType
General change type (added, updated, removed).
AssertLockHeld(g_cs_orphans)
Indicate that this wallet supports DescriptorScriptPubKeyMan.
std::shared_ptr< CWallet > LoadWallet(const CChainParams &chainParams, interfaces::Chain &chain, const WalletLocation &location, bilingual_str &error, std::vector< bilingual_str > &warnings)
boost::signals2::signal< void(CWallet *wallet, const TxId &txid, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
static constexpr size_t DUMMY_P2PKH_INPUT_SIZE
Pre-calculated constants for input size estimation.
constexpr Amount DEFAULT_TRANSACTION_MAXFEE
-maxtxfee default
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
CoinSelectionParams(bool use_bnb_, size_t change_output_size_, size_t change_spend_size_, CFeeRate effective_fee_, size_t tx_noinputs_size_)
bool error(const char *fmt, const Args &... args)
const CWallet *const pwallet
The wallet to reserve from.
WalletRescanReserver(CWallet &w)
static const Amount DEFAULT_TRANSACTION_MINFEE_PER_KB
-mintxfee default
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig=false) EXCLUSIVE_LOCKS_REQUIRED(wallet -> cs_wallet)
std::vector< std::shared_ptr< CWallet > > GetWallets()
Legacy class used for deserializing vtxPrev for backwards compatibility.
static constexpr uint64_t KNOWN_WALLET_FLAGS
Signature hash type wrapper class.
std::vector< std::pair< std::string, std::string > > vOrderForm
bool IsAbortingRescan() const