fix(sync) append addresses before appending messages
so the `incoming` and `value` computations on the Message are correct
@@ -254,14 +254,6 @@ impl<'a> AccountSynchronizer<'a> {
}
sync_transactions(self.account, &new_messages).await?;
- self.account.append_messages(
- new_messages
- .iter()
- .map(|(id, message)| {
- Message::from_iota_message(*id, self.account.addresses(), &message).unwrap()
- })
- .collect(),
- );
let mut addresses_to_save = vec![];
let mut ignored_addresses = vec![];
@@ -291,6 +283,15 @@ impl<'a> AccountSynchronizer<'a> {
}
self.account.append_addresses(addresses_to_save);
+ self.account.append_messages(
+ new_messages
+ .iter()
+ .map(|(id, message)| {
+ Message::from_iota_message(*id, self.account.addresses(), &message).unwrap()
+ })
+ .collect(),
+ );
+
if !self.skip_persistance {
crate::storage::with_adapter(&self.storage_path, |storage| {
storage.set(
