Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,504 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool CWalletTx::InMempool() const { | bool CWalletTx::InMempool() const { | ||||
return fInMempool; | return fInMempool; | ||||
} | } | ||||
bool CWalletTx::IsTrusted(interfaces::Chain::Lock &locked_chain) const { | bool CWalletTx::IsTrusted(interfaces::Chain::Lock &locked_chain) const { | ||||
// Quick answer in most cases | // Quick answer in most cases | ||||
CValidationState state; | TxValidationState state; | ||||
if (!locked_chain.contextualCheckTransactionForCurrentBlock( | if (!locked_chain.contextualCheckTransactionForCurrentBlock( | ||||
Params().GetConsensus(), *tx, state)) { | Params().GetConsensus(), *tx, state)) { | ||||
return false; | return false; | ||||
} | } | ||||
int nDepth = GetDepthInMainChain(locked_chain); | int nDepth = GetDepthInMainChain(locked_chain); | ||||
if (nDepth >= 1) { | if (nDepth >= 1) { | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | bool allow_used_addresses = | ||||
(coinControl && !coinControl->m_avoid_address_reuse); | (coinControl && !coinControl->m_avoid_address_reuse); | ||||
const Consensus::Params params = Params().GetConsensus(); | const Consensus::Params params = Params().GetConsensus(); | ||||
for (const auto &entry : mapWallet) { | for (const auto &entry : mapWallet) { | ||||
const TxId &wtxid = entry.first; | const TxId &wtxid = entry.first; | ||||
const CWalletTx &wtx = entry.second; | const CWalletTx &wtx = entry.second; | ||||
CValidationState state; | TxValidationState state; | ||||
if (!locked_chain.contextualCheckTransactionForCurrentBlock( | if (!locked_chain.contextualCheckTransactionForCurrentBlock( | ||||
params, *wtx.tx, state)) { | params, *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
if (wtx.IsImmatureCoinBase(locked_chain)) { | if (wtx.IsImmatureCoinBase(locked_chain)) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 928 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** | /** | ||||
* Call after CreateTransaction unless you want to abort | * Call after CreateTransaction unless you want to abort | ||||
*/ | */ | ||||
bool CWallet::CommitTransaction( | bool CWallet::CommitTransaction( | ||||
CTransactionRef tx, mapValue_t mapValue, | CTransactionRef tx, mapValue_t mapValue, | ||||
std::vector<std::pair<std::string, std::string>> orderForm, | std::vector<std::pair<std::string, std::string>> orderForm, | ||||
CValidationState &state) { | TxValidationState &state) { | ||||
auto locked_chain = chain().lock(); | auto locked_chain = chain().lock(); | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
CWalletTx wtxNew(this, std::move(tx)); | CWalletTx wtxNew(this, std::move(tx)); | ||||
wtxNew.mapValue = std::move(mapValue); | wtxNew.mapValue = std::move(mapValue); | ||||
wtxNew.vOrderForm = std::move(orderForm); | wtxNew.vOrderForm = std::move(orderForm); | ||||
wtxNew.fTimeReceivedIsTxTime = true; | wtxNew.fTimeReceivedIsTxTime = true; | ||||
wtxNew.fFromMe = true; | wtxNew.fFromMe = true; | ||||
▲ Show 20 Lines • Show All 1,802 Lines • Show Last 20 Lines |