Ejemplo n.º 1
0
@organization: 
@author:  https://github.com/drandreaskrueger
@see:     https://github.com/drandreaskrueger/chainhammer for updates
"""

import os, sqlite3, pytest

import reader.blocksDB_create as DBcreate
from .test_tps import sendMoney_andWaitForReceipt

###############################################################
# web3 connection and nodetype

from hammer.config import RPCaddress
from hammer.clienttools import web3connection
answer = web3connection(RPCaddress=RPCaddress)
global w3, NODENAME, NODETYPE, CONSENSUS, NETWORKID, CHAINNAME, CHAINID
w3, chainInfos = answer
NODENAME, NODETYPE, CONSENSUS, NETWORKID, CHAINNAME, CHAINID = chainInfos

# current path one up?
# unfortunately path if different depending on how py.test is called
path = os.path.abspath(os.curdir)
if os.path.split(path)[-1] == "tests":
    os.chdir("..")

###############################################################
# for the temporary throwaway database
# TODO: how to delete at the end of all tests?

Ejemplo n.º 2
0
    else:
        print("Nope. Choice '%s'" % sys.argv[2], "not recognized.")
        exit()

    print("%d transaction hashes recorded, examples: %s" % (len(txs), txs[:2]))

    return txs


if __name__ == '__main__':

    check_CLI_or_syntax_info_and_exit()

    global w3, NODENAME, NODETYPE, NODEVERSION, CONSENSUS, NETWORKID, CHAINNAME, CHAINID
    w3, chainInfos = web3connection(RPCaddress=RPCaddress, account=None)
    NODENAME, NODETYPE, NODEVERSION, CONSENSUS, NETWORKID, CHAINNAME, CHAINID = chainInfos

    # wait_some_blocks(0); exit()
    # timeit_argument_encoding(); exit()
    # try_contract_set_via_web3(contract); exit()
    # try_contract_set_via_RPC(contract);  exit()

    w3.eth.defaultAccount = w3.eth.accounts[0]  # set first account as sender
    contract = initialize_fromAddress()

    txs = sendmany(contract)
    sys.stdout.flush()  # so that the log files are updated.

    success = controlSample_transactionsSuccessful(txs)
    sys.stdout.flush()