Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ligaishun
chain33-pai
Commits
b9be98f0
Commit
b9be98f0
authored
Oct 04, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
e3111040
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
3 deletions
+45
-3
app.ini
conf/app.ini
+4
-0
main.go
main.go
+4
-1
miner.go
miner/miner.go
+9
-0
client.go
pkg/chain33/client.go
+21
-2
setting.go
pkg/setting/setting.go
+7
-0
No files found.
conf/app.ini
View file @
b9be98f0
...
@@ -40,3 +40,6 @@ Password =
...
@@ -40,3 +40,6 @@ Password =
MaxIdle
=
30
MaxIdle
=
30
MaxActive
=
30
MaxActive
=
30
IdleTimeout
=
200
IdleTimeout
=
200
[block]
Host
=
127.0.0.1:8802
\ No newline at end of file
main.go
View file @
b9be98f0
...
@@ -9,7 +9,9 @@ import (
...
@@ -9,7 +9,9 @@ import (
"chain33-pai/pkg/logging"
"chain33-pai/pkg/logging"
"chain33-pai/pkg/setting"
"chain33-pai/pkg/setting"
"chain33-pai/routers"
"chain33-pai/routers"
"chain33-pai/models"
"chain33-pai/pkg/util"
"chain33-pai/pkg/util"
"chain33-pai/pkg/chain33"
"net"
"net"
"time"
"time"
"chain33-pai/service/pai_service"
"chain33-pai/service/pai_service"
...
@@ -17,9 +19,10 @@ import (
...
@@ -17,9 +19,10 @@ import (
func
init
()
{
func
init
()
{
setting
.
Setup
()
setting
.
Setup
()
//
models.Setup()
models
.
Setup
()
logging
.
Setup
()
logging
.
Setup
()
//gredis.Setup()
//gredis.Setup()
chain33
.
Setup
()
util
.
Setup
()
util
.
Setup
()
}
}
...
...
miner/miner.go
0 → 100644
View file @
b9be98f0
package
miner
func
init
()
{
}
func
SyncBlock
()
{
}
pkg/chain33/client.go
View file @
b9be98f0
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
"google.golang.org/grpc"
"google.golang.org/grpc"
"context"
"context"
"chain33-pai/pkg/setting"
)
)
type
PaiClient
struct
{
type
PaiClient
struct
{
...
@@ -15,9 +16,9 @@ var (
...
@@ -15,9 +16,9 @@ var (
paiNetgrpcAddr
=
"localhost:8802"
paiNetgrpcAddr
=
"localhost:8802"
)
)
func
init
()
{
func
Setup
()
{
maxReceLimit
:=
grpc
.
WithMaxMsgSize
(
30
*
1024
*
1024
)
maxReceLimit
:=
grpc
.
WithMaxMsgSize
(
30
*
1024
*
1024
)
conn
,
err
:=
grpc
.
Dial
(
paiNetgrpcAddr
,
grpc
.
WithInsecure
(),
maxReceLimit
)
conn
,
err
:=
grpc
.
Dial
(
setting
.
BlockSetting
.
Host
,
grpc
.
WithInsecure
(),
maxReceLimit
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
...
@@ -39,3 +40,20 @@ func (p *PaiClient) IsNtpClockSync() (*types.Reply,error) {
...
@@ -39,3 +40,20 @@ func (p *PaiClient) IsNtpClockSync() (*types.Reply,error) {
func
(
p
*
PaiClient
)
GetNetInfo
()
(
*
types
.
NodeNetInfo
,
error
)
{
func
(
p
*
PaiClient
)
GetNetInfo
()
(
*
types
.
NodeNetInfo
,
error
)
{
return
paiClient
.
NetInfo
(
context
.
Background
(),
&
types
.
ReqNil
{})
return
paiClient
.
NetInfo
(
context
.
Background
(),
&
types
.
ReqNil
{})
}
}
func
(
p
*
PaiClient
)
GetBlocks
(
req
*
types
.
ReqBlocks
)
(
*
types
.
BlockDetails
,
error
)
{
var
detail
types
.
BlockDetails
reply
,
err
:=
paiClient
.
GetBlocks
(
context
.
Background
(),
req
)
if
err
!=
nil
{
return
nil
,
err
}
err
=
types
.
Decode
(
reply
.
Msg
,
&
detail
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
detail
,
nil
}
func
(
p
*
PaiClient
)
GetLastHeader
()
(
*
types
.
Header
,
error
)
{
return
paiClient
.
GetLastHeader
(
context
.
Background
(),
&
types
.
ReqNil
{})
}
\ No newline at end of file
pkg/setting/setting.go
View file @
b9be98f0
...
@@ -60,6 +60,12 @@ type Redis struct {
...
@@ -60,6 +60,12 @@ type Redis struct {
var
RedisSetting
=
&
Redis
{}
var
RedisSetting
=
&
Redis
{}
type
block
struct
{
Host
string
}
var
BlockSetting
=
&
block
{}
var
cfg
*
ini
.
File
var
cfg
*
ini
.
File
// Setup initialize the configuration instance
// Setup initialize the configuration instance
...
@@ -74,6 +80,7 @@ func Setup() {
...
@@ -74,6 +80,7 @@ func Setup() {
mapTo
(
"server"
,
ServerSetting
)
mapTo
(
"server"
,
ServerSetting
)
mapTo
(
"database"
,
DatabaseSetting
)
mapTo
(
"database"
,
DatabaseSetting
)
mapTo
(
"redis"
,
RedisSetting
)
mapTo
(
"redis"
,
RedisSetting
)
mapTo
(
"block"
,
BlockSetting
)
AppSetting
.
ImageMaxSize
=
AppSetting
.
ImageMaxSize
*
1024
*
1024
AppSetting
.
ImageMaxSize
=
AppSetting
.
ImageMaxSize
*
1024
*
1024
ServerSetting
.
ReadTimeout
=
ServerSetting
.
ReadTimeout
*
time
.
Second
ServerSetting
.
ReadTimeout
=
ServerSetting
.
ReadTimeout
*
time
.
Second
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment