mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
wip writing internals
This commit is contained in:
parent
efbb2a7a87
commit
20ff154473
3 changed files with 38 additions and 4 deletions
|
|
@ -576,20 +576,35 @@ func (jst *Tracer) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, er
|
|||
}
|
||||
|
||||
type Internals struct {
|
||||
Type string
|
||||
From string
|
||||
To string
|
||||
Value string
|
||||
Gas string
|
||||
GasUsed string
|
||||
Input string
|
||||
Output string
|
||||
Time string
|
||||
Calls []*Internals
|
||||
}
|
||||
|
||||
//func (i *Internals) SWriteInteralTxs() {
|
||||
// connStr := "user=postgres dbname=shyftdb sslmode=disable"
|
||||
// sqldb, err := sql.Open("postgres", connStr)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// sqlStatement := `INSERT INTO internalTxs(type, txhash, from_addr, to_addr, amount, gas, gasUsed, time, input, output) VALUES(($1), ($2), ($3), ($4), ($5), ($6), ($7), ($8), ($9), ($10))`
|
||||
// qerr := sqldb.QueryRow(sqlStatement, i.Type, txHash, i.From, i.To, i.Value, i.Gas, i.GasUsed, i.Time, i.Input, i.Output)
|
||||
//
|
||||
// if qerr != nil {
|
||||
// panic(qerr)
|
||||
// }
|
||||
//}
|
||||
|
||||
func (i *Internals) InternalRecursive() {
|
||||
fmt.Println("[Internal To]", i.To)
|
||||
fmt.Println("[Internal From]", i.From)
|
||||
lengthOfCalls := len(i.Calls)
|
||||
fmt.Println("[LENGTH OF CALLS]", lengthOfCalls)
|
||||
if lengthOfCalls == 0 {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS blocks (
|
|||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS txs (
|
||||
txHash text,
|
||||
txHash text primary key unique,
|
||||
to_addr text,
|
||||
from_addr text,
|
||||
blockhash text references blocks(hash),
|
||||
|
|
@ -39,3 +39,20 @@ CREATE TABLE IF NOT EXISTS accounts (
|
|||
txCountAccount numeric
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS contracts (
|
||||
txHash text
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS internalTxs (
|
||||
id SERIAL PRIMARY KEY,
|
||||
txHash text references txs(txHash),
|
||||
type text,
|
||||
to_addr text,
|
||||
from_addr text,
|
||||
amount text,
|
||||
gas numeric,
|
||||
gasUsed numeric,
|
||||
time text,
|
||||
input text,
|
||||
output text
|
||||
)
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
DROP TABLE internalTxs;
|
||||
DROP TABLE txs;
|
||||
DROP TABLE blocks;
|
||||
DROP TABLE accounts;
|
||||
DROP TABLE contracts;
|
||||
Loading…
Reference in a new issue