Generalize process_entries()
And use it in fullnode
This commit is contained in:
@ -260,7 +260,10 @@ impl Bank {
|
|||||||
.collect()
|
.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 {
|
for entry in entries {
|
||||||
self.register_entry_id(&entry.id);
|
self.register_entry_id(&entry.id);
|
||||||
for result in self.process_transactions(entry.transactions) {
|
for result in self.process_transactions(entry.transactions) {
|
||||||
|
@ -114,17 +114,7 @@ fn main() {
|
|||||||
bank.register_entry_id(&entry1.id);
|
bank.register_entry_id(&entry1.id);
|
||||||
|
|
||||||
eprintln!("processing entries...");
|
eprintln!("processing entries...");
|
||||||
|
bank.process_entries(entries).expect("process_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
eprintln!("creating networking stack...");
|
eprintln!("creating networking stack...");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user