From b70d07a62082ba544f232d4a9d47e1eb6a05437a Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Tue, 21 Mar 2023 22:03:23 +0200 Subject: [PATCH] txouts for query_utxo_set is Tuple not dict --- jmclient/jmclient/blockchaininterface.py | 10 ++++++---- jmclient/test/commontest.py | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/jmclient/jmclient/blockchaininterface.py b/jmclient/jmclient/blockchaininterface.py index 9d451147e..778dd4740 100644 --- a/jmclient/jmclient/blockchaininterface.py +++ b/jmclient/jmclient/blockchaininterface.py @@ -5,7 +5,7 @@ import time from abc import ABC, abstractmethod from decimal import Decimal -from typing import Callable, Generator, List, Optional, Union +from typing import Callable, Generator, List, Optional, Tuple, Union from twisted.internet import reactor, task @@ -41,9 +41,10 @@ def pushtx(self, txbin: bytes) -> bool: """ @abstractmethod - def query_utxo_set(self, txouts: Union[dict, List[dict]], + def query_utxo_set(self, + txouts: Union[Tuple[bytes, int], List[Tuple[bytes, int]]], includeconfs: bool = False, - include_mempool: bool = True) -> List[dict]: + include_mempool: bool = True) -> List[Optional[dict]]: """If txout is either (a) a single utxo in (txidbin, n) form, or a list of the same, returns, as a list for each txout item, the result of gettxout from the bitcoind rpc for those utxos; @@ -467,7 +468,8 @@ def pushtx(self, txbin: bytes) -> bool: return False return True - def query_utxo_set(self, txouts: Union[dict, List[dict]], + def query_utxo_set(self, + txouts: Union[Tuple[bytes, int], List[Tuple[bytes, int]]], includeconfs: bool = False, include_mempool: bool = True) -> List[Optional[dict]]: if not isinstance(txouts, list): diff --git a/jmclient/test/commontest.py b/jmclient/test/commontest.py index af757148d..73b1819ae 100644 --- a/jmclient/test/commontest.py +++ b/jmclient/test/commontest.py @@ -4,7 +4,7 @@ import os import random from decimal import Decimal -from typing import Callable, List, Optional, Union +from typing import Callable, List, Optional, Tuple, Union import jmbitcoin as btc from jmbase import (get_log, hextobin, bintohex, dictchanger) @@ -108,9 +108,10 @@ def set_confs(self, confs_utxos) -> None: def reset_confs(self) -> None: self.confs_for_qus = {} - def query_utxo_set(self, txouts: Union[dict, List[dict]], + def query_utxo_set(self, + txouts: Union[Tuple[bytes, int], List[Tuple[bytes, int]]], includeconfs: bool = False, - include_mempool: bool = True) -> List[dict]: + include_mempool: bool = True) -> List[Optional[dict]]: if self.qusfail: #simulate failure to find the utxo return [None]