Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,365 Lines • ▼ Show 20 Lines | void CWallet::BlockUntilSyncedToCurrentChain() { | ||||
AssertLockNotHeld(cs_main); | AssertLockNotHeld(cs_main); | ||||
AssertLockNotHeld(cs_wallet); | AssertLockNotHeld(cs_wallet); | ||||
{ | { | ||||
// Skip the queue-draining stuff if we know we're caught up with | // Skip the queue-draining stuff if we know we're caught up with | ||||
// chainActive.Tip()... | // chainActive.Tip()... | ||||
// We could also take cs_wallet here, and call m_last_block_processed | // We could also take cs_wallet here, and call m_last_block_processed | ||||
// protected by cs_wallet instead of cs_main, but as long as we need | // protected by cs_wallet instead of cs_main, but as long as we need | ||||
// cs_main here anyway, its easier to just call it cs_main-protected. | // cs_main here anyway, it's easier to just call it cs_main-protected. | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
const CBlockIndex *initialChainTip = chainActive.Tip(); | const CBlockIndex *initialChainTip = chainActive.Tip(); | ||||
if (m_last_block_processed->GetAncestor(initialChainTip->nHeight) == | if (m_last_block_processed->GetAncestor(initialChainTip->nHeight) == | ||||
initialChainTip) { | initialChainTip) { | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,282 Lines • ▼ Show 20 Lines | bool CWalletTx::AcceptToMemoryPool(const Amount nAbsurdFee, | ||||
// Quick check to avoid re-setting fInMempool to false | // Quick check to avoid re-setting fInMempool to false | ||||
if (g_mempool.exists(tx->GetId())) { | if (g_mempool.exists(tx->GetId())) { | ||||
return false; | return false; | ||||
} | } | ||||
// We must set fInMempool here - while it will be re-set to true by the | // We must set fInMempool here - while it will be re-set to true by the | ||||
// entered-mempool callback, if we did not there would be a race where a | // entered-mempool callback, if we did not there would be a race where a | ||||
// user could call sendmoney in a loop and hit spurious out of funds errors | // user could call sendmoney in a loop and hit spurious out of funds errors | ||||
// because we think that the transaction they just generated's change is | // because we think that this newly generated transaction's change is | ||||
// unavailable as we're not yet aware its in mempool. | // unavailable as we're not yet aware that it is in the mempool. | ||||
bool ret = ::AcceptToMemoryPool( | bool ret = ::AcceptToMemoryPool( | ||||
GetConfig(), g_mempool, state, tx, true /* fLimitFree */, | GetConfig(), g_mempool, state, tx, true /* fLimitFree */, | ||||
nullptr /* pfMissingInputs */, false /* fOverrideMempoolLimit */, | nullptr /* pfMissingInputs */, false /* fOverrideMempoolLimit */, | ||||
nAbsurdFee); | nAbsurdFee); | ||||
fInMempool = ret; | fInMempool = ret; | ||||
return ret; | return ret; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |