Remove transaction RPC (#4949)
This commit is contained in:
@@ -1018,6 +1018,16 @@ impl MinerService for Miner {
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_pending_transaction(&self, chain: &MiningBlockChainClient, hash: &H256) -> Option<PendingTransaction> {
|
||||
let mut queue = self.transaction_queue.lock();
|
||||
let tx = queue.find(hash);
|
||||
if tx.is_some() {
|
||||
let fetch_nonce = |a: &Address| chain.latest_nonce(a);
|
||||
queue.remove_invalid(hash, &fetch_nonce);
|
||||
}
|
||||
tx
|
||||
}
|
||||
|
||||
fn pending_receipt(&self, best_block: BlockNumber, hash: &H256) -> Option<RichReceipt> {
|
||||
self.from_pending_block(
|
||||
best_block,
|
||||
|
||||
@@ -150,6 +150,10 @@ pub trait MinerService : Send + Sync {
|
||||
/// Query pending transactions for hash.
|
||||
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<PendingTransaction>;
|
||||
|
||||
/// Removes transaction from the queue.
|
||||
/// NOTE: The transaction is not removed from pending block if mining.
|
||||
fn remove_pending_transaction(&self, chain: &MiningBlockChainClient, hash: &H256) -> Option<PendingTransaction>;
|
||||
|
||||
/// Get a list of all pending transactions in the queue.
|
||||
fn pending_transactions(&self) -> Vec<PendingTransaction>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user