[DNM] broadcast tx kernel hash (if supported by peer) (#1929)

broadcast tx kernel hash (if supported by peer)
This commit is contained in:
Antioch Peverell
2018-11-07 09:28:17 +00:00
committed by GitHub
parent 8b546632fe
commit d97a6c2189
10 changed files with 169 additions and 19 deletions
+12
View File
@@ -66,6 +66,18 @@ impl Pool {
.map(|x| x.tx.clone())
}
/// Query the tx pool for an individual tx matching the given kernel hash.
pub fn retrieve_tx_by_kernel_hash(&self, hash: Hash) -> Option<Transaction> {
for x in &self.entries {
for k in x.tx.kernels() {
if k.hash() == hash {
return Some(x.tx.clone());
}
}
}
None
}
/// Query the tx pool for all known txs based on kernel short_ids
/// from the provided compact_block.
/// Note: does not validate that we return the full set of required txs.
+5
View File
@@ -201,6 +201,11 @@ impl TransactionPool {
Ok(())
}
/// Retrieve individual transaction for the given kernel hash.
pub fn retrieve_tx_by_kernel_hash(&self, hash: Hash) -> Option<Transaction> {
self.txpool.retrieve_tx_by_kernel_hash(hash)
}
/// Retrieve all transactions matching the provided "compact block"
/// based on the kernel set.
/// Note: we only look in the txpool for this (stempool is under embargo).