lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
900 stars 183 forks source link

Add MaxBatchSize query option. #203

Closed roeierez closed 4 years ago

roeierez commented 4 years ago

This PR adds a query option MaxBatchSize that allows the caller to limit the batch size requested when using either OptimisticBatch or OptimisticReverseBatch. This option is useful in cases where the caller needs a limited amount of items (such as scanning backwards to a certain point) and wants to allow neutrino save bandwidth by "hinting" about the max items it needs. The term "maxBatchSize" is used rather than "batchSize" since the caller is not exposed to the max number of items neutrino used as a default and is only allowed to limit this number.

This change is the first step towards fixing https://github.com/lightningnetwork/lnd/issues/4060

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.07%) to 71.743% when pulling 42a0bdf361ba31025422bb7aad83e0b0ac74c52b on breez:optimistic-batch-size into 5be0b87aadf8c817a8d8fcefaa17789683957ca9 on lightninglabs:master.