Skip to content

Commit

Permalink
Make RelayWalletTransaction attempt to AcceptToMemoryPool.
Browse files Browse the repository at this point in the history
This resolves an issue where a wallet transaction which failed to
 relay previously because it couldn't make it into the mempool
 will not try again until restart, even though mempool conditions
 may have changed.

Abandoned and known-conflicted transactions are skipped.

Some concern was expressed that there may be users with many
 unknown conflicts would waste a lot of CPU time trying to
 add them to their memory pools over and over again.  But I am
 doubtful these users exist in any number, if they do exist
 they have worse problems, and they can mitigate any performance
 issue this might have by abandoning the transactions in question.

Github-Pull: bitcoin#9290
Rebased-From: f692fce
  • Loading branch information
gmaxwell authored and MarcoFalke committed Dec 14, 2016
1 parent a0f7ece commit 35174a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,9 +1449,10 @@ void CWallet::ReacceptWalletTransactions()
bool CWalletTx::RelayWalletTransaction()
{
assert(pwallet->GetBroadcastTransactions());
if (!IsCoinBase())
if (!IsCoinBase() && !isAbandoned() && GetDepthInMainChain() == 0)
{
if (GetDepthInMainChain() == 0 && !isAbandoned() && InMempool()) {
/* GetDepthInMainChain already catches known conflicts. */
if (InMempool() || AcceptToMemoryPool(false, maxTxFee)) {
LogPrintf("Relaying wtx %s\n", GetHash().ToString());
RelayTransaction((CTransaction)*this);
return true;
Expand Down

0 comments on commit 35174a0

Please sign in to comment.