Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit ad7b7d5

Browse files
committed
Demotes Arc to Rc.
1 parent 3e86cb6 commit ad7b7d5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sdk/src/transaction_context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use {
2525
cell::{Ref, RefCell, RefMut},
2626
collections::HashSet,
2727
pin::Pin,
28-
sync::Arc,
28+
rc::Rc,
2929
},
3030
};
3131

@@ -142,7 +142,7 @@ impl TransactionAccounts {
142142
#[derive(Debug, Clone, PartialEq)]
143143
pub struct TransactionContext {
144144
account_keys: Pin<Box<[Pubkey]>>,
145-
accounts: Arc<TransactionAccounts>,
145+
accounts: Rc<TransactionAccounts>,
146146
instruction_stack_capacity: usize,
147147
instruction_trace_capacity: usize,
148148
instruction_stack: Vec<usize>,
@@ -173,7 +173,7 @@ impl TransactionContext {
173173
.unzip();
174174
Self {
175175
account_keys: Pin::new(account_keys.into_boxed_slice()),
176-
accounts: Arc::new(TransactionAccounts::new(accounts, rent.is_some())),
176+
accounts: Rc::new(TransactionAccounts::new(accounts, rent.is_some())),
177177
instruction_stack_capacity,
178178
instruction_trace_capacity,
179179
instruction_stack: Vec::with_capacity(instruction_stack_capacity),
@@ -194,13 +194,13 @@ impl TransactionContext {
194194
return Err(InstructionError::CallDepth);
195195
}
196196

197-
Ok(Arc::try_unwrap(self.accounts)
197+
Ok(Rc::try_unwrap(self.accounts)
198198
.expect("transaction_context.accounts has unexpected outstanding refs")
199199
.into_accounts())
200200
}
201201

202202
#[cfg(not(target_os = "solana"))]
203-
pub fn accounts(&self) -> &Arc<TransactionAccounts> {
203+
pub fn accounts(&self) -> &Rc<TransactionAccounts> {
204204
&self.accounts
205205
}
206206

@@ -1208,7 +1208,7 @@ pub struct ExecutionRecord {
12081208
#[cfg(not(target_os = "solana"))]
12091209
impl From<TransactionContext> for ExecutionRecord {
12101210
fn from(context: TransactionContext) -> Self {
1211-
let accounts = Arc::try_unwrap(context.accounts)
1211+
let accounts = Rc::try_unwrap(context.accounts)
12121212
.expect("transaction_context.accounts has unexpectd outstanding refs");
12131213
let touched_account_count = accounts.touched_count() as u64;
12141214
let accounts = accounts.into_accounts();

0 commit comments

Comments
 (0)