Skip to content

Commit

Permalink
Accept +00:00 or not in date strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryp Toon committed Jul 13, 2024
1 parent b7271f9 commit f416cbb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bitcoinlib/services/blocksmurfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def getutxos(self, address, after_txid='', limit=MAX_TRANSACTIONS):
'size': u['size'],
'value': u['value'],
'script': u['script'],
'date': datetime.strptime(u['date'][:19], "%Y-%m-%dT%H:%M:%S+00:00").replace(tzinfo=timezone.utc)
'date': datetime.strptime(u['date'][:19], "%Y-%m-%dT%H:%M:%S").replace(tzinfo=timezone.utc)
})
return utxos[:limit]

Expand All @@ -85,7 +85,7 @@ def _parse_transaction(self, tx, block_height=None):
self.latest_block = self.blockcount() if not self.latest_block else self.latest_block
confirmations = self.latest_block - block_height
tx_date = None if not tx.get('date') else (
datetime.strptime(tx['date'], "%Y-%m-%dT%H:%M:%S+00:00").replace(tzinfo=timezone.utc))
datetime.strptime(tx['date'][:19], "%Y-%m-%dT%H:%M:%S").replace(tzinfo=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 Down
2 changes: 1 addition & 1 deletion bitcoinlib/services/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def getinputvalues(self, t):
prev_txs = []
for i in t.inputs:
if not i.value:
if i.prev_txid not in prev_txs:
if i.prev_txid not in prev_txs and i.prev_txid != 32 * b'\0':
prev_t = self.gettransaction(i.prev_txid.hex())
else:
prev_t = [t for t in prev_txs if t.txid == i.prev_txid][0]
Expand Down

0 comments on commit f416cbb

Please sign in to comment.