| 1757 | } |
| 1758 | |
| 1759 | bool CWallet::SubmitTxMemoryPoolAndRelay(CWalletTx& wtx, std::string& err_string, bool relay) const |
| 1760 | { |
| 1761 | // Can't relay if wallet is not broadcasting |
| 1762 | if (!GetBroadcastTransactions()) return false; |
| 1763 | // Don't relay abandoned transactions |
| 1764 | if (wtx.isAbandoned()) return false; |
| 1765 | // Don't try to submit coinbase transactions. These would fail anyway but would |
| 1766 | // cause log spam. |
| 1767 | if (wtx.IsCoinBase()) return false; |
| 1768 | // Don't try to submit conflicted or confirmed transactions. |
| 1769 | if (GetTxDepthInMainChain(wtx) != 0) return false; |
| 1770 | |
| 1771 | // Submit transaction to mempool for relay |
| 1772 | WalletLogPrintf("Submitting wtx %s to mempool for relay\n", wtx.GetHash().ToString()); |
| 1773 | // We must set TxStateInMempool here. Even though it will also be set later by the |
| 1774 | // entered-mempool callback, if we did not there would be a race where a |
| 1775 | // user could call sendmoney in a loop and hit spurious out of funds errors |
| 1776 | // because we think that this newly generated transaction's change is |
| 1777 | // unavailable as we're not yet aware that it is in the mempool. |
| 1778 | // |
| 1779 | // If broadcast fails for any reason, trying to set wtx.m_state here would be incorrect. |
| 1780 | // If transaction was previously in the mempool, it should be updated when |
| 1781 | // TransactionRemovedFromMempool fires. |
| 1782 | bool ret = chain().broadcastTransaction(wtx.tx, m_default_max_tx_fee, relay, err_string); |
| 1783 | if (ret) wtx.m_state = TxStateInMempool{}; |
| 1784 | return ret; |
| 1785 | } |
| 1786 | |
| 1787 | std::set<uint256> CWallet::GetTxConflicts(const CWalletTx& wtx) const |
| 1788 | { |
nothing calls this directly
no test coverage detected