Skip to content

Commit

Permalink
Fixed requested things in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
bridgedragon committed Mar 2, 2022
1 parent 0045052 commit 78b679d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Connector/btc/apirpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,20 +396,19 @@ def getTransaction(id, params, config):
transaction = RPCConnector.request(
endpoint=config.bitcoincoreRpcEndpoint,
id=id,
method="getrawtransaction",
method=GET_TRANSACTION_METHOD,
params=[
params["txHash"],
True
]
)

isConfirmed = "blockhash" in transaction

if isConfirmed:
# Check if transaction is confirmed, and obtain block number
if "blockhash" in transaction:
transactionBlock = RPCConnector.request(
endpoint=config.bitcoincoreRpcEndpoint,
id=id,
method="getblock",
method=GET_BLOCK,
params=[transaction["blockhash"], 1]
)
blockNumber = transactionBlock["height"]
Expand Down
1 change: 1 addition & 0 deletions Connector/btc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
NOTIFY = "notify"
NEW_HASH_BLOCK_ZMQ_TOPIC = "hashblock"
NEW_RAW_BLOCK_ZMQ_TOPIC = "rawblock"
GET_BLOCK = "getblock"

SUBSCRIBE_ADDRESS_BALANCE = "subscribetoaddressbalance"
UNSUBSCRIBE_ADDRESS_BALANCE = "unsubscribefromaddressbalance"
Expand Down

0 comments on commit 78b679d

Please sign in to comment.