Skip to content

Commit 78b679d

Browse files
committed
Fixed requested things in PR
1 parent 0045052 commit 78b679d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Connector/btc/apirpc.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,19 @@ def getTransaction(id, params, config):
396396
transaction = RPCConnector.request(
397397
endpoint=config.bitcoincoreRpcEndpoint,
398398
id=id,
399-
method="getrawtransaction",
399+
method=GET_TRANSACTION_METHOD,
400400
params=[
401401
params["txHash"],
402402
True
403403
]
404404
)
405405

406-
isConfirmed = "blockhash" in transaction
407-
408-
if isConfirmed:
406+
# Check if transaction is confirmed, and obtain block number
407+
if "blockhash" in transaction:
409408
transactionBlock = RPCConnector.request(
410409
endpoint=config.bitcoincoreRpcEndpoint,
411410
id=id,
412-
method="getblock",
411+
method=GET_BLOCK,
413412
params=[transaction["blockhash"], 1]
414413
)
415414
blockNumber = transactionBlock["height"]

Connector/btc/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
NOTIFY = "notify"
101101
NEW_HASH_BLOCK_ZMQ_TOPIC = "hashblock"
102102
NEW_RAW_BLOCK_ZMQ_TOPIC = "rawblock"
103+
GET_BLOCK = "getblock"
103104

104105
SUBSCRIBE_ADDRESS_BALANCE = "subscribetoaddressbalance"
105106
UNSUBSCRIBE_ADDRESS_BALANCE = "unsubscribefromaddressbalance"

0 commit comments

Comments
 (0)