2020-02-03 03:21:51 +00:00
#!/usr/bin/env python3
""" Spam a bunch of Onionr blocks """
# Please don't run this script on the real Onionr network. You wouldn't do anything but be annoying
2020-03-03 11:55:50 +00:00
print ( " Please don ' t run this script on Onionr networks that include more than you. You wouldn ' t do anything but be annoying, and probably violate law " )
2020-02-03 03:21:51 +00:00
import sys
import os
2020-08-23 10:53:43 +00:00
if not os . path . exists ( ' onionr.sh ' ) :
os . chdir ( ' ../ ' )
2020-02-03 03:21:51 +00:00
sys . path . append ( " src/ " )
2021-01-17 04:58:28 +00:00
import oldblocks
2020-02-03 03:21:51 +00:00
amount = int ( input ( " Number of blocks: " ) )
2020-03-03 11:55:50 +00:00
expire = input ( " Expire in seconds: " )
if not expire :
expire = " "
else :
expire = int ( expire )
2020-02-03 03:21:51 +00:00
for i in range ( amount ) :
2020-03-03 11:55:50 +00:00
if expire :
2021-01-17 04:58:28 +00:00
print ( oldblocks . insert ( data = os . urandom ( 32 ) , expire = expire ) )
2020-03-03 11:55:50 +00:00
else :
2021-01-17 04:58:28 +00:00
print ( oldblocks . insert ( data = os . urandom ( 32 ) ) )
2020-02-03 03:21:51 +00:00
print ( i , " done " )