Remove transaction RPC (#4949)

This commit is contained in:
Tomasz Drwięga
2017-03-19 08:46:51 +01:00
committed by Gav Wood
parent 124ab28c9e
commit 34d28189ea
7 changed files with 72 additions and 15 deletions

View File

@@ -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,

View File

@@ -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>;