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 + ";"
def test_timestampToSeconds_testrpc(): assert 1 == tps.timestampToSeconds(205, NODENAME="TestRPC", CONSENSUS="whatever")
def test_timestampToSeconds_raft(): assert 1 == tps.timestampToSeconds(1000000000, NODENAME="Quorum", CONSENSUS="raft")
def test_timestampToSeconds_default(): assert 1 == tps.timestampToSeconds(1, NODENAME="Geth", CONSENSUS="clique")