From fe7d1cb81c88048bcef7e44f06f63db1787ab7e3 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Thu, 7 Jun 2018 16:47:19 -0600 Subject: [PATCH] Race -> Or Thanks for the suggestion @FishmanL! --- src/budget.rs | 10 +++++----- src/transaction.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/budget.rs b/src/budget.rs index 691fdf84f0..f2e9af5505 100644 --- a/src/budget.rs +++ b/src/budget.rs @@ -41,7 +41,7 @@ pub enum Budget { /// Either make a payment after one condition or a different payment after another /// condition, which ever condition is satisfied first. - Race((Condition, Payment), (Condition, Payment)), + Or((Condition, Payment), (Condition, Payment)), } impl Budget { @@ -68,7 +68,7 @@ impl Budget { tokens: i64, to: PublicKey, ) -> Self { - Budget::Race( + Budget::Or( (Condition::Timestamp(dt), Payment { tokens, to }), (Condition::Signature(from), Payment { tokens, to: from }), ) @@ -88,7 +88,7 @@ impl PaymentPlan for Budget { fn verify(&self, spendable_tokens: i64) -> bool { match self { Budget::Pay(payment) | Budget::After(_, payment) => payment.tokens == spendable_tokens, - Budget::Race(a, b) => a.1.tokens == spendable_tokens && b.1.tokens == spendable_tokens, + Budget::Or(a, b) => a.1.tokens == spendable_tokens && b.1.tokens == spendable_tokens, } } @@ -97,8 +97,8 @@ impl PaymentPlan for Budget { fn apply_witness(&mut self, witness: &Witness) { let new_payment = match self { Budget::After(cond, payment) if cond.is_satisfied(witness) => Some(payment), - Budget::Race((cond, payment), _) if cond.is_satisfied(witness) => Some(payment), - Budget::Race(_, (cond, payment)) if cond.is_satisfied(witness) => Some(payment), + Budget::Or((cond, payment), _) if cond.is_satisfied(witness) => Some(payment), + Budget::Or(_, (cond, payment)) if cond.is_satisfied(witness) => Some(payment), _ => None, }.cloned(); diff --git a/src/transaction.rs b/src/transaction.rs index 16ee0e3b69..e9fcf20b89 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -144,7 +144,7 @@ impl Transaction { last_id: Hash, ) -> Self { let from = from_keypair.pubkey(); - let budget = Budget::Race( + let budget = Budget::Or( (Condition::Timestamp(dt), Payment { tokens, to }), (Condition::Signature(from), Payment { tokens, to: from }), );