Bug fixes

This commit is contained in:
Hanh 2022-04-17 16:09:25 +08:00
parent 5363904a9d
commit 542e2f3fb3
2 changed files with 11 additions and 1 deletions

View File

@ -823,6 +823,8 @@ impl DbAdapter {
)?;
self.connection
.execute("DELETE FROM taddrs WHERE account = ?1", params![account])?;
self.connection
.execute("DELETE FROM messages WHERE account = ?1", params![account])?;
self.connection.execute(
"DELETE FROM secret_shares WHERE account = ?1",
params![account],
@ -926,6 +928,12 @@ pub struct ZMessage {
pub height: u32,
}
impl ZMessage {
pub fn is_empty(&self) -> bool {
self.sender.is_none() && self.subject.is_empty() && self.body.is_empty()
}
}
#[cfg(test)]
mod tests {
use zcash_params::coin::CoinType;

View File

@ -243,7 +243,9 @@ pub async fn retrieve_tx_info(
}
db.store_tx_metadata(tx_info.id_tx, &tx_info)?;
let z_msg = decode_memo(&tx_info.memo, &tx_info.address, tx_info.timestamp, tx_info.height);
db.store_message(tx_info.account, &z_msg)?;
if !z_msg.is_empty() {
db.store_message(tx_info.account, &z_msg)?;
}
}
contacts.sort_by(|a, b| a.index.cmp(&b.index));
for cref in contacts.iter() {