Closed yojoe closed 1 year ago
Thanks for the report! @prusnak notice Trezor seems to be making calls twice. Is this intentional?
Thanks for the report! @prusnak notice Trezor seems to be making calls twice. Is this intentional?
Closing since https://github.com/trezor/trezor-suite/issues/5285 is fixed. Many thanks for reporting and resolving the issue!
I'll share some performance stats of using
Trezor Suite
withelectrs 0.9.6
as a custom Bitcoin backend overTor
. It works, but the sync time when opening the wallet is not great. Sharing it here so we eventually identify some potential for improvement.electrs Platform Details:
Odroid HC1 (2 GB RAM) 1 TB SSD Debian buster (32-bit armhf) Bitcoin Core v22.0.0 (txindex = 1)
Trezor Suite Details:
Version: 22.3.2 Route all Suite traffic over Tor: on Labeling: off
Trezor Suite is a HD wallet which queries multiple accounts at once for P2PKH, P2SH-P2WPKH, P2WPKH and P2TR addresses (at least 40 addresses per type and account). So in theory even for an empty wallet, there are at least 4 40 = 160 addresses (scripthashes) to check when opening the wallet. For some reason Trezor Suite also checks the second account for BIP84 addresses, even if the first one is empty. So in reality there are at least 5 40 = 200 addresses to check when opening a wallet.
Here are the sync times for a wallet using a "warm" electrs cache. I assume the cache is "warm" when you start the electrs daemon, open the wallet and let it sync, close the wallet and repeat. (Is there a way to get the cache hits/misses via Prometheus metrics? I haven't discovered any.)
Empty Wallet
Total sync time:
23 sec (on average. measured multiple times.)
Number of calls:
blockchain.scripthash.get_history for unsubscribed scripthash
: 400 (Each scripthash seems to be called twice throughout the sync, not sure if this is a bug?)blockchain.scripthash.get_balance for unsubscribed scripthash
: 0blockchain.scripthash.listunspent for unsubscribed scripthash
: 0Non-Empty Wallet (with 3 accounts containing ~50 transactions in total)
Total sync time:
2:15 min (on average. measured multiple times.)
Number of calls:
blockchain.scripthash.get_history for unsubscribed scripthash
: 670 (Each scripthash seems to be called twice throughout the sync, not sure if this is a bug?)blockchain.scripthash.get_balance for unsubscribed scripthash
: 13blockchain.scripthash.listunspent for unsubscribed scripthash
: 13Observations:
get_history
) twice for each scripthash. This is reproducible and happens every time you open a wallet. Looks like bug in Trezor Suite.get_history
metrics (see below) look like there could be an issue?Prometheus stats for
get_history
,get_balance
andlistunspent
Empty Wallet
Non-Empty Wallet