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
1
Merge Requests
1
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
szh
chain33-pai
Commits
b207557c
Commit
b207557c
authored
Mar 20, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加树莓派节点版本更新 节点内部更新数据的状态的获知
parent
4ec0bd2f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
1 deletion
+49
-1
README.md
README.md
+16
-0
client.go
pkg/chain33/client.go
+5
-0
node.go
routers/api/v1/node.go
+24
-0
router.go
routers/router.go
+4
-1
No files found.
README.md
View file @
b207557c
...
...
@@ -340,6 +340,22 @@ response
```
### bityuan更新重启后 查看内部区块和数据库是否更新完成 内网接口
URL /pai/nodeupdate
请求方法 post json
|参数|类型|是否必填|说明|
```
response
{
"code": 200,
"msg": "ok",
"status": true //true 表示还在内部更新中
}
```
## 节点部署:
监控程序代码默认放在/home/pi目录下面
钱包节点程序命名为v7-bityuan
...
...
pkg/chain33/client.go
View file @
b207557c
...
...
@@ -52,3 +52,7 @@ func (p *PaiClient) Close() (*types.Reply,error) {
func
(
p
*
PaiClient
)
Unlock
(
lock
*
types
.
WalletUnLock
)(
*
types
.
Reply
,
error
){
return
paiClient
.
UnLock
(
context
.
Background
(),
lock
)
}
func
(
p
*
PaiClient
)
IsSync
()
(
*
types
.
Reply
,
error
)
{
return
paiClient
.
IsSync
(
context
.
Background
(),
&
types
.
ReqNil
{})
}
\ No newline at end of file
routers/api/v1/node.go
View file @
b207557c
...
...
@@ -614,3 +614,26 @@ func EscrowPasswd(c *gin.Context){
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
}
//如果bityuan进程开启 端口没开启 默认认为是在版本内部升级过程中 确定是否还在版本更新中 status false 表示已同步完成 true 表示还在版本同步中
func
UpdateNodeStatus
(
c
*
gin
.
Context
){
appG
:=
app
.
Gin
{
C
:
c
}
var
update
bool
var
buf
bytes
.
Buffer
cmd
:=
exec
.
Command
(
"netstat"
,
"-tunlp"
)
cmd
.
Stdout
=
&
buf
err
:=
cmd
.
Run
()
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
NODE_ERROR
,
nil
)
return
}
//程序运行 + 端口没开启
if
strings
.
Contains
(
buf
.
String
(),
"v7-bityuan"
)
&&
!
strings
.
Contains
(
buf
.
String
(),
":8801"
)
&&
strings
.
Contains
(
buf
.
String
(),
":6060"
)
{
update
=
true
}
else
if
!
strings
.
Contains
(
buf
.
String
(),
"v7-bityuan"
)
{
appG
.
Response
(
http
.
StatusOK
,
e
.
NODE_ERROR
,
nil
)
return
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
gin
.
H
{
"status"
:
update
,
})
}
\ No newline at end of file
routers/router.go
View file @
b207557c
...
...
@@ -18,7 +18,10 @@ func InitRouter() *gin.Engine {
apiv1
.
POST
(
"/devdetail"
,
v1
.
GetDevdetail
)
//获取树莓派基本信息
apiv1
.
POST
(
"/resetwallet"
,
v1
.
ResetWallet
)
//更新bityuan节点 下载替换 重启
apiv1
.
POST
(
"/updatenode"
,
v1
.
UpdateNodeNew
)
//检查节点是否还在更新同步 节点6.4.0大版本更新可能需要十几个小时 故加此接口
apiv1
.
POST
(
"/nodeupdate"
,
v1
.
UpdateNodeStatus
)
apiv1
.
POST
(
"/devstatus"
,
v1
.
GetDevstatus
)
apiv1
.
POST
(
"/updatedetail"
,
v1
.
UpdateDetail
)
apiv1
.
POST
(
"/version"
,
v1
.
Version
)
...
...
@@ -40,7 +43,7 @@ func InitRouter() *gin.Engine {
//反馈处理进度
apiv1
.
POST
(
"/iscomplete"
,
v1
.
FeedBackStatus
)
apiv1
.
POST
(
"/escrowpassword"
,
v1
.
EscrowPasswd
)
//更新完成用户手动重启设备
//
pai
更新完成用户手动重启设备
apiv1
.
POST
(
"/isreboot"
,
v1
.
IsReBoot
)
return
r
...
...
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