Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
20221235
Commit
20221235
authored
Oct 22, 2019
by
liuyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable get sys getForks()
parent
2f13a35a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
52 deletions
+58
-52
main.go
cli/fork_config/main.go
+57
-51
go.mod
go.mod
+1
-1
No files found.
cli/fork_config/main.go
View file @
20221235
...
@@ -3,17 +3,22 @@ package main
...
@@ -3,17 +3,22 @@ package main
import
(
import
(
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/plugin/plugin"
_
"github.com/33cn/plugin/plugin"
"fmt"
"github.com/33cn/chain33/types"
"strings"
"os"
"sort"
)
)
func
main
()
{
func
main
()
{
// TODO 后续在开启该功能
cfg
:=
types
.
NewChain33Config
(
strings
.
Replace
(
types
.
GetDefaultCfgstring
(),
"Title=
\"
local
\"
"
,
"Title=
\"
chain33
\"
"
,
1
))
//forks, err := types.CloneFork("chain33"
)
forks
,
err
:=
cfg
.
GetForks
(
)
//
if err != nil {
if
err
!=
nil
{
//
fmt.Printf("clone fork failed: %v", err)
fmt
.
Printf
(
"clone fork failed: %v"
,
err
)
//
return
return
//
}
}
//
//
fmtForks(forks)
fmtForks
(
forks
)
}
}
/*
/*
...
@@ -30,46 +35,47 @@ func main() {
...
@@ -30,46 +35,47 @@ func main() {
[fork.sub.store-kvmvccmavl]
[fork.sub.store-kvmvccmavl]
ForkKvmvccmavl=2270000 # store-kvmvccmavl.ForkKvmvccmavl=1870000
ForkKvmvccmavl=2270000 # store-kvmvccmavl.ForkKvmvccmavl=1870000
*/
*/
//func fmtForks(forks map[string]int64) {
// systemFork := make(map[string]int64)
func
fmtForks
(
forks
map
[
string
]
int64
)
{
// subFork := make(map[string]map[string]int64)
systemFork
:=
make
(
map
[
string
]
int64
)
// for k, v := range forks {
subFork
:=
make
(
map
[
string
]
map
[
string
]
int64
)
// if strings.Contains(k, ".") {
for
k
,
v
:=
range
forks
{
// str2 := strings.SplitN(k, ".", 2)
if
strings
.
Contains
(
k
,
"."
)
{
// if len(str2) != 2 {
str2
:=
strings
.
SplitN
(
k
,
"."
,
2
)
// fmt.Fprintf(os.Stderr, "can't deal key=%s ", k)
if
len
(
str2
)
!=
2
{
// continue
fmt
.
Fprintf
(
os
.
Stderr
,
"can't deal key=%s "
,
k
)
// }
continue
// _, ok := subFork[str2[0]]
}
// if !ok {
_
,
ok
:=
subFork
[
str2
[
0
]]
// subFork[str2[0]] = make(map[string]int64)
if
!
ok
{
// }
subFork
[
str2
[
0
]]
=
make
(
map
[
string
]
int64
)
// subFork[str2[0]][str2[1]] = v
}
// } else {
subFork
[
str2
[
0
]][
str2
[
1
]]
=
v
// systemFork[k] = v
}
else
{
// }
systemFork
[
k
]
=
v
//
}
// }
//
}
// fmt.Println("[fork.system]")
// for k, v := range systemFork {
fmt
.
Println
(
"[fork.system]"
)
// fmt.Printf("%s=%d\n", k, v)
for
k
,
v
:=
range
systemFork
{
// }
fmt
.
Printf
(
"%s=%d
\n
"
,
k
,
v
)
// fmt.Println("")
}
//
fmt
.
Println
(
""
)
// plugins := make([]string, 0)
// for plugin := range subFork {
plugins
:=
make
([]
string
,
0
)
// plugins = append(plugins, plugin)
for
plugin
:=
range
subFork
{
// }
plugins
=
append
(
plugins
,
plugin
)
// sort.Strings(plugins)
}
//
sort
.
Strings
(
plugins
)
// for _, plugin := range plugins {
// fmt.Printf("[fork.sub.%s]\n", plugin)
for
_
,
plugin
:=
range
plugins
{
// forks := subFork[plugin]
fmt
.
Printf
(
"[fork.sub.%s]
\n
"
,
plugin
)
// for k, v := range forks {
forks
:=
subFork
[
plugin
]
// fmt.Printf("%s=%d\n", k, v)
for
k
,
v
:=
range
forks
{
// }
fmt
.
Printf
(
"%s=%d
\n
"
,
k
,
v
)
// fmt.Println("")
}
// }
fmt
.
Println
(
""
)
//
}
//}
}
go.mod
View file @
20221235
...
@@ -78,4 +78,4 @@ require (
...
@@ -78,4 +78,4 @@ require (
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
)
)
replace github.com/33cn/chain33 => github.com/lyh169/chain33 v0.0.0-2019102
1072850-f71d3eddca4a
replace github.com/33cn/chain33 => github.com/lyh169/chain33 v0.0.0-2019102
2063356-de2f9a9bf0d0
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