def run_steemd_tests( debug_node ): from steemapi.steemnoderpc import SteemNodeRPC try: print( 'Replaying blocks...', ) sys.stdout.flush() total_blocks = 0 while( total_blocks % 100000 == 0 ): total_blocks += debug_node.debug_push_blocks( 100000, skip_validate_invariants=True ) print( 'Blocks Replayed: ' + str( total_blocks ) ) sys.stdout.flush() print( "Triggering payouts" ) sys.stdout.flush() debug_node.debug_generate_blocks_until( 1467590400 - 3 ) rpc = SteemNodeRPC( 'ws://127.0.0.1:8095', '', '' ) ret = rpc.lookup_accounts( '', str( 0xFFFFFFFF ) ) account_balances = {} for acc_name in ret: acc = rpc.get_accounts( [ acc_name ] ) steemd = float( acc[0][ 'balance' ].split( ' ' )[0] ) sbd = float( acc[0][ 'sbd_balance' ].split( ' ' )[0] ) vests = float( acc[0][ 'vesting_shares' ].split( ' ' )[0] ) account_balances[ acc_name ] = ( steemd, sbd, vests ) debug_node.debug_generate_blocks( 1 ) account_rewards = {} for acc_name, bal in account_balances.items(): acc = rpc.get_accounts( [ acc_name ] ) steemd = float( acc[0][ 'balance' ].split( ' ' )[0] ) - bal[0] sbd = float( acc[0][ 'sbd_balance' ].split( ' ' )[0] ) - bal[1] vests = float( acc[0][ 'vesting_shares' ].split( ' ' )[0] ) - bal[2] account_rewards[ acc_name ] = ( steemd, sbd, vests ) print( "Generating blocks to verify nothing broke" ) assert( debug_node.debug_generate_blocks( 10 ) == 10 ) ''' print( "Done!" ) print( "Getting comment dump:" ) sys.stdout.flush() ret = rpc.get_discussions_by_cashout_time( '', '', str( 0xFFFFFFFF ) ); print( 'author, url, total_payout_value, abs_rshares, num_active_votes' ) for comment in ret: print( comment[ 'author' ] + ', ' + comment[ 'url' ] + ', ' + comment[ 'total_payout_value' ] + ', ' + comment[ 'cashout_time' ] ) ''' print( "Printing account reward dump:" ) print( "account, steem, sbd, vests" ) for acc_name, rew in account_rewards.items(): print( acc_name + ', ' + str( rew[0] ) + ' STEEM, ' + str( rew[1] ) + ' SBD, ' + str( rew[2] ) + ' VESTS' ) except ValueError as val_err: print( str( val_err ) )
def run_steemd_tests(debug_node): from steemapi.steemnoderpc import SteemNodeRPC try: print('Replaying blocks...', ) sys.stdout.flush() total_blocks = 0 while (total_blocks % 100000 == 0): total_blocks += debug_node.debug_push_blocks( 100000, skip_validate_invariants=True) print('Blocks Replayed: ' + str(total_blocks)) sys.stdout.flush() print("Triggering payouts") sys.stdout.flush() debug_node.debug_generate_blocks_until(1467590400 - 3) rpc = SteemNodeRPC('ws://127.0.0.1:8095', '', '') ret = rpc.lookup_accounts('', str(0xFFFFFFFF)) debug_node.debug_generate_blocks(1) print("Generating blocks to verify nothing broke") assert (debug_node.debug_generate_blocks(10) == 10) account_rewards = {} vote_count = {} for acc_name in ret: acc = rpc.get_accounts([acc_name]) #print( acc_name + ',' + acc[0][ 'curation_rewards' ] ) account_rewards[acc_name] = float( acc[0]['curation_rewards'].split(' ')[0]) vote_count[acc_name] = int(acc[0]['lifetime_vote_count']) ''' print( "Done!" ) print( "Getting comment dump:" ) sys.stdout.flush() ret = rpc.get_discussions_by_cashout_time( '', '', str( 0xFFFFFFFF ) ); print( 'author, url, total_payout_value, abs_rshares, num_active_votes' ) for comment in ret: print( comment[ 'author' ] + ', ' + comment[ 'url' ] + ', ' + comment[ 'total_payout_value' ] + ', ' + comment[ 'cashout_time' ] ) ''' print("Printing account reward dump:") sorted_rewards = sorted(account_rewards.items(), key=operator.itemgetter(1)) print("account, curation_steem") for rew in sorted_rewards: print(rew[0] + ', ' + str(rew[1]) + ', ' + str(vote_count[rew[0]])) except ValueError as val_err: print(str(val_err))
def run_steemd_tests( debug_node ): from steemapi.steemnoderpc import SteemNodeRPC try: print( 'Replaying blocks...', ) sys.stdout.flush() total_blocks = 0 while( total_blocks % 100000 == 0 ): total_blocks += debug_node.debug_push_blocks( 100000, skip_validate_invariants=True ) print( 'Blocks Replayed: ' + str( total_blocks ) ) sys.stdout.flush() print( "Triggering payouts" ) sys.stdout.flush() debug_node.debug_generate_blocks_until( 1467590400 - 3 ) rpc = SteemNodeRPC( 'ws://127.0.0.1:8095', '', '' ) ret = rpc.lookup_accounts( '', str( 0xFFFFFFFF ) ) debug_node.debug_generate_blocks( 1 ) print( "Generating blocks to verify nothing broke" ) assert( debug_node.debug_generate_blocks( 10 ) == 10 ) account_rewards = {} vote_count = {} for acc_name in ret: acc = rpc.get_accounts( [ acc_name ] ) #print( acc_name + ',' + acc[0][ 'curation_rewards' ] ) account_rewards[ acc_name ] = float( acc[0][ 'curation_rewards' ].split( ' ' )[0] ) vote_count[ acc_name ] = int( acc[0][ 'lifetime_vote_count' ] ) ''' print( "Done!" ) print( "Getting comment dump:" ) sys.stdout.flush() ret = rpc.get_discussions_by_cashout_time( '', '', str( 0xFFFFFFFF ) ); print( 'author, url, total_payout_value, abs_rshares, num_active_votes' ) for comment in ret: print( comment[ 'author' ] + ', ' + comment[ 'url' ] + ', ' + comment[ 'total_payout_value' ] + ', ' + comment[ 'cashout_time' ] ) ''' print( "Printing account reward dump:" ) sorted_rewards = sorted( account_rewards.items(), key=operator.itemgetter(1) ) print( "account, curation_steem" ) for rew in sorted_rewards: print( rew[0] + ', ' + str( rew[1] ) + ', ' + str( vote_count[ rew[0] ] ) ) except ValueError as val_err: print( str( val_err ) )