Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show All 10 Lines | |||||
#include <script/ismine.h> | #include <script/ismine.h> | ||||
#include <script/sign.h> | #include <script/sign.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util.h> | #include <util.h> | ||||
#include <utilstrencodings.h> | #include <utilstrencodings.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <wallet/coinselection.h> | |||||
#include <wallet/crypter.h> | #include <wallet/crypter.h> | ||||
#include <wallet/rpcwallet.h> | #include <wallet/rpcwallet.h> | ||||
#include <wallet/walletdb.h> | #include <wallet/walletdb.h> | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <atomic> | #include <atomic> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <map> | #include <map> | ||||
Show All 14 Lines | |||||
static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000; | static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000; | ||||
//! -paytxfee default | //! -paytxfee default | ||||
static const Amount DEFAULT_TRANSACTION_FEE = Amount::zero(); | static const Amount DEFAULT_TRANSACTION_FEE = Amount::zero(); | ||||
//! -fallbackfee default | //! -fallbackfee default | ||||
static const Amount DEFAULT_FALLBACK_FEE(20000 * SATOSHI); | static const Amount DEFAULT_FALLBACK_FEE(20000 * SATOSHI); | ||||
//! minimum recommended increment for BIP 125 replacement txs | //! minimum recommended increment for BIP 125 replacement txs | ||||
static const Amount WALLET_INCREMENTAL_RELAY_FEE(5000 * SATOSHI); | static const Amount WALLET_INCREMENTAL_RELAY_FEE(5000 * SATOSHI); | ||||
//! target minimum change amount | |||||
static const Amount MIN_CHANGE = CENT; | |||||
//! final minimum change amount after paying for fees | |||||
static const Amount MIN_FINAL_CHANGE = MIN_CHANGE / 2; | |||||
//! Default for -spendzeroconfchange | //! Default for -spendzeroconfchange | ||||
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true; | static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true; | ||||
//! Default for -walletrejectlongchains | //! Default for -walletrejectlongchains | ||||
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS = false; | static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS = false; | ||||
//! Largest (in bytes) free transaction we're willing to create | //! Largest (in bytes) free transaction we're willing to create | ||||
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; | static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; | ||||
static const bool DEFAULT_WALLETBROADCAST = true; | static const bool DEFAULT_WALLETBROADCAST = true; | ||||
static const bool DEFAULT_DISABLE_WALLET = false; | static const bool DEFAULT_DISABLE_WALLET = false; | ||||
▲ Show 20 Lines • Show All 414 Lines • ▼ Show 20 Lines | public: | ||||
* Pass this transaction to the mempool. Fails if absolute fee exceeds | * Pass this transaction to the mempool. Fails if absolute fee exceeds | ||||
* absurd fee. | * absurd fee. | ||||
*/ | */ | ||||
bool AcceptToMemoryPool(const Amount nAbsurdFee, CValidationState &state); | bool AcceptToMemoryPool(const Amount nAbsurdFee, CValidationState &state); | ||||
std::set<TxId> GetConflicts() const; | std::set<TxId> GetConflicts() const; | ||||
}; | }; | ||||
class CInputCoin { | |||||
public: | |||||
CInputCoin(const CWalletTx *walletTx, unsigned int i) { | |||||
if (!walletTx) { | |||||
throw std::invalid_argument("walletTx should not be null"); | |||||
} | |||||
if (i >= walletTx->tx->vout.size()) { | |||||
throw std::out_of_range("The output index is out of range"); | |||||
} | |||||
outpoint = COutPoint(walletTx->GetId(), i); | |||||
txout = walletTx->tx->vout[i]; | |||||
effective_value = txout.nValue; | |||||
} | |||||
COutPoint outpoint; | |||||
CTxOut txout; | |||||
Amount effective_value; | |||||
Amount fee = Amount::zero(); | |||||
Amount long_term_fee = Amount::zero(); | |||||
bool operator<(const CInputCoin &rhs) const { | |||||
return outpoint < rhs.outpoint; | |||||
} | |||||
bool operator!=(const CInputCoin &rhs) const { | |||||
return outpoint != rhs.outpoint; | |||||
} | |||||
bool operator==(const CInputCoin &rhs) const { | |||||
return outpoint == rhs.outpoint; | |||||
} | |||||
}; | |||||
class COutput { | class COutput { | ||||
public: | public: | ||||
const CWalletTx *tx; | const CWalletTx *tx; | ||||
int i; | int i; | ||||
int nDepth; | int nDepth; | ||||
/** Whether we have the private keys to spend this output */ | /** Whether we have the private keys to spend this output */ | ||||
bool fSpendable; | bool fSpendable; | ||||
▲ Show 20 Lines • Show All 884 Lines • Show Last 20 Lines |