Skip to content

Commit 6fba549

Browse files
author
andraz maier
committed
fix: normalize case for db models
1 parent 7faaf78 commit 6fba549

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

utxo_indexer/models/block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def object_from_node_response(cls, response: BlockResponse):
3131
return cls(
3232
block_number=response.height,
3333
timestamp=response.mediantime,
34-
block_hash=response.hash,
35-
previous_block_hash=response.previousblockhash,
34+
block_hash=response.hash.lower(),
35+
previous_block_hash=response.previousblockhash.lower(),
3636
transactions=len(response.tx),
3737
confirmed=True,
3838
)

utxo_indexer/models/transaction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _construct_address_root(self, addresses: Sequence[str | None]) -> str:
7474
tree = merkle_tree_from_address_strings(addresses)
7575
if tree.root is None:
7676
return ZERO_SOURCE_ADDRESS_ROOT
77-
return un_prefix_0x(tree.root)
77+
return un_prefix_0x(tree.root).lower()
7878

7979
@classmethod
8080
def object_from_node_response(cls, response: TransactionResponse, block_number: int, timestamp: int):
@@ -84,7 +84,7 @@ def object_from_node_response(cls, response: TransactionResponse, block_number:
8484
return cls(
8585
block_number=block_number,
8686
timestamp=timestamp,
87-
transaction_id=response.txid,
87+
transaction_id=response.txid.lower(),
8888
payment_reference=None,
8989
is_native_payment=False,
9090
transaction_type="coinbase",
@@ -93,7 +93,7 @@ def object_from_node_response(cls, response: TransactionResponse, block_number:
9393
return cls(
9494
block_number=block_number,
9595
timestamp=timestamp,
96-
transaction_id=response.txid,
96+
transaction_id=response.txid.lower(),
9797
payment_reference=ref,
9898
is_native_payment=True,
9999
transaction_type="full_payment",
@@ -129,5 +129,5 @@ def is_op_return(vout: VoutResponse):
129129
std_references.append(message)
130130

131131
if len(std_references) == 1:
132-
return std_references[0]
132+
return std_references[0].lower()
133133
return None

utxo_indexer/models/transaction_outputs.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def object_from_node_response(cls, response: VoutResponse, transaction_link: Utx
4242
n=response.n,
4343
value=response.value,
4444
script_key_asm=script_pub_key.asm,
45-
script_key_hex=script_pub_key.hex,
45+
script_key_hex=script_pub_key.hex.lower(),
4646
script_key_req_sigs=script_pub_key.reqSigs,
47-
script_key_type=script_pub_key.type,
47+
script_key_type=script_pub_key.type.lower(),
4848
script_key_address=script_pub_key.address,
4949
)
5050

@@ -82,7 +82,7 @@ def object_from_node_response(
8282
return cls(
8383
transaction_link=transaction_link,
8484
vin_n=vin_n,
85-
vin_coinbase=vin_response.coinbase,
85+
vin_coinbase=vin_response.coinbase.lower(),
8686
vin_sequence=vin_response.sequence,
8787
)
8888

@@ -126,14 +126,14 @@ def object_from_node_response(
126126
n=vout_response.n,
127127
value=vout_response.value,
128128
script_key_asm=vout_script_pub_key.asm,
129-
script_key_hex=vout_script_pub_key.hex,
129+
script_key_hex=vout_script_pub_key.hex.lower(),
130130
script_key_req_sigs=vout_script_pub_key.reqSigs,
131-
script_key_type=vout_script_pub_key.type,
131+
script_key_type=vout_script_pub_key.type.lower(),
132132
script_key_address=vout_script_pub_key.address,
133133
# vin part
134-
vin_previous_txid=vin_response.txid,
134+
vin_previous_txid=vin_response.txid.lower(),
135135
vin_vout_index=vin_response.vout,
136136
vin_sequence=vin_response.sequence,
137-
vin_script_sig_asm=vin_response.scriptSig.asm,
138-
vin_script_sig_hex=vin_response.scriptSig.hex,
137+
vin_script_sig_asm=vin_response.scriptSig.asm.lower(),
138+
vin_script_sig_hex=vin_response.scriptSig.hex.lower(),
139139
)

0 commit comments

Comments
 (0)