Generalize process_entries()

And use it in fullnode
This commit is contained in:
Greg Fitzgerald 2018-05-31 10:04:56 -06:00
parent 60609a44ba
commit 80f07dadc5
2 changed files with 5 additions and 12 deletions

View File

@ -260,7 +260,10 @@ impl Bank {
.collect()
}
pub fn process_entries(&self, entries: Vec<Entry>) -> Result<()> {
pub fn process_entries<I>(&self, entries: I) -> Result<()>
where
I: IntoIterator<Item = Entry>,
{
for entry in entries {
self.register_entry_id(&entry.id);
for result in self.process_transactions(entry.transactions) {

View File

@ -114,17 +114,7 @@ fn main() {
bank.register_entry_id(&entry1.id);
eprintln!("processing entries...");
for entry in entries {
let results = bank.process_transactions(entry.transactions);
for result in results {
if let Err(e) = result {
eprintln!("failed to process transaction {:?}", e);
exit(1);
}
}
bank.register_entry_id(&entry.id);
}
bank.process_entries(entries).expect("process_entries");
eprintln!("creating networking stack...");