bitcoin-sv / ts-sdk

Other
51 stars 13 forks source link

Optimize SPV verification #127

Closed ty-everett closed 1 month ago

ty-everett commented 1 month ago

Description of Changes

Refactor the verify method to make use of a queuee and only verify transactions in a given graph once, thereby increasing performance significantly.

Also, add a benchmarking suite that tests SPV verification in a number of different scenarios, enabling us to measure the impact of future changes on verification speed.

Finally, address #125 by making the sequence number optional in transaction inputs.

Linked Issues / Tickets

Closes #125

Testing Procedure

Added benchmarking suite. Previous to the change, it took 30,000 ms to verify the 5-deep fanout-3 transaction on my machine. After the change, it takes 1,300 ms to perform the same verification.

Checklist:

ty-everett commented 1 month ago

Closing because of #128