Skip to content
37 changes: 37 additions & 0 deletions tinman/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This Python file uses the following encoding: utf-8


MAINNET_PREFIX = "STM"
TESTNET_PREFIX = "TST"
PUB_KEY_LEN = 53
MAINNET_DISABLED_WITNESS_KEY = "STM1111111111111111111111111111111114T1Anm"
TESTNET_DISABLED_WITNESS_KEY = "TST1111111111111111111111111111111114T1Anm"


"""
Whitelist of exceptions from transaction source (Mainnet)."
"""

TRANSACTION_SOURCE_RETRYABLE_ERRORS = [
"Unable to acquire database lock",
"Internal Error",
"Server error",
"Upstream response error"
]

MAX_RETRY = 30

DATABASE_API_SINGLE_QUERY_LIMIT = 1000

ACTIONS_MAJOR_VERSION_SUPPORTED = 0
ACTIONS_MINOR_VERSION_SUPPORTED = 2


SNAPSHOT_MAJOR_VERSION_SUPPORTED = 0
SNAPSHOT_MINOR_VERSION_SUPPORTED = 2
STEEM_GENESIS_TIMESTAMP = 1451606400
STEEM_BLOCK_INTERVAL = 3
NUM_BLOCKS_TO_CLEAR_WITNESS_ROUND = 21
TRANSACTION_WITNESS_SETUP_PAD = 100
STEEM_MAX_AUTHORITY_MEMBERSHIP = 10
DENOM = 10**12 # we need stupidly high precision because VESTS
9 changes: 1 addition & 8 deletions tinman/gatling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@
from . import prockey
from . import util

# Whitelist of exceptions from transaction source (Mainnet).
TRANSACTION_SOURCE_RETRYABLE_ERRORS = [
"Unable to acquire database lock",
"Internal Error",
"Server error",
"Upstream response error"
]
from tinman.constants import MAX_RETRY, TRANSACTION_SOURCE_RETRYABLE_ERRORS

MAX_RETRY = 30

def str2bool(str_arg):
"""
Expand Down
10 changes: 5 additions & 5 deletions tinman/prefixsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
import sys
import math

MAINNET_PREFIX = "STM"
TESTNET_PREFIX = "TST"
PUB_KEY_LEN = 53
MAINNET_DISABLED_WITNESS_KEY = "STM1111111111111111111111111111111114T1Anm"
TESTNET_DISABLED_WITNESS_KEY = "TST1111111111111111111111111111111114T1Anm"
from tinman.constants import MAINNET_PREFIX, TESTNET_PREFIX, PUB_KEY_LEN, MAINNET_DISABLED_WITNESS_KEY,\
TESTNET_DISABLED_WITNESS_KEY


def transform_prefix(object):
if isinstance(object, list):
Expand All @@ -37,6 +35,7 @@ def transform_prefix(object):
else:
return object


def main(argv):
parser = argparse.ArgumentParser(prog=argv[0], description="Substitute prefix")
parser.add_argument("-i", "--input-file", default="-", dest="input_file", metavar="FILE", help="File to read actions from")
Expand Down Expand Up @@ -75,5 +74,6 @@ def main(argv):
if args.output_file != "-":
output_file.close()


if __name__ == "__main__":
main(sys.argv)
1 change: 1 addition & 0 deletions tinman/simple_steem_client
Submodule simple_steem_client added at 1fb4ef
11 changes: 1 addition & 10 deletions tinman/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,8 @@
from simple_steem_client.client import SteemRemoteBackend, SteemInterface, SteemRPCException

from . import __version__
from tinman.constants import DATABASE_API_SINGLE_QUERY_LIMIT, MAX_RETRY, TRANSACTION_SOURCE_RETRYABLE_ERRORS

DATABASE_API_SINGLE_QUERY_LIMIT = 1000
MAX_RETRY = 30

# Whitelist of exceptions from transaction source (Mainnet).
TRANSACTION_SOURCE_RETRYABLE_ERRORS = [
"Unable to acquire database lock",
"Internal Error",
"Server error",
"Upstream response error"
]

def list_all_accounts(steemd):
""" Generator function providing set of accounts existing in the Main Steem net """
Expand Down
6 changes: 3 additions & 3 deletions tinman/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
import sys
import time
import traceback

from . import util
from tinman.constants import ACTIONS_MAJOR_VERSION_SUPPORTED, ACTIONS_MINOR_VERSION_SUPPORTED

ACTIONS_MAJOR_VERSION_SUPPORTED = 0
ACTIONS_MINOR_VERSION_SUPPORTED = 2

class TransactionSigner(object):
def __init__(self, sign_transaction_exe=None, chain_id=None):
Expand All @@ -37,6 +35,7 @@ def sign_transaction(self, tx, wif):
line = self.proc.stdout.readline().decode("utf-8")
return json.loads(line)


class CachedDgpo(object):
def __init__(self, timefunc=time.time, refresh_interval=1.0, steemd=None):
self.timefunc = timefunc
Expand Down Expand Up @@ -111,6 +110,7 @@ def generate_blocks(steemd, args, cached_dgpo=None, now=None, produce_realtime=F
)
return


def main(argv):

parser = argparse.ArgumentParser(prog=argv[0], description="Submit transactions to Steem")
Expand Down
12 changes: 4 additions & 8 deletions tinman/txgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,10 @@
from . import __version__
from . import prockey
from . import util
from tinman.constants import SNAPSHOT_MAJOR_VERSION_SUPPORTED, SNAPSHOT_MINOR_VERSION_SUPPORTED, STEEM_GENESIS_TIMESTAMP, \
STEEM_BLOCK_INTERVAL, NUM_BLOCKS_TO_CLEAR_WITNESS_ROUND, TRANSACTION_WITNESS_SETUP_PAD, \
STEEM_MAX_AUTHORITY_MEMBERSHIP, DENOM

SNAPSHOT_MAJOR_VERSION_SUPPORTED = 0
SNAPSHOT_MINOR_VERSION_SUPPORTED = 2
STEEM_GENESIS_TIMESTAMP = 1451606400
STEEM_BLOCK_INTERVAL = 3
NUM_BLOCKS_TO_CLEAR_WITNESS_ROUND = 21
TRANSACTION_WITNESS_SETUP_PAD = 100
STEEM_MAX_AUTHORITY_MEMBERSHIP = 10
DENOM = 10**12 # we need stupidly high precision because VESTS

def create_system_accounts(conf, keydb, name):
desc = conf["accounts"][name]
Expand All @@ -53,6 +48,7 @@ def create_system_accounts(conf, keydb, name):

return


def vote_accounts(conf, keydb, elector, elected):
er_desc = conf["accounts"][elector]
ed_desc = conf["accounts"][elected]
Expand Down