Repository navigation
Conversation
…and cache invalid ones
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #295
Summary
Previously, manual transaction prioritisation (
POST /api/tx/prioritize/:txid/:fee_delta) applied the fee delta in Bitcoin Core and recorded it immediately. It did not check whether the transaction was actually in the node's mempool. If an invalid or missing transaction was prioritised, Bitcoin Core kept the fee delta, but the transaction could not be mined.Following the pattern established in #294, this PR verifies that manually prioritised transactions exist in the mempool. If a transaction is missing, it is fetched from
mempool.spaceand submitted to the node. If submission fails, the fee delta is restored, and the transaction is recorded in theBAD_TRANSACTIONScache.Key Changes
src/api/routes.rs, addedensure_prioritized_transaction_in_mempoolto verifyin_mempoolviaget_prioritised_transactions()after applying the fee delta.mempool.spaceand submits it viarpc.submit_transaction().prioritise_transaction(&txid, -fee_delta)).BAD_TRANSACTIONS.400 Bad Request.PrioritizingTxsto cleanly support test and custommempool.spaceendpoints.manual_prioritization_of_invalid_tx_not_in_mempool_restores_and_records_bad_tx.manual_prioritization_fetches_and_submits_missing_mempool_transaction.getprioritisedtransactions.Verification
cargo test --lib api::routes(14/14 passed)rustfmt --edition 2021 src/lib.rs src/main.rs src/api/mod.rs src/api/routes.rscargo clippy --lib --bin dmnd-client --all-features -- -D warnings(clean, zero warnings)