HomePhabricator

[electrum] Performance: make receive_history_callback faster for larger…

Description

[electrum] Performance: make receive_history_callback faster for larger histories

Summary:
The current code was doing very slow ops -- effectively O(n^2) lookups for
large histories, to detect no-longer-in-history txns. We instead use
CPython native implementation of the frozenset difference operator to
accomplish the same thing and turn the operation into O(n).

This is a backport of https://github.com/Electron-Cash/Electron-Cash/commit/c2b697a4c0d0d2243ad553f6916d43751c262966

Depends on D14784

Test Plan:
Receive a transaction and check if the history list still works.

pytest electrumabc/tests/regtest/

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D14703

Details

Provenance
CCulianuAuthored on Nov 14 2023, 15:47
PiRKCommitted on Nov 16 2023, 06:56
PiRKPushed on Nov 16 2023, 06:56
Reviewer
Restricted Project
Differential Revision
D14703: [electrum] Performance: make receive_history_callback faster for larger histories
Parents
rABCbfb68bb3d2da: [electrum] add a functional test for a reorg situation
Branches
Unknown
Tags
Unknown