monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
245 stars 79 forks source link

Unable to get transfers #88

Closed lalanza808 closed 3 years ago

lalanza808 commented 3 years ago

I believe I've found a bug with the new default backends that prevents me from fetching transactions on the wallet if no explicit backend is provided.

AttributeError: 'NoneType' object has no attribute 'transfers_in'

On first glance it looks like an easy fix. Also, it looks like it was missed in tests due to the nature of the mock backend and transactions.

$ python3 -m venv .venv 
$ .venv/bin/pip install monero==0.7.6
$ monero-wallet-rpc --rpc-login "test:xxxxxx" --rpc-bind-port 55013 ..........other cli args........
>>> from monero.wallet import Wallet
>>> w = Wallet(user='test', password='xxxxxx', port=55013)
>>> w.incoming()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "......project path...../.venv/lib/python3.9/site-packages/monero/transaction.py", line 113, in __call__
    fetch = self.backend.transfers_in if self.direction == 'in' else self.backend.transfers_out
AttributeError: 'NoneType' object has no attribute 'transfers_in'
emesik commented 3 years ago

Merged. Thanks!