Skip to content

Commit e8c5e3f

Browse files
author
k9ert
authored
Bugfix: method getaddressinfo not implemented (#2313)
This PR fixes #2312 which are four things: * getaddressinfo was not implemented in spectrum which results in "method not found" * There was an unrelated KeyError which occured in Transactions where one the output was a change-address. It's a bit unknown why that hasn't occured earlier. At least it was diffcult to spot as the fetch_transactions call was way to huge and very confusing. So ... * the fetch_transactions call was refactored in its own class, TxFetcher. As we did that, we also moved two other related files in a newly created wallet-package. * Tiny bug around tx["amount"] which only exists as tx["flow_amount"] for transactions.
1 parent a1d751b commit e8c5e3f

File tree

19 files changed

+387
-222
lines changed

19 files changed

+387
-222
lines changed

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ psycopg2-binary==2.9.5
3333
cryptoadvance-liquidissuer==0.2.4
3434
specterext-exfund==0.1.7
3535
specterext-faucet==0.1.2
36-
cryptoadvance.spectrum==0.6.3
36+
cryptoadvance.spectrum==0.6.4
3737
specterext-stacktrack==0.3.0

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile with Python 3.10
33
# by the following command:
44
#
5-
# pip-compile --generate-hashes requirements.in
5+
# pip-compile --generate-hashes --resolver=backtracking requirements.in
66
#
77
aniso8601==9.0.1 \
88
--hash=sha256:1d2b7ef82963909e93c4f24ce48d4de9e66009a21bf1c1e1c85bdd0812fe412f \
@@ -119,9 +119,9 @@ cryptoadvance-liquidissuer==0.2.4 \
119119
--hash=sha256:5a2c531801854c5a4a46daf184877e22f731cdb42d2cfb840785bda7371ba6fb \
120120
--hash=sha256:9e468f3e35ecc566b3f74a2263677cf26632548abb194521dba15ad37acd1e9b
121121
# via -r requirements.in
122-
cryptoadvance-spectrum==0.6.3 \
123-
--hash=sha256:706287a9e1640f1a27a1a3c6e27a147599dde9969e7dbd2df99c890514b2b1ba \
124-
--hash=sha256:877006d81c5be0d5da12ca8d4b0dd7dc21b104bc826cd35c7de5019ca56cf64a
122+
cryptoadvance-spectrum==0.6.4 \
123+
--hash=sha256:226f89dfe96dac2fcd82f462706e118f017582df5565ff1924f27e4392bc6a0e \
124+
--hash=sha256:fa6c877b3a5ba683ccde991f020fce2f3b06e0b8f5219a6fdc592658cacb1d3d
125125
# via -r requirements.in
126126
cryptography==39.0.1 \
127127
--hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \

src/cryptoadvance/specter/liquid/addresslist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ..addresslist import *
1+
from ..wallet.addresslist import *
22
from embit.liquid.addresses import addr_decode, to_unconfidential
33

44

src/cryptoadvance/specter/liquid/txlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ..txlist import *
1+
from ..wallet.txlist import *
22
from embit.liquid.transaction import LTransaction, TxOutWitness, unblind
33
from embit.liquid.pset import PSET
44
from embit.liquid import slip77

src/cryptoadvance/specter/liquid/wallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
from embit.liquid.pset import PSET
99
from embit.liquid.transaction import LTransaction
1010

11-
from ..addresslist import Address
1211
from ..specter_error import SpecterError
1312
from ..wallet import *
1413
from .addresslist import LAddressList
1514
from .txlist import LTxList
1615
from .util.pset import SpecterPSET
16+
from .addresslist import Address
1717

1818

1919
class LWallet(Wallet):

src/cryptoadvance/specter/server_endpoints/wallets/wallets_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from flask_login import current_user, login_required
2222
from werkzeug.wrappers import Response
2323

24-
from cryptoadvance.specter.txlist import WalletAwareTxItem
24+
from cryptoadvance.specter.wallet.txlist import WalletAwareTxItem
2525

2626
from ...commands.psbt_creator import PsbtCreator
2727
from ...helpers import bcur2base64
@@ -1075,8 +1075,8 @@ def process_txlist(txlist, idx=0, limit=100, search=None, sortby=None, sortdir="
10751075
)
10761076
or (
10771077
any(search in str(amount) for amount in tx["amount"])
1078-
if isinstance(tx["amount"], list)
1079-
else search in str(tx["amount"])
1078+
if isinstance(tx["flow_amount"], list)
1079+
else search in str(tx["flow_amount"])
10801080
)
10811081
or search in str(tx["confirmations"])
10821082
or search in str(tx["time"])

src/cryptoadvance/specter/services/service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from .service_encrypted_storage import ServiceEncryptedStorageManager
1414
from .service_annotations_storage import ServiceAnnotationsStorage
1515

16-
from cryptoadvance.specter.addresslist import Address
1716
from cryptoadvance.specter.services import callbacks
1817

1918

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .wallet import Wallet, purposes
2+
from .addresslist import Address
3+
from .txlist import WalletAwareTxItem
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from .txlist import TxList
2+
3+
4+
class AbstractWallet:
5+
@property
6+
def transactions(self) -> TxList:
7+
if hasattr(self, "_transactions"):
8+
return self._transactions
9+
else:
10+
return None
11+
12+
@property
13+
def addresses(self) -> TxList:
14+
if hasattr(self, "_addresses"):
15+
return self._addresses
16+
else:
17+
return None
18+
19+
@property
20+
# abstractmethod
21+
def rpc(self):
22+
"""Cache RPC instance. Reuse if manager's RPC instance hasn't changed. Create new RPC instance otherwise.
23+
This RPC instance is also used by objects created by the wallet, such as TxList or TxItem
24+
"""
25+
pass

src/cryptoadvance/specter/addresslist.py renamed to src/cryptoadvance/specter/wallet/addresslist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Manages the list of addresses for the wallet, including labels and derivation paths
33
"""
44
import os
5-
from .persistence import write_csv, read_csv
5+
from ..persistence import write_csv, read_csv
66
import logging
77

88
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)