New api to check if given hash is blockhash, transactionhash or noise
This commit is contained in:
parent
e1aaa29a1b
commit
dd26491619
@ -570,6 +570,21 @@ async def getLatestBlockDetails():
|
||||
return jsonify(result='ok', latestBlocks=tempdict)
|
||||
|
||||
|
||||
@app.route('/api/v1.0/checkhash/<hash>')
|
||||
async def checkhash(hash):
|
||||
|
||||
# check if the hash is of a transaction
|
||||
response = requests.get('{}transaction/{}'.format(apiUrl,hash))
|
||||
if response.status_code == 200:
|
||||
return jsonify(type='transaction')
|
||||
else:
|
||||
response = requests.get('{}block/{}'.format(apiUrl,hash))
|
||||
if response.status_code == 200:
|
||||
return jsonify(type='block')
|
||||
else:
|
||||
return jsonify(type='noise')
|
||||
|
||||
|
||||
@app.route('/test')
|
||||
async def test():
|
||||
return render_template('test.html')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user