-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathblock_scanner_test.go
61 lines (51 loc) · 1.19 KB
/
block_scanner_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"eth-relay/dao"
"testing"
"fmt"
"math/big"
)
/**
作者(Author): 林冠宏 / 指尖下的幽灵
Created on : 2018/12/11
*/
func TestBlockScanner_Start(t *testing.T) {
requester := NewETHRPCRequester("https://mainnet.infura.io/v3/2e6d9331f74d472a9d47fe99f697ca2b")
option := dao.MysqlOptions{
Hostname: "127.0.0.1",
Port: "3306",
DbName: "eth_relay",
User: "root",
Password: "123aaa",
TablePrefix: "eth_",
MaxOpenConnections: 10,
MaxIdleConnections: 5,
ConnMaxLifetime: 15,
}
tables := []interface{}{}
tables = append(tables, dao.Block{}, dao.Transaction{})
mysql := dao.NewMqSQLConnector(&option, tables)
scanner := NewBlockScanner(*requester, mysql)
err := scanner.Start()
if err != nil {
panic(err)
}
select {}
}
func TestName2(t *testing.T) {
fmt.Println(new(big.Int).SetString("68d5bc",16))
}
type Obj struct {
T dao.Block
}
func TestPoint(t *testing.T) {
o := &Obj{}
o.T = dao.Block{BlockNumber:"456"}
fmt.Println(o.T.BlockNumber)
new := &dao.Block{BlockNumber:"123"}
o.a(new)
fmt.Println(o.T.BlockNumber)
}
func (o *Obj) a(block *dao.Block) {
o.T = *block
}