diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-12-06 06:39:14 +0000 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2016-12-06 08:01:27 +0000 |
commit | f692fce8a49e05e25f1c767aae1e50db419caebe (patch) | |
tree | 00b64f620bd85a2f47c98eea22a4487748d682be | |
parent | 7d5d44969b4ab46a5146a46b4ed1ed7704d71c63 (diff) |
Make RelayWalletTransaction attempt to AcceptToMemoryPool.
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.
-rw-r--r-- | src/wallet/wallet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 638fca9917..43ffb71457 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1542,9 +1542,11 @@ void CWallet::ReacceptWalletTransactions() bool CWalletTx::RelayWalletTransaction(CConnman* connman) { assert(pwallet->GetBroadcastTransactions()); - if (!IsCoinBase()) + if (!IsCoinBase() && !isAbandoned() && GetDepthInMainChain() == 0) { - if (GetDepthInMainChain() == 0 && !isAbandoned() && InMempool()) { + CValidationState state; + /* GetDepthInMainChain already catches known conflicts. */ + if (InMempool() || AcceptToMemoryPool(maxTxFee, state)) { LogPrintf("Relaying wtx %s\n", GetHash().ToString()); if (connman) { CInv inv(MSG_TX, GetHash()); |