TransactionPool uses non-dummy chain trait

Introduced new non-dummy trait for the blockchain as seen from the
pool that just produces a UTXO. Made to pool parametric on that
trait to get rid of the Box wrapper and still allow the test
implementation.
This commit is contained in:
Ignotus Peverell
2017-06-10 11:31:05 -07:00
parent 384554fc46
commit 172c5e840b
4 changed files with 39 additions and 17 deletions
+9 -2
View File
@@ -34,8 +34,6 @@ use core::core::transaction;
use core::core::block;
use core::core::hash;
/// Placeholder: the data representing where we heard about a tx from.
///
/// Used to make decisions based on transaction acceptance priority from
@@ -84,6 +82,15 @@ pub enum PoolError {
OrphanTransaction,
}
/// Interface that the pool requires from a blockchain implementation.
pub trait BlockChain {
/// Get an unspent output by its commitment. Will return None if the output
/// is spent or if it doesn't exist. The blockchain is expected to produce
/// a result with its current view of the most worked chain, ignoring
/// orphans, etc.
fn get_unspent(&self, output_ref: &Commitment) -> Option<transaction::Output>;
}
/// Pool contains the elements of the graph that are connected, in full, to
/// the blockchain.
/// Reservations of outputs by orphan transactions (not fully connected) are