add constructor for AccountData
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -41,10 +41,7 @@ impl Accounts {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
let (mut cache, unknown_id) = AccountCache::new(UserAccount::new(
|
let (mut cache, unknown_id) = AccountCache::new(UserAccount::new(
|
||||||
Keypair::only_pubkey(fallback),
|
Keypair::only_pubkey(fallback),
|
||||||
AccountData {
|
AccountData::new(fallback.bytes()),
|
||||||
relay: AccountRelayData::new(fallback.bytes()),
|
|
||||||
muted: AccountMutedData::new(fallback.bytes()),
|
|
||||||
},
|
|
||||||
));
|
));
|
||||||
|
|
||||||
unknown_id.process_action(unknown_ids, ndb, txn);
|
unknown_id.process_action(unknown_ids, ndb, txn);
|
||||||
@@ -128,10 +125,7 @@ impl Accounts {
|
|||||||
acc.key = kp.clone();
|
acc.key = kp.clone();
|
||||||
AccType::Acc(&*acc)
|
AccType::Acc(&*acc)
|
||||||
} else {
|
} else {
|
||||||
let new_account_data = AccountData {
|
let new_account_data = AccountData::new(kp.pubkey.bytes());
|
||||||
relay: AccountRelayData::new(kp.pubkey.bytes()),
|
|
||||||
muted: AccountMutedData::new(kp.pubkey.bytes()),
|
|
||||||
};
|
|
||||||
AccType::Entry(
|
AccType::Entry(
|
||||||
self.cache
|
self.cache
|
||||||
.add(UserAccount::new(kp.clone(), new_account_data)),
|
.add(UserAccount::new(kp.clone(), new_account_data)),
|
||||||
@@ -349,10 +343,7 @@ fn add_account_from_storage(
|
|||||||
|
|
||||||
fn get_acc_from_storage(user_account_serializable: UserAccountSerializable) -> Option<UserAccount> {
|
fn get_acc_from_storage(user_account_serializable: UserAccountSerializable) -> Option<UserAccount> {
|
||||||
let keypair = user_account_serializable.key;
|
let keypair = user_account_serializable.key;
|
||||||
let new_account_data = AccountData {
|
let new_account_data = AccountData::new(keypair.pubkey.bytes());
|
||||||
relay: AccountRelayData::new(keypair.pubkey.bytes()),
|
|
||||||
muted: AccountMutedData::new(keypair.pubkey.bytes()),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut wallet = None;
|
let mut wallet = None;
|
||||||
if let Some(wallet_s) = user_account_serializable.wallet {
|
if let Some(wallet_s) = user_account_serializable.wallet {
|
||||||
@@ -378,6 +369,13 @@ pub struct AccountData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AccountData {
|
impl AccountData {
|
||||||
|
pub fn new(pubkey: &[u8; 32]) -> Self {
|
||||||
|
Self {
|
||||||
|
relay: AccountRelayData::new(pubkey),
|
||||||
|
muted: AccountMutedData::new(pubkey),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn poll_for_updates(
|
pub(super) fn poll_for_updates(
|
||||||
&mut self,
|
&mut self,
|
||||||
ndb: &Ndb,
|
ndb: &Ndb,
|
||||||
|
|||||||
Reference in New Issue
Block a user