New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add omni_discardmempooltransaction call #353
Add omni_discardmempooltransaction call #353
Conversation
I'm sort of doubtful this actually works, because I'd assume connected peers won't accept the updated transaction, if they already have them? Other than that, before Omni Wallet implements a fancy way to replace transactions, it would be a better start to use proper fee estimations. |
@zathras-crypto @dexX7 |
@dexX7 agreed fee-handling is important, and I've talked to the OW guys about using I understand what you're saying about peers accepting the updated transaction, but please consider the use case: From @achamely :
And my introduction to the PR :
Long story short it's specifically intended for use when the rest of the network has discarded the transaction. My understanding of the issue from @achamely is that his local node (the one he broadcast through) did not discard the transaction whilst the rest of the network did, and this PR is simply to allow that edge case to be cleaned up without a restart of the node. Hope that helps clarify :) |
My bad, I missed that part. Well, I'm still suspicious, but if you guys think this will work, I'm absolutely fine with it. :) Code looks good to me. |
@achamely: if you need a quick fix immediently, you may try the hidden RPC clearmempool, which clears the whole mempool. |
[Hangs head in shame] Sorry guys, looks like I wasted all our time! I did look for an existing call to remove a transaction from the mempool and didn't find one, hence this PR. Given that there is a call to clear the mempool already, this PR is kind of pointless. @achamely since you're not mining blocks you can simply flush the mempool in its entirety to achieve the same thing this PR does. This PR is on a more granular level, but unless you're using the mempool for other purposes ('Chest uses the mempool to provide unconfirmed tx support) then may as well just flush it empty. Should I close this without merging? I don't see much value in adding capability that's essentially already there. Thanks |
Hey Z, don't leave your head hanging. :) 'clearmempool' is the last resort in my opinion, and in case of Omni Wallet the finer level may be needed, to avoid messing with outgoing transactions. Then again, these may already be in other node's mempools. As mentioned, I'm fine with the PR, if Adam needs it. :) |
Thanks guys, its not any immediate necessity (the issue that caused the original problem i was able to work around). But do keep it open for now we may want to revisit it in another week or 2 after we finish the rebrand and start working on the newer enhanced features. |
No worries, we'll put it on hold for now :) |
Given this PR is outdated and needs further review, it's going to be closed for now. |
This PR serves to add the capability to Omni Core to manually remove a transaction from the mempool.
Talking with @achamely on issues with OmniWallet whereby a transaction is sent with too low a fee and doesn't get included in a block then gets stuck in the mempool (after being discarded by the rest of the network), Creating a second transaction to respend those inputs with a higher fee does not work as it's essentially trying to broadcast a double spend through the same node which will be rejected. A restart of the node is then required (or broadcasting through an alternate node).
A new call is thus added with this PR;
omni_discardmempooltransaction
, just supply a TXID.In using this call, the transaction will be discarded from the mempool, but will be readded if another node relays it back so the workflow should be to prepare the replacement transaction, remove the stuck transaction from the mempool and immediately broadcast its replacement.
Note: this PR has nothing to do with RBF.
Note: it's important to note that ideally this shouldn't be used on wallet transactions (the command does not remove transactions from the wallet, just the mempool - since OmniWallet doesn't use the wallet functions of Omni Core this shouldn't be an issue).
Usage is pretty simple. If we look at my current mempool (at time of writing with a just-started node):
Let's remove the first transaction from the mempool:
Now if we check the mempool again, we can see the transaction we removed is no longer there:
@achamely - does this do the trick?
Thanks
Z