def DB_writeRow_SQL(block):
    """
    takes in Ethereum block, creates sql INSERT statement 
    """
    valuesstring = "({number},{timestamp},{size},{gasUsed},{gasLimit},{txcount})"

    b = dict(block)
    b["txcount"] = len(block["transactions"])
    b["timestamp"] = timestampToSeconds(b["timestamp"], NODENAME, CONSENSUS)

    values = valuesstring.format(**b)

    return "INSERT INTO blocks VALUES " + values + ";"
Exemple #2
0
def test_timestampToSeconds_testrpc():
    assert 1 == tps.timestampToSeconds(205, NODENAME="TestRPC", CONSENSUS="whatever")
Exemple #3
0
def test_timestampToSeconds_raft():
    assert 1 == tps.timestampToSeconds(1000000000, NODENAME="Quorum", CONSENSUS="raft")
Exemple #4
0
def test_timestampToSeconds_default():
    assert 1 == tps.timestampToSeconds(1, NODENAME="Geth", CONSENSUS="clique")