|
|
|
@ -1886,7 +1886,7 @@ void CWallet::ReacceptWalletTransactions()
|
|
|
|
|
for (const std::pair<const int64_t, CWalletTx*>& item : mapSorted) {
|
|
|
|
|
CWalletTx& wtx = *(item.second);
|
|
|
|
|
CValidationState state;
|
|
|
|
|
wtx.AcceptToMemoryPool(*locked_chain, maxTxFee, state);
|
|
|
|
|
wtx.AcceptToMemoryPool(*locked_chain, state);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1897,7 +1897,7 @@ bool CWalletTx::RelayWalletTransaction(interfaces::Chain::Lock& locked_chain)
|
|
|
|
|
{
|
|
|
|
|
CValidationState state;
|
|
|
|
|
/* GetDepthInMainChain already catches known conflicts. */
|
|
|
|
|
if (InMempool() || AcceptToMemoryPool(locked_chain, maxTxFee, state)) {
|
|
|
|
|
if (InMempool() || AcceptToMemoryPool(locked_chain, state)) {
|
|
|
|
|
pwallet->WalletLogPrintf("Relaying wtx %s\n", GetHash().ToString());
|
|
|
|
|
if (pwallet->chain().p2pEnabled()) {
|
|
|
|
|
pwallet->chain().relayTransaction(GetHash());
|
|
|
|
@ -3180,7 +3180,7 @@ bool CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::ve
|
|
|
|
|
if (fBroadcastTransactions)
|
|
|
|
|
{
|
|
|
|
|
// Broadcast
|
|
|
|
|
if (!wtx.AcceptToMemoryPool(*locked_chain, maxTxFee, state)) {
|
|
|
|
|
if (!wtx.AcceptToMemoryPool(*locked_chain, state)) {
|
|
|
|
|
WalletLogPrintf("CommitTransaction(): Transaction cannot be broadcast immediately, %s\n", FormatStateMessage(state));
|
|
|
|
|
// TODO: if we expect the failure to be long term or permanent, instead delete wtx from the wallet and return failure.
|
|
|
|
|
} else {
|
|
|
|
@ -4474,17 +4474,14 @@ bool CMerkleTx::IsImmatureCoinBase(interfaces::Chain::Lock& locked_chain) const
|
|
|
|
|
return GetBlocksToMaturity(locked_chain) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CWalletTx::AcceptToMemoryPool(interfaces::Chain::Lock& locked_chain, const CAmount& nAbsurdFee, CValidationState& state)
|
|
|
|
|
bool CWalletTx::AcceptToMemoryPool(interfaces::Chain::Lock& locked_chain, CValidationState& state)
|
|
|
|
|
{
|
|
|
|
|
LockAnnotation lock(::cs_main); // Temporary, for AcceptToMemoryPool below. Removed in upcoming commit.
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
// user could call sendmoney in a loop and hit spurious out of funds errors
|
|
|
|
|
// because we think that this newly generated transaction's change is
|
|
|
|
|
// unavailable as we're not yet aware that it is in the mempool.
|
|
|
|
|
bool ret = ::AcceptToMemoryPool(mempool, state, tx, nullptr /* pfMissingInputs */,
|
|
|
|
|
nullptr /* plTxnReplaced */, false /* bypass_limits */, nAbsurdFee);
|
|
|
|
|
bool ret = locked_chain.submitToMemoryPool(tx, pwallet->chain().maxTxFee(), state);
|
|
|
|
|
fInMempool |= ret;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|