Skip to content

Commit 8546c64

Browse files
committed
Remove to_account_shared_data from ReadableAccount
1 parent ddf6523 commit 8546c64

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

account/src/lib.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,6 @@ pub trait ReadableAccount: Sized {
226226
fn owner(&self) -> &Pubkey;
227227
fn executable(&self) -> bool;
228228
fn rent_epoch(&self) -> Epoch;
229-
fn to_account_shared_data(&self) -> AccountSharedData {
230-
AccountSharedData::create(
231-
self.lamports(),
232-
self.data().to_vec(),
233-
*self.owner(),
234-
self.executable(),
235-
self.rent_epoch(),
236-
)
237-
}
238229
}
239230

240231
impl ReadableAccount for Account {
@@ -343,10 +334,6 @@ impl ReadableAccount for AccountSharedData {
343334
fn rent_epoch(&self) -> Epoch {
344335
self.rent_epoch
345336
}
346-
fn to_account_shared_data(&self) -> AccountSharedData {
347-
// avoid data copy here
348-
self.clone()
349-
}
350337
}
351338

352339
impl ReadableAccount for Ref<'_, AccountSharedData> {
@@ -365,16 +352,6 @@ impl ReadableAccount for Ref<'_, AccountSharedData> {
365352
fn rent_epoch(&self) -> Epoch {
366353
self.rent_epoch
367354
}
368-
fn to_account_shared_data(&self) -> AccountSharedData {
369-
AccountSharedData {
370-
lamports: self.lamports(),
371-
// avoid data copy here
372-
data: Arc::clone(&self.data),
373-
owner: *self.owner(),
374-
executable: self.executable(),
375-
rent_epoch: self.rent_epoch(),
376-
}
377-
}
378355
}
379356

380357
impl ReadableAccount for Ref<'_, Account> {
@@ -917,17 +894,6 @@ pub mod tests {
917894
account2.serialize_data(&"hello world").unwrap();
918895
}
919896

920-
#[test]
921-
fn test_to_account_shared_data() {
922-
let key = Pubkey::new_unique();
923-
let (account1, account2) = make_two_accounts(&key);
924-
assert!(accounts_equal(&account1, &account2));
925-
let account3 = account1.to_account_shared_data();
926-
let account4 = account2.to_account_shared_data();
927-
assert!(accounts_equal(&account1, &account3));
928-
assert!(accounts_equal(&account1, &account4));
929-
}
930-
931897
#[test]
932898
fn test_account_shared_data() {
933899
let key = Pubkey::new_unique();

0 commit comments

Comments
 (0)