mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-05-12 20:59:32 +00:00
fix wallet storage bug
This commit is contained in:
parent
3cf7972425
commit
a4e8b53817
@ -165,6 +165,9 @@ pub fn produce_data_for_storage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let covered_private_chain_indices: std::collections::BTreeSet<_> =
|
||||||
|
user_data.private_key_tree.account_id_map.values().cloned().collect();
|
||||||
|
|
||||||
for (account_id, key) in &user_data.private_key_tree.account_id_map {
|
for (account_id, key) in &user_data.private_key_tree.account_id_map {
|
||||||
if let Some(data) = user_data.private_key_tree.key_map.get(key) {
|
if let Some(data) = user_data.private_key_tree.key_map.get(key) {
|
||||||
vec_for_storage.push(
|
vec_for_storage.push(
|
||||||
@ -178,6 +181,24 @@ pub fn produce_data_for_storage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also persist fresh nodes that have no identifiers yet and are therefore absent from
|
||||||
|
// account_id_map. Without this, a restart before the first sync would lose the node
|
||||||
|
// entirely, making it impossible to detect incoming transfers.
|
||||||
|
for (chain_index, node) in &user_data.private_key_tree.key_map {
|
||||||
|
if !covered_private_chain_indices.contains(chain_index) {
|
||||||
|
let account_id =
|
||||||
|
nssa::AccountId::from((&node.value.0.nullifier_public_key, 0_u128));
|
||||||
|
vec_for_storage.push(
|
||||||
|
PersistentAccountDataPrivate {
|
||||||
|
account_id,
|
||||||
|
chain_index: chain_index.clone(),
|
||||||
|
data: node.clone(),
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (account_id, key) in &user_data.default_pub_account_signing_keys {
|
for (account_id, key) in &user_data.default_pub_account_signing_keys {
|
||||||
vec_for_storage.push(
|
vec_for_storage.push(
|
||||||
InitialAccountData::Public(PublicAccountPrivateInitialData {
|
InitialAccountData::Public(PublicAccountPrivateInitialData {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user