Skip to content

Commit

Permalink
txouts for query_utxo_set is Tuple not dict
Browse files Browse the repository at this point in the history
  • Loading branch information
kristapsk committed Mar 21, 2023
1 parent 584930d commit b70d07a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions jmclient/jmclient/blockchaininterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 4 additions & 3 deletions jmclient/test/commontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit b70d07a

Please sign in to comment.