bitcoinwatcher 2.9__py3-none-any.whl → 2.11b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,10 +39,6 @@ class AbstractAddressListener(AbstractTxListener, ABC):
39
39
  return
40
40
  logger.debug(f"Extracting default tx data")
41
41
  address_tx_data = self.default_tx_extractor.extract(tx)
42
- # filter the address we are interested in
43
- addresses_for_events = self.filter_address_tx_data(address_tx_data)
44
- if len(addresses_for_events) == 0:
45
- return
46
42
  # get the address tx data from mempool for full details if any address matches
47
43
  try:
48
44
  logger.info(f"Extracting rpc tx data")
@@ -50,6 +46,10 @@ class AbstractAddressListener(AbstractTxListener, ABC):
50
46
  except Exception as e:
51
47
  logger.error(f"Error in getting rpc tx data, taking defaults", exc_info=True)
52
48
  address_tx_data = address_tx_data
49
+ # filter the address we are interested in
50
+ addresses_for_events = self.filter_address_tx_data(address_tx_data)
51
+ if len(addresses_for_events) == 0:
52
+ return
53
53
 
54
54
  for address in addresses_for_events:
55
55
  self.consume(tx_hex=tx.raw_hex(), subscribed_address=address, address_tx_data=address_tx_data)
@@ -18,11 +18,15 @@ class BitcoinRPCAddressDataExtractor(AbstractTxAddressDataExtractor):
18
18
  self.bitcoinrpc = BitcoinRPC()
19
19
 
20
20
  def fetch_all_inputs(self, inputs):
21
- rpc_calls = [["getrawtransaction", input.prev_txid.hex(), True] for input in inputs]
21
+ unique_txids = list(set([input.prev_txid.hex() for input in inputs]))
22
+ rpc_calls = [["getrawtransaction", tx_id, True] for tx_id in unique_txids]
22
23
  data = self.bitcoinrpc.rpc_connection.batch_(rpc_calls)
24
+ tx_id_to_data = {tx_id: current_tx for tx_id, current_tx in zip(unique_txids, data)}
23
25
  list_of_vouts = []
24
26
  for input in inputs:
25
- vout = data.pop(0)["vout"][input.output_n_int]
27
+ tx_id = input.prev_txid.hex()
28
+ current_tx = tx_id_to_data[tx_id]
29
+ vout = current_tx["vout"][input.output_n_int]
26
30
  list_of_vouts.append(vout)
27
31
  return list_of_vouts
28
32
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: bitcoinwatcher
3
- Version: 2.9
3
+ Version: 2.11b1
4
4
  Summary: bitcoinwatcher is a Python library that implements a ZMQ subscriber and provides abstractions to build custom address watchers. This library is designed to make it easy for developers to monitor Bitcoin addresses and react to changes in their state.
5
5
  Author: twosatsmaxi
6
6
  License: Apache License
@@ -1,6 +1,6 @@
1
1
  bitcoin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bitcoin/address_listener/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- bitcoin/address_listener/address_listener.py,sha256=_ybn0IgOLL6rrf2WKOwJsI_MjWdiFs8qiGWl-Kj6kf0,2445
3
+ bitcoin/address_listener/address_listener.py,sha256=edcGSdV7mULmoeL5TSxJpkxRxzK0pETJslLEEXoYYLI,2445
4
4
  bitcoin/address_listener/simple_address_listener.py,sha256=yQTxWVthsMiYkXzWYmGMCzP0LWTUokgWFkqEf8GsUB4,1674
5
5
  bitcoin/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  bitcoin/models/address_tx_data.py,sha256=KSSCzAjYxLEgXIELVSsnSEhgY65xi0K3HUjoamVV_LQ,750
@@ -12,7 +12,7 @@ bitcoin/tests/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
12
12
  bitcoin/tests/data/transactions.py,sha256=qIX9seGYguQ1lvLOCF8oe3NQhMJZP0SsBmz1iFbszhg,396279
13
13
  bitcoin/tx_extractors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  bitcoin/tx_extractors/abstract_extractor.py,sha256=YLnuqc3jva15NpOX8xV4oB5PEXc6rXbG8Lx0cBXW66s,291
15
- bitcoin/tx_extractors/bitcoin_rpc.py,sha256=1ehmZ4wsyE-dkfi2yYfCX0d-YFJoZPtkgey9X6gZx9U,3069
15
+ bitcoin/tx_extractors/bitcoin_rpc.py,sha256=vIRCc36vulk5cwKVVkEKAMJ8S82Gx_HJK7ePx3AjpOs,3317
16
16
  bitcoin/tx_extractors/default.py,sha256=KLT0EIbrp9yzFTQ-U5JRGI4ACHkvEMmycdXQGoPRU20,1509
17
17
  bitcoin/tx_extractors/mempool.py,sha256=mPPY1GOvBmZWn7UVP2sUaXtfcyeTCj-LmRDl2F4WhC8,2090
18
18
  bitcoin/tx_listener/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -25,8 +25,8 @@ bitcoin/utils/bitcoin_utils.py,sha256=mrnRPqUa2U2EMKu7rrPV_bW1sL2CJUfbAom0Zdamyd
25
25
  bitcoin/utils/constants.py,sha256=irZLlArgica2VckyckEYxH5D5KjvdF52dtBMWswqw8k,52
26
26
  bitcoin/utils/context_aware_logging.py,sha256=p3PuFnHjJcgEH8O9ng7UrXvW3SVDWGaeYgxysDuqRyI,1874
27
27
  bitcoin/utils/inscription_utils.py,sha256=8QbOJ1o1n1bMFsPREGLzwFjnGzfuARgJCPr6ORhP44o,193
28
- bitcoinwatcher-2.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
29
- bitcoinwatcher-2.9.dist-info/METADATA,sha256=IVnlwCUvR4EnTCkEX9b4QVvxfPgwrgQg83mLUs1CTZ8,15020
30
- bitcoinwatcher-2.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
31
- bitcoinwatcher-2.9.dist-info/top_level.txt,sha256=YdUgzLdCiMlrwaKyDqHA1acEd23QFko5bv7D6nBANJ0,8
32
- bitcoinwatcher-2.9.dist-info/RECORD,,
28
+ bitcoinwatcher-2.11b1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
29
+ bitcoinwatcher-2.11b1.dist-info/METADATA,sha256=9R6TAJrjEmQ0FZux2qYzZS3blJJoOaq1Lw7DdWKs7iU,15023
30
+ bitcoinwatcher-2.11b1.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
31
+ bitcoinwatcher-2.11b1.dist-info/top_level.txt,sha256=YdUgzLdCiMlrwaKyDqHA1acEd23QFko5bv7D6nBANJ0,8
32
+ bitcoinwatcher-2.11b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5