fix explorer searching debug issue and make correct_rpc official
parent
acf2220301
commit
0c845aa4fe
@ -1,10 +1,17 @@
|
|||||||
from django import template
|
from django import template
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from core.monero import connect_rpc
|
||||||
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@register.filter(is_safe=True)
|
@register.filter(is_safe=True)
|
||||||
def search_block_explorer(param):
|
def search_block_explorer(param):
|
||||||
search_url = f'{settings.BLOCK_EXPLORER}search?value={param}'
|
daemon_rpc = connect_rpc('daemon')
|
||||||
|
if daemon_rpc:
|
||||||
|
net_type = daemon_rpc.daemon.info()['nettype']
|
||||||
|
explorer_url = settings.BLOCK_EXPLORER % net_type
|
||||||
|
search_url = f'{explorer_url}/tx/{param}/autorefresh'
|
||||||
return search_url
|
return search_url
|
||||||
|
else:
|
||||||
|
return '#'
|
||||||
|
Reference in New Issue