Skip to content

Commit 1fd559f

Browse files
committed
fix
1 parent af84750 commit 1fd559f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tronapi/tron.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def get_block(self, block=None):
7777
if block == 'latest':
7878
return self.get_current_block()
7979

80-
if type(block) is str:
80+
if len(block) == 64:
8181
return self.get_block_by_hash(block)
8282

83-
return self.get_block_by_number(block)
83+
return self.get_block_by_number(int(block))
8484

8585
def get_block_by_hash(self, hash_block):
8686
"""Query block by ID
@@ -94,7 +94,7 @@ def get_block_by_hash(self, hash_block):
9494
"""
9595
return self.full_node.request('/wallet/getblockbyid', {
9696
'value': hash_block
97-
})
97+
}, 'post')
9898

9999
def get_block_by_number(self, block_id):
100100
"""Query block by height
@@ -111,7 +111,7 @@ def get_block_by_number(self, block_id):
111111

112112
return self.full_node.request('/wallet/getblockbynum', {
113113
'num': int(block_id)
114-
})
114+
}, 'post')
115115

116116
def get_block_transaction_count(self, block=None):
117117
"""Total number of transactions in a block

0 commit comments

Comments
 (0)