Cleanup: replace bool retval with is_complete() method
This commit is contained in:
@@ -141,20 +141,21 @@ impl Accountant {
|
||||
}
|
||||
|
||||
let mut plan = tr.plan.clone();
|
||||
let actionable = plan.process_witness(Witness::Timestamp(self.last_time));
|
||||
plan.process_witness(Witness::Timestamp(self.last_time));
|
||||
|
||||
if !actionable {
|
||||
if plan.is_complete() {
|
||||
self.complete_transaction(&plan);
|
||||
} else {
|
||||
self.pending.insert(tr.sig, plan);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.complete_transaction(&plan);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
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_witness(Witness::Signature(from))
|
||||
plan.process_witness(Witness::Signature(from));
|
||||
plan.is_complete()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
@@ -186,7 +187,8 @@ 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_witness(Witness::Timestamp(self.last_time)) {
|
||||
plan.process_witness(Witness::Timestamp(self.last_time));
|
||||
if plan.is_complete() {
|
||||
completed.push(key.clone());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user