Skip to content

Commit

Permalink
Add System account to the start of scheduling transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
afalaleev committed Nov 13, 2024
1 parent 19546eb commit 8e91f5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::account::legacy::{TAG_HOLDER_DEPRECATED, TAG_STATE_FINALIZED_DEPRECATED};
use crate::account::{
AccountsDB, Operator, OperatorBalanceAccount, OperatorBalanceValidator, StateAccount,
program, AccountsDB, Operator, OperatorBalanceAccount, OperatorBalanceValidator, StateAccount,
TransactionTree, TAG_HOLDER, TAG_SCHEDULED_STATE_CANCELLED, TAG_SCHEDULED_STATE_FINALIZED,
TAG_STATE, TAG_STATE_FINALIZED,
};
Expand All @@ -26,14 +26,15 @@ pub fn process<'a>(
let transaction_tree = TransactionTree::from_account(&program_id, accounts[1].clone())?;
let operator = Operator::from_account(&accounts[2])?;
let operator_balance = OperatorBalanceAccount::try_from_account(program_id, &accounts[3])?;
let system = program::System::from_account(&accounts[4])?;

operator_balance.validate_owner(&operator)?;

let accounts_db = AccountsDB::new(
&accounts[4..],
&accounts[5..],
operator.clone(),
operator_balance.clone(),
None,
Some(system),
None,
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::account::legacy::{TAG_HOLDER_DEPRECATED, TAG_STATE_FINALIZED_DEPRECATED};
use crate::account::{
AccountsDB, Holder, Operator, OperatorBalanceAccount, OperatorBalanceValidator, StateAccount,
TransactionTree, TAG_HOLDER, TAG_SCHEDULED_STATE_CANCELLED, TAG_SCHEDULED_STATE_FINALIZED,
TAG_STATE, TAG_STATE_FINALIZED,
program, AccountsDB, Holder, Operator, OperatorBalanceAccount, OperatorBalanceValidator,
StateAccount, TransactionTree, TAG_HOLDER, TAG_SCHEDULED_STATE_CANCELLED,
TAG_SCHEDULED_STATE_FINALIZED, TAG_STATE, TAG_STATE_FINALIZED,
};
use crate::debug::log_data;
use crate::error::{Error, Result};
Expand All @@ -27,14 +27,15 @@ pub fn process<'a>(
let transaction_tree = TransactionTree::from_account(&program_id, accounts[1].clone())?;
let operator = Operator::from_account(&accounts[2])?;
let operator_balance = OperatorBalanceAccount::try_from_account(program_id, &accounts[3])?;
let system = program::System::from_account(&accounts[4])?;

operator_balance.validate_owner(&operator)?;

let accounts_db = AccountsDB::new(
&accounts[4..],
&accounts[5..],
operator.clone(),
operator_balance.clone(),
None,
Some(system),
None,
);

Expand Down

0 comments on commit 8e91f5d

Please sign in to comment.