When using electrum as indexer, the service logs the following warning repeatedly:
your wallet uses less efficient method of querying electrs, consider contacting the developer of your wallet. Reason: blockchain.scripthash.get_history called for unsubscribed scripthash
To address this we should use the subscription feature and get histories only for scripts with updates.
To implement this we could store a map (in memory) and call script_subscribe/script_pop to update it. Then we should call script_get_history only if the hash returned by these 2 calls has changed from the last time we synced the wallet. Since script_subscribe should be called only once I think the cleaner way to address this is by implementing the Indexer::update method (which currently is unimplemented). This way the Indexer::create method should just call script_subscribe (and script_get_history) for all addresses once, while subsequent wallet syncs would go through Indexer::update and call script_pop (and call script_get_history only where necessary).
Otherwise, if there are no plans in the near future to implement Indexer::update we can implement the logic to check if we already subscribed to a script directly in the Indexer::create.
@dr-orlovsky please let me know what do you think, I can work on this if you prefer
When using electrum as indexer, the service logs the following warning repeatedly:
your wallet uses less efficient method of querying electrs, consider contacting the developer of your wallet. Reason: blockchain.scripthash.get_history called for unsubscribed scripthashTo address this we should use the subscription feature and get histories only for scripts with updates.
To implement this we could store a map (in memory) and call
script_subscribe/script_popto update it. Then we should callscript_get_historyonly if the hash returned by these 2 calls has changed from the last time we synced the wallet. Sincescript_subscribeshould be called only once I think the cleaner way to address this is by implementing theIndexer::updatemethod (which currently is unimplemented). This way theIndexer::createmethod should just callscript_subscribe(andscript_get_history) for all addresses once, while subsequent wallet syncs would go throughIndexer::updateand callscript_pop(and callscript_get_historyonly where necessary).Otherwise, if there are no plans in the near future to implement
Indexer::updatewe can implement the logic to check if we already subscribed to a script directly in theIndexer::create.@dr-orlovsky please let me know what do you think, I can work on this if you prefer