1200wd / bitcoinlib

Bitcoin and other Cryptocurrencies Library for Python. Includes a fully functional wallet, Mnemonic key generation and management and connection with various service providers to receive and send blockchain and transaction information.
http://bitcoinlib.readthedocs.io/
GNU General Public License v3.0
615 stars 204 forks source link

Limit/offset on transactions query #264

Closed oggy95 closed 2 years ago

oggy95 commented 2 years ago

Investigating method wallet.transactions() didn't find parameters for count limit of transactions for wallet. Is it possible to add in limit/offset for this method?

mccwdev commented 2 years ago

The wallet.transaction() method depends on 2 queries so using limit/offset on database level is difficult.

I was wondering what is you use case? Maybe it can be solved with using list comprehension?

oggy95 commented 2 years ago

When this lib using as backend service for some exchange service, load all transactions from database may be long, it can be improved by loading transactions partially (chunks).

mccwdev commented 2 years ago

Limit and offset has been added to wallet.transaction_full method, see https://github.com/1200wd/bitcoinlib/commit/d914dde6a98006a0107d8433b7d7044220dd2712