mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
tools: show recent shares
This commit is contained in:
parent
647971cde6
commit
4d69befdd1
1 changed files with 20 additions and 0 deletions
20
tools/inspect-data
vendored
20
tools/inspect-data
vendored
|
@ -115,6 +115,22 @@ def print_mined(path):
|
||||||
print('{}\t{}\t{}\t{}'.format(height, status, reward, dt))
|
print('{}\t{}\t{}\t{}'.format(height, status, reward, dt))
|
||||||
env.close()
|
env.close()
|
||||||
|
|
||||||
|
def print_shares(path):
|
||||||
|
env = lmdb.open(path, readonly=True, max_dbs=1, create=False)
|
||||||
|
shares = env.open_db('shares'.encode(), dupsort=True)
|
||||||
|
with env.begin(db=shares) as txn:
|
||||||
|
with txn.cursor() as curs:
|
||||||
|
curs.last()
|
||||||
|
for i in range(10):
|
||||||
|
key, value = curs.item()
|
||||||
|
height = c_longlong.from_buffer_copy(key).value
|
||||||
|
share = share_t.from_buffer_copy(value)
|
||||||
|
address = format_address(address_from_key(share.address))
|
||||||
|
print('{}\t{}'.format(height, address))
|
||||||
|
if not curs.prev():
|
||||||
|
break
|
||||||
|
env.close()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
group = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
@ -124,6 +140,8 @@ def main():
|
||||||
help='list payments made')
|
help='list payments made')
|
||||||
group.add_argument('-m', '--mined', action='store_true',
|
group.add_argument('-m', '--mined', action='store_true',
|
||||||
help='list mined blocks')
|
help='list mined blocks')
|
||||||
|
group.add_argument('-s', '--shares', action='store_true',
|
||||||
|
help='list recent shares')
|
||||||
parser.add_argument('database', help='path to database')
|
parser.add_argument('database', help='path to database')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.balances:
|
if args.balances:
|
||||||
|
@ -132,6 +150,8 @@ def main():
|
||||||
print_payements(args.database)
|
print_payements(args.database)
|
||||||
elif args.mined:
|
elif args.mined:
|
||||||
print_mined(args.database)
|
print_mined(args.database)
|
||||||
|
elif args.shares:
|
||||||
|
print_shares(args.database)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue