Transaction broadcast (#209)

* Add transaction broadcast to all known peers once they have been
accepted by our own transaction pool.
* Some debug log

Fixes #200
This commit is contained in:
Ignotus Peverell
2017-10-25 21:06:24 +00:00
committed by GitHub
parent 7178b400b8
commit e2e24bc38e
7 changed files with 76 additions and 2 deletions
+15
View File
@@ -163,6 +163,21 @@ pub trait BlockChain {
fn head_header(&self) -> Result<block::BlockHeader, PoolError>;
}
/// Bridge between the transaction pool and the rest of the system. Handles
/// downstream processing of valid transactions by the rest of the system, most
/// importantly the broadcasting of transactions to our peers.
pub trait PoolAdapter: Send + Sync {
/// The transaction pool has accepted this transactions as valid and added
/// it to its internal cache.
fn tx_accepted(&self, tx: &transaction::Transaction);
}
/// Dummy adapter used as a placeholder for real implementations
pub struct NoopAdapter {}
impl PoolAdapter for NoopAdapter {
fn tx_accepted(&self, _: &transaction::Transaction) {}
}
/// 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