Adding transactions to block

This commit is contained in:
Tomasz Drwięga
2016-03-09 12:54:07 +01:00
parent 49f1834ffb
commit 5db84c3233
8 changed files with 52 additions and 12 deletions

View File

@@ -1270,6 +1270,10 @@ impl ChainSync {
// TODO [todr] propagate transactions?
}
pub fn chain_new_head(&mut self, io: &mut SyncIo) {
self.miner.prepare_sealing(io.chain());
}
}
#[cfg(test)]

View File

@@ -158,6 +158,10 @@ impl NetworkProtocolHandler<SyncMessage> for EthSync {
let mut sync_io = NetSyncIo::new(io, self.chain.deref());
self.sync.write().unwrap().chain_new_blocks(&mut sync_io, good, bad, retracted);
},
SyncMessage::NewChainHead => {
let mut sync_io = NetSyncIo::new(io, self.chain.deref());
self.sync.write().unwrap().chain_new_head(&mut sync_io);
}
_ => {/* Ignore other messages */},
}
}

View File

@@ -24,7 +24,7 @@ use io::SyncIo;
use chain::ChainSync;
use ::SyncConfig;
use ethcore::receipt::Receipt;
use ethcore::transaction::{LocalizedTransaction, Transaction, Action};
use ethcore::transaction::{LocalizedTransaction, SignedTransaction, Transaction, Action};
use ethcore::filter::Filter;
use ethcore::log_entry::LocalizedLogEntry;
@@ -311,7 +311,7 @@ impl BlockChainClient for TestBlockChainClient {
}
}
fn prepare_sealing(&self, author: Address, extra_data: Bytes) -> Option<ClosedBlock> {
fn prepare_sealing(&self, author: Address, extra_data: Bytes, transactions: Vec<SignedTransaction>) -> Option<ClosedBlock> {
unimplemented!()
}