Skip to content

Commit

Permalink
Namecoin: Move scriptpubkey filling to get_addr_utxo
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Feb 17, 2020
1 parent 8c7967c commit 360983c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 0 additions & 8 deletions electrum_nmc/electrum/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,6 @@ def get_wallet_name_count(wallet, network):

utxos = wallet.get_utxos()
for _, x in enumerate(utxos):
# TODO: Namecoin: Upstream Electrum only returns inputs with the
# "trusted address" field set, not the scriptpubkey set. This prevents
# us from seeing the name prefix. For now we manually fill in the
# scriptpubkey via add_input_info, but we should submit a PR to
# upstream Electrum that replaces "trusted addresses" with "trusted
# scriptpubkeys".
wallet.add_input_info(x)

txid = x.prevout.txid
vout = x.prevout.out_idx
name_op = x.name_op
Expand Down
12 changes: 12 additions & 0 deletions electrum_nmc/electrum/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,18 @@ def add_input_info(self, txin: PartialTxInput, *, only_der_suffix: bool = True)
pass
self._add_input_sig_info(txin, address, only_der_suffix=only_der_suffix)

def get_addr_utxo(self, address: str) -> Dict[TxOutpoint, PartialTxInput]:
utxos = super().get_addr_utxo(address)
for _, x in utxos.items():
# TODO: Namecoin: Upstream Electrum only returns inputs with the
# "trusted address" field set, not the scriptpubkey set. This prevents
# us from seeing the name prefix. For now we manually fill in the
# scriptpubkey via add_input_info, but we should submit a PR to
# upstream Electrum that replaces "trusted addresses" with "trusted
# scriptpubkeys".
self.add_input_info(x)
return utxos

def can_sign(self, tx: Transaction) -> bool:
if not isinstance(tx, PartialTransaction):
return False
Expand Down

0 comments on commit 360983c

Please sign in to comment.