Make conditions explicit in races
And boot recursive spending plans. That path required heap allocations. Since we don't have a need for this generality right now, reduce the language to the smallest one that can pass our test suite.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
use hash::Hash;
|
||||
use entry::Entry;
|
||||
use event::Event;
|
||||
use plan::{Action, Plan};
|
||||
use plan::{Action, Plan, PlanEvent};
|
||||
use transaction::Transaction;
|
||||
use signature::{KeyPair, PublicKey, Signature};
|
||||
use mint::Mint;
|
||||
@@ -141,7 +141,7 @@ impl Accountant {
|
||||
}
|
||||
|
||||
let mut plan = tr.plan.clone();
|
||||
let actionable = plan.process_verified_timestamp(self.last_time);
|
||||
let actionable = plan.process_event(PlanEvent::Timestamp(self.last_time));
|
||||
|
||||
if !actionable {
|
||||
self.pending.insert(tr.sig, plan);
|
||||
@@ -154,7 +154,7 @@ impl Accountant {
|
||||
|
||||
fn process_verified_sig(&mut self, from: PublicKey, tx_sig: Signature) -> Result<()> {
|
||||
let actionable = if let Some(plan) = self.pending.get_mut(&tx_sig) {
|
||||
plan.process_verified_sig(from)
|
||||
plan.process_event(PlanEvent::Signature(from))
|
||||
} else {
|
||||
false
|
||||
};
|
||||
@@ -186,7 +186,7 @@ impl Accountant {
|
||||
// Check to see if any timelocked transactions can be completed.
|
||||
let mut completed = vec![];
|
||||
for (key, plan) in &mut self.pending {
|
||||
if plan.process_verified_timestamp(self.last_time) {
|
||||
if plan.process_event(PlanEvent::Timestamp(self.last_time)) {
|
||||
completed.push(key.clone());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user