Skip to content

Commit

Permalink
Use correct new variable name in Blocksmurfer client
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryp Toon committed Jul 13, 2024
1 parent f81816d commit b5a46b9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions bitcoinlib/services/blocksmurfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def getbalance(self, addresslist):
balance += res['balance']
return balance

# TODO: fix blocksmurfer api
def getutxos(self, address, after_txid='', limit=MAX_TRANSACTIONS):
res = self.compose_request('utxos', address, variables={'after_txid': after_txid})
self.latest_block = self.blockcount() if not self.latest_block else self.latest_block
Expand Down Expand Up @@ -85,11 +84,8 @@ def _parse_transaction(self, tx, block_height=None):
if block_height and not confirmations and tx['status'] == 'confirmed':
self.latest_block = self.blockcount() if not self.latest_block else self.latest_block
confirmations = self.latest_block - block_height
# FIXME: Blocksmurfer returns 'date' or 'time', should be consistent
tx_date = None if not tx.get('date') else (
datetime.strptime(tx['date'], "%Y-%m-%dT%H:%M:%S").replace(tzinfo=timezone.utc))
if not tx_date and 'time' in tx:
tx_date = datetime.fromtimestamp(tx['time'], timezone.utc)
t = Transaction(locktime=tx['locktime'], version=tx['version'], network=self.network,
fee=tx['fee'], size=tx['size'], txid=tx['txid'], date=tx_date, input_total=tx['input_total'],
output_total=tx['output_total'], confirmations=confirmations, block_height=block_height,
Expand All @@ -101,7 +97,7 @@ def _parse_transaction(self, tx, block_height=None):
public_hash=bytes.fromhex(ti['public_hash']), address=ti['address'],
witness_type=ti['witness_type'], locktime_cltv=ti['locktime_cltv'],
locktime_csv=ti['locktime_csv'], signatures=ti['signatures'], compressed=ti['compressed'],
encoding=ti['encoding'], locking_script=ti['script_code'],
encoding=ti['encoding'], locking_script=ti['locking_script'],
sigs_required=ti['sigs_required'], sequence=ti['sequence'],
witnesses=[bytes.fromhex(w) for w in ti['witnesses']], script_type=ti['script_type'],
strict=self.strict)
Expand Down

0 comments on commit b5a46b9

Please sign in to comment.