diff --git a/src/transaction.rs b/src/transaction.rs index 9cf7a68f69..0c42f1a151 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -35,7 +35,7 @@ pub struct Payment { #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] pub enum Plan { Action(Action), - After(Condition, Action), + After(Condition, Box>), Race(Box>, Box>), } @@ -46,7 +46,7 @@ impl Plan { Plan::Race(ref plan_a, ref plan_b) => { plan_a.verify(spendable_assets) && plan_b.verify(spendable_assets) } - Plan::After(_, ref action) => action.spendable() == *spendable_assets, + Plan::After(_, ref plan) => plan.verify(spendable_assets), } } @@ -79,9 +79,9 @@ impl Plan { plan_a.process_verified_sig(from); plan_b.process_verified_sig(from); } - Plan::After(Condition::Signature(pubkey), ref action) => { + Plan::After(Condition::Signature(pubkey), ref plan) => { if from == pubkey { - new_plan = Some(Plan::Action(action.clone())); + new_plan = Some((**plan).clone()); } } _ => (), @@ -106,9 +106,9 @@ impl Plan { plan_a.process_verified_timestamp(last_time); plan_b.process_verified_timestamp(last_time); } - Plan::After(Condition::Timestamp(dt), ref action) => { + Plan::After(Condition::Timestamp(dt), ref plan) => { if dt <= last_time { - new_plan = Some(Plan::Action(action.clone())); + new_plan = Some((**plan).clone()); } } _ => (), @@ -164,17 +164,17 @@ impl Transaction { let plan = Plan::Race( Box::new(Plan::After( Condition::Timestamp(dt), - Action::Pay(Payment { + Box::new(Plan::Action(Action::Pay(Payment { asset: asset.clone(), to, - }), + }))), )), Box::new(Plan::After( Condition::Signature(from), - Action::Pay(Payment { + Box::new(Plan::Action(Action::Pay(Payment { asset: asset.clone(), to: from, - }), + }))), )), ); let mut tr = Transaction {