SaitoTech / saito-lite-rust

a version of the Saito-Lite client written for compatibility with the Saito Rust client and binary data format
24 stars 28 forks source link

Repeatedly polling TRX balance when in video call (with sidebar closed). #2424

Open arpee opened 6 months ago

arpee commented 6 months ago

Image

Seeing this every 5 seconds or so.

umairkhannn commented 5 months ago

I have found out that this caused when a spam transaction is generated from spam module.

  1. spam module generates spam tx.
  2. At rust end it process that tx inside saito-core/src/core/consensus/wallet.rs and sends "wallet-updated" to JS.
  3. That event is received inside saito-header.js and it fetches preffered_crypto balance, if preffered crypto is saito it fetches balance from rust, and if preffered_crypto is TRX it sends balance request to mixin.

Now i am not exactly sure why on each spam tx, we get wallet-updated event but I am guessing that its because spam tx have fee, amount and utxo key inside it.

Image

Here are the methods from where wallet-updated event is triggered inside wallet.rs at rust side:

load reset add_slip remove_slip generate_slip delete_block update_from_balance_snapshot on_chain_reorganization