@ -6,7 +6,6 @@ from tipbot import wownero
from tipbot import config
from tipbot import config
@wallet_rpc_required
@log_event
@log_event
@check_debug
@check_debug
def mine ( update , context ) :
def mine ( update , context ) :
@ -32,9 +31,23 @@ def mine(update, context):
diff = float ( j [ ' result ' ] [ ' block_header ' ] [ ' difficulty ' ] )
diff = float ( j [ ' result ' ] [ ' block_header ' ] [ ' difficulty ' ] )
lbr = float ( j [ ' result ' ] [ ' block_header ' ] [ ' reward ' ] )
lbr = float ( j [ ' result ' ] [ ' block_header ' ] [ ' reward ' ] )
ttb = diff / hr
ttb = diff / hr
update . message . reply_text ( ' The estimated time to find a block with {0:.2f} k h /s at diff {1:.2e} is {2:.2f} days. On average you will earn {3:.2f} WOW per day ' . format (
update . message . reply_text ( ' The estimated time to find a block with {0:.2f} k H /s at diff {1:.2e} is {2:.2f} days. On average you will earn {3:.2f} WOW per day ' . format (
hr / 1e3 , diff , ttb / ( 60 * 60 * 24 ) , ( lbr / 1e11 ) / ( ttb / ( 60 * 60 * 24 ) )
hr / 1e3 , diff , ttb / ( 60 * 60 * 24 ) , ( lbr / 1e11 ) / ( ttb / ( 60 * 60 * 24 ) )
) )
) )
except :
except :
update . message . reply_text ( ' Something b0rked -_- ' )
update . message . reply_text ( ' Something b0rked -_- ' )
return False
return False
@log_event
@check_debug
def mempool ( update , context ) :
try :
payload = { ' jsonrpc ' : ' 2.0 ' , ' id ' : ' 0 ' , ' method ' : ' get_info ' }
headers = { ' Content-Type ' : ' application/json ' }
r = requests . post ( config . DAEMON_URI + ' /json_rpc ' , json = payload , headers = headers , timeout = 5 )
r . raise_for_status ( )
j = r . json ( )
txs = j [ ' result ' ] [ ' tx_pool_size ' ]
update . message . reply_text ( ' The current number of transactions in mempool is: {0} ' . format ( txs ) )
except :
update . message . reply_text ( ' Something borked -_- ' )