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
b2638e9d
Commit
b2638e9d
authored
Nov 29, 2018
by
kingwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug amount
parent
78fbea97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
174 additions
and
165 deletions
+174
-165
proc.go
vendor/github.com/33cn/chain33/blockchain/proc.go
+1
-1
create_plugin_file_template.go
...chain33/cmd/tools/strategy/create_plugin_file_template.go
+15
-15
createplugin.go
...ithub.com/33cn/chain33/cmd/tools/strategy/createplugin.go
+15
-15
types.go
vendor/github.com/33cn/chain33/cmd/tools/types/types.go
+1
-1
doc.go
vendor/github.com/33cn/chain33/doc.go
+2
-1
golinter.sh
vendor/github.com/33cn/chain33/golinter.sh
+1
-0
mempool.go
vendor/github.com/33cn/chain33/mempool/mempool.go
+1
-1
pipeline_test.go
vendor/github.com/33cn/chain33/mempool/pipeline_test.go
+13
-13
listener.go
vendor/github.com/33cn/chain33/p2p/listener.go
+1
-1
netaddress.go
vendor/github.com/33cn/chain33/p2p/netaddress.go
+20
-19
p2pserver.go
vendor/github.com/33cn/chain33/p2p/p2pserver.go
+35
-35
client.go
vendor/github.com/33cn/chain33/queue/client.go
+1
-1
queue.go
vendor/github.com/33cn/chain33/queue/queue.go
+3
-3
sm2.go
vendor/github.com/33cn/chain33/system/crypto/sm2/sm2.go
+13
-13
utils.go
vendor/github.com/33cn/chain33/system/crypto/sm2/utils.go
+3
-3
init.go
vendor/github.com/33cn/chain33/system/init.go
+1
-1
base.go
vendor/github.com/33cn/chain33/system/store/base.go
+17
-12
prune.go
vendor/github.com/33cn/chain33/system/store/mavl/db/prune.go
+1
-0
mavl_test.go
...or/github.com/33cn/chain33/system/store/mavl/mavl_test.go
+11
-11
config.go
vendor/github.com/33cn/chain33/types/config.go
+1
-1
jsonpb.go
vendor/github.com/33cn/chain33/types/jsonpb/jsonpb.go
+7
-7
chain33.go
vendor/github.com/33cn/chain33/util/cli/chain33.go
+1
-0
testnode.go
vendor/github.com/33cn/chain33/util/testnode/testnode.go
+1
-0
bipwallet.go
vendor/github.com/33cn/chain33/wallet/bipwallet/bipwallet.go
+1
-1
seed.go
vendor/github.com/33cn/chain33/wallet/seed.go
+3
-5
wallet_msg.go
vendor/github.com/33cn/chain33/wallet/wallet_msg.go
+2
-2
wallet_proc.go
vendor/github.com/33cn/chain33/wallet/wallet_proc.go
+3
-3
No files found.
vendor/github.com/33cn/chain33/blockchain/proc.go
View file @
b2638e9d
...
...
@@ -19,7 +19,7 @@ func (chain *BlockChain) ProcRecvMsg() {
defer
chain
.
recvwg
.
Done
()
reqnum
:=
make
(
chan
struct
{},
1000
)
for
msg
:=
range
chain
.
client
.
Recv
()
{
chainlog
.
Debug
(
"blockchain recv"
,
"msg"
,
types
.
GetEventName
(
int
(
msg
.
Ty
)),
"id"
,
msg
.
I
d
,
"cap"
,
len
(
reqnum
))
chainlog
.
Debug
(
"blockchain recv"
,
"msg"
,
types
.
GetEventName
(
int
(
msg
.
Ty
)),
"id"
,
msg
.
I
D
,
"cap"
,
len
(
reqnum
))
msgtype
:=
msg
.
Ty
reqnum
<-
struct
{}{}
atomic
.
AddInt32
(
&
chain
.
runcount
,
1
)
...
...
vendor/github.com/33cn/chain33/cmd/tools/strategy/create_plugin_file_template.go
View file @
b2638e9d
...
...
@@ -9,7 +9,7 @@ package strategy
//const
const
(
// 創建main.go的文件模板
C
PFT_MAIN_GO
=
`package main
C
pftMainGo
=
`package main
import (
_ "github.com/33cn/chain33/system"
...
...
@@ -26,7 +26,7 @@ func main() {
`
// 生成的配置文件模板 xxx.toml
C
PFT_CFG_TOML
=
`
C
pftCfgToml
=
`
Title="${PROJECTNAME}"
FixTime=false
...
...
@@ -102,14 +102,14 @@ enableMVCC=false
saveTokenTxList=false
`
C
PFT_RUNMAIN_BLOCK
=
`package main
C
pftRunmainBlock
=
`package main
var ${PROJECTNAME} = `
// 生成项目运行主程序的模板 xxx.go
// 顶部还需要加上package main
//var bityuan = `CPFT_RUNMAIN`
C
PFT_RUNMAIN
=
`TestNet=false
C
pftRunMain
=
`TestNet=false
[blockchain]
defCacheSize=128
maxFetchBlockNum=128
...
...
@@ -248,7 +248,7 @@ ForkTradeAsset= -1
`
// 生成项目Makefile文件的模板 Makefile
C
PFT_MAKEFILE
=
`
C
pftMakefile
=
`
CHAIN33=github.com/33cn/chain33
CHAIN33_PATH=vendor/${CHAIN33}
all: vendor proto build
...
...
@@ -297,7 +297,7 @@ clean:
`
// 生成 .travis.yml 文件模板
C
PFT_TRAVIS_YML
=
`
C
pftTravisYml
=
`
language: go
go:
...
...
@@ -306,7 +306,7 @@ go:
`
// 生成 plugin/plugin.toml的文件模板
C
PFT_PLUGIN_TOML
=
`
C
pftPluginToml
=
`
# type字段仅支持 consensus dapp store
[dapp-ticket]
gitrepo = "github.com/33cn/plugin/plugin/dapp/ticket"
...
...
@@ -327,7 +327,7 @@ gitrepo = "github.com/33cn/plugin/plugin/dapp/token"
gitrepo = "github.com/33cn/plugin/plugin/dapp/trade"
`
// 项目 cli/main.go 文件模板
C
PFT_CLI_MAIN
=
`package main
C
pftCliMain
=
`package main
import (
_ "${PROJECTPATH}/plugin"
...
...
@@ -340,7 +340,7 @@ func main() {
}
`
// plugin/dapp/xxxx/commands/cmd.go文件的模板c
C
PFT_DAPP_COMMANDS
=
`package commands
C
pftDappCommands
=
`package commands
import (
"github.com/spf13/cobra"
...
...
@@ -351,7 +351,7 @@ func Cmd() *cobra.Command {
}`
// plugin/dapp/xxxx/plugin.go文件的模板
C
PFT_DAPP_PLUGIN
=
`package ${PROJECTNAME}
C
pftDappPlugin
=
`package ${PROJECTNAME}
import (
"github.com/33cn/chain33/pluginmgr"
...
...
@@ -372,7 +372,7 @@ func init() {
`
// plugin/dapp/xxxx/executor/xxxx.go文件模板
C
PFT_DAPP_EXEC
=
`package executor
C
pftDappExec
=
`package executor
import (
log "github.com/inconshreveable/log15"
...
...
@@ -425,17 +425,17 @@ func (this *${CLASSNAME}) CheckTx(tx *types.Transaction, index int) error {
}
`
// plugin/dapp/xxxx/proto/create_protobuf.sh文件模板
C
PFT_DAPP_CREATEPB
=
`#!/bin/sh
C
pftDappCreatepb
=
`#!/bin/sh
protoc --go_out=plugins=grpc:../types ./*.proto --proto_path=.
`
// plugin/dapp/xxxx/proto/Makefile 文件模板
C
PFT_DAPP_MAKEFILE
=
`all:
C
pftDappMakefile
=
`all:
sh ./create_protobuf.sh
`
// plugin/dapp/xxxx/proto/xxxx.proto的文件模板
C
PFT_DAPP_PROTO
=
`syntax = "proto3";
C
pftDappProto
=
`syntax = "proto3";
package types;
message ${ACTIONNAME} {
...
...
@@ -450,7 +450,7 @@ message ${ACTIONNAME}None {
`
// plugin/dapp/xxxx/types/types.go的文件模板cd
C
PFT_DAPP_TYPEFILE
=
`package types
C
pftDappTypefile
=
`package types
import (
"gitlab.33.cn/chain33/chain33/types"
...
...
vendor/github.com/33cn/chain33/cmd/tools/strategy/createplugin.go
View file @
b2638e9d
...
...
@@ -78,7 +78,7 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
taskSlice
:=
make
([]
tasks
.
Task
,
0
)
taskSlice
=
append
(
taskSlice
,
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_MAIN_GO
,
SourceStr
:
C
pftMainGo
,
OutputFile
:
fmt
.
Sprintf
(
"%s/main.go"
,
c
.
projectPath
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
...
...
@@ -86,15 +86,15 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_CFG_TOML
,
SourceStr
:
C
pftCfgToml
,
OutputFile
:
fmt
.
Sprintf
(
"%s/%s.toml"
,
c
.
projectPath
,
c
.
projName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_RUNMAIN
,
BlockStrBegin
:
C
PFT_RUNMAIN_BLOCK
+
"`"
,
SourceStr
:
C
pftRunMain
,
BlockStrBegin
:
C
pftRunmainBlock
+
"`"
,
BlockStrEnd
:
"`"
,
OutputFile
:
fmt
.
Sprintf
(
"%s/%s.go"
,
c
.
projectPath
,
c
.
projName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
...
...
@@ -102,7 +102,7 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_MAKEFILE
,
SourceStr
:
C
pftMakefile
,
OutputFile
:
fmt
.
Sprintf
(
"%s/Makefile"
,
c
.
projectPath
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
...
...
@@ -112,21 +112,21 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_TRAVIS_YML
,
SourceStr
:
C
pftTravisYml
,
OutputFile
:
fmt
.
Sprintf
(
"%s/.travis.yml"
,
c
.
projectPath
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_PLUGIN_TOML
,
SourceStr
:
C
pftPluginToml
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/plugin.toml"
,
c
.
projectPath
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_CLI_MAIN
,
SourceStr
:
C
pftCliMain
,
OutputFile
:
fmt
.
Sprintf
(
"%s/cli/main.go"
,
c
.
projectPath
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
...
...
@@ -134,14 +134,14 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_COMMANDS
,
SourceStr
:
C
pftDappCommands
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/commands/cmd.go"
,
c
.
projectPath
,
c
.
execName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_PLUGIN
,
SourceStr
:
C
pftDappPlugin
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/plugin.go"
,
c
.
projectPath
,
c
.
projName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
...
...
@@ -150,7 +150,7 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_EXEC
,
SourceStr
:
C
pftDappExec
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/executor/%s.go"
,
c
.
projectPath
,
c
.
projName
,
c
.
execName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagProjectName
:
c
.
projName
,
...
...
@@ -159,24 +159,24 @@ func (c *createPluginStrategy) buildTask() []tasks.Task {
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_CREATEPB
,
SourceStr
:
C
pftDappCreatepb
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/proto/create_protobuf.sh"
,
c
.
projectPath
,
c
.
projName
),
ReplaceKeyPairs
:
map
[
string
]
string
{},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_MAKEFILE
,
SourceStr
:
C
pftDappMakefile
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/proto/Makefile"
,
c
.
projectPath
,
c
.
projName
),
ReplaceKeyPairs
:
map
[
string
]
string
{},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_PROTO
,
SourceStr
:
C
pftDappProto
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/proto/%s.proto"
,
c
.
projectPath
,
c
.
projName
,
c
.
execName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagActionName
:
c
.
classActionName
,
},
},
&
tasks
.
CreateFileFromStrTemplateTask
{
SourceStr
:
C
PFT_DAPP_TYPEFILE
,
SourceStr
:
C
pftDappTypefile
,
OutputFile
:
fmt
.
Sprintf
(
"%s/plugin/dapp/%s/types/types.go"
,
c
.
projectPath
,
c
.
projName
),
ReplaceKeyPairs
:
map
[
string
]
string
{
types
.
TagExecNameFB
:
c
.
execNameFB
,
...
...
vendor/github.com/33cn/chain33/cmd/tools/types/types.go
View file @
b2638e9d
...
...
@@ -21,7 +21,7 @@ const (
KeyUpdateInit
=
"update_init"
KeyCreatePlugin
=
"create_plugin"
D
EF_CPM_CONFIGFILE
=
"chain33.cpm.toml"
D
efCpmConfigfile
=
"chain33.cpm.toml"
TagGoPath
=
"${GOPATH}"
TagProjectName
=
"${PROJECTNAME}"
// 项目名称替换标签
...
...
vendor/github.com/33cn/chain33/doc.go
View file @
b2638e9d
...
...
@@ -11,11 +11,12 @@ chain33 是由复杂美科技有限公司开发的区块链链框架
3. 创新的 合约 调用和组合方式
*/
package
chain33
//有些包国内需要翻墙才能下载,我们把部分参见的包含在这里
import
(
_
"golang.org/x/crypto/nacl/box"
_
"golang.org/x/crypto/nacl/box"
//register box package
_
"golang.org/x/crypto/nacl/secretbox"
_
"golang.org/x/crypto/ssh"
)
vendor/github.com/33cn/chain33/golinter.sh
View file @
b2638e9d
...
...
@@ -16,6 +16,7 @@ function filterLinter() {
--enable
=
structcheck
\
--enable
=
goimports
\
--enable
=
misspell
\
--enable
=
golint
\
--vendor
./...
)
# --enable=staticcheck \
# --enable=gocyclo \
...
...
vendor/github.com/33cn/chain33/mempool/mempool.go
View file @
b2638e9d
...
...
@@ -600,7 +600,7 @@ func (mem *Mempool) SetQueueClient(client queue.Client) {
defer
mlog
.
Info
(
"mempool message recv quit"
)
defer
mem
.
wg
.
Done
()
for
msg
:=
range
mem
.
client
.
Recv
()
{
mlog
.
Debug
(
"mempool recv"
,
"msgid"
,
msg
.
I
d
,
"msg"
,
types
.
GetEventName
(
int
(
msg
.
Ty
)))
mlog
.
Debug
(
"mempool recv"
,
"msgid"
,
msg
.
I
D
,
"msg"
,
types
.
GetEventName
(
int
(
msg
.
Ty
)))
beg
:=
types
.
Now
()
switch
msg
.
Ty
{
case
types
.
EventTx
:
...
...
vendor/github.com/33cn/chain33/mempool/pipeline_test.go
View file @
b2638e9d
...
...
@@ -16,31 +16,31 @@ import (
func
TestStep
(
t
*
testing
.
T
)
{
done
:=
make
(
chan
struct
{})
in
:=
make
(
chan
queue
.
Message
)
msg
:=
queue
.
Message
{
I
d
:
0
}
msg
:=
queue
.
Message
{
I
D
:
0
}
cb
:=
func
(
in
queue
.
Message
)
queue
.
Message
{
in
.
I
d
++
in
.
I
D
++
time
.
Sleep
(
time
.
Microsecond
)
return
in
}
out
:=
step
(
done
,
in
,
cb
)
in
<-
msg
msg2
:=
<-
out
assert
.
Equal
(
t
,
msg2
.
I
d
,
int64
(
1
))
assert
.
Equal
(
t
,
msg2
.
I
D
,
int64
(
1
))
close
(
done
)
}
func
TestMutiStep
(
t
*
testing
.
T
)
{
done
:=
make
(
chan
struct
{})
in
:=
make
(
chan
queue
.
Message
)
msg
:=
queue
.
Message
{
I
d
:
0
}
msg
:=
queue
.
Message
{
I
D
:
0
}
step1
:=
func
(
in
queue
.
Message
)
queue
.
Message
{
in
.
I
d
++
in
.
I
D
++
time
.
Sleep
(
time
.
Microsecond
)
return
in
}
out1
:=
step
(
done
,
in
,
step1
)
step2
:=
func
(
in
queue
.
Message
)
queue
.
Message
{
in
.
I
d
++
in
.
I
D
++
time
.
Sleep
(
time
.
Microsecond
)
return
in
}
...
...
@@ -50,16 +50,16 @@ func TestMutiStep(t *testing.T) {
out3
:=
mergeList
(
done
,
out21
,
out22
)
in
<-
msg
msg2
:=
<-
out3
assert
.
Equal
(
t
,
msg2
.
I
d
,
int64
(
2
))
assert
.
Equal
(
t
,
msg2
.
I
D
,
int64
(
2
))
close
(
done
)
}
func
BenchmarkStep
(
b
*
testing
.
B
)
{
done
:=
make
(
chan
struct
{})
in
:=
make
(
chan
queue
.
Message
)
msg
:=
queue
.
Message
{
I
d
:
0
}
msg
:=
queue
.
Message
{
I
D
:
0
}
cb
:=
func
(
in
queue
.
Message
)
queue
.
Message
{
in
.
I
d
++
in
.
I
D
++
time
.
Sleep
(
100
*
time
.
Microsecond
)
return
in
}
...
...
@@ -71,7 +71,7 @@ func BenchmarkStep(b *testing.B) {
}()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
msg2
:=
<-
out
assert
.
Equal
(
b
,
msg2
.
I
d
,
int64
(
1
))
assert
.
Equal
(
b
,
msg2
.
I
D
,
int64
(
1
))
}
close
(
done
)
}
...
...
@@ -79,9 +79,9 @@ func BenchmarkStep(b *testing.B) {
func
BenchmarkStepMerge
(
b
*
testing
.
B
)
{
done
:=
make
(
chan
struct
{})
in
:=
make
(
chan
queue
.
Message
)
msg
:=
queue
.
Message
{
I
d
:
0
}
msg
:=
queue
.
Message
{
I
D
:
0
}
cb
:=
func
(
in
queue
.
Message
)
queue
.
Message
{
in
.
I
d
++
in
.
I
D
++
time
.
Sleep
(
100
*
time
.
Microsecond
)
return
in
}
...
...
@@ -97,7 +97,7 @@ func BenchmarkStepMerge(b *testing.B) {
}()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
msg2
:=
<-
out
assert
.
Equal
(
b
,
msg2
.
I
d
,
int64
(
1
))
assert
.
Equal
(
b
,
msg2
.
I
D
,
int64
(
1
))
}
close
(
done
)
}
vendor/github.com/33cn/chain33/p2p/listener.go
View file @
b2638e9d
...
...
@@ -39,7 +39,7 @@ func (l *listener) Close() {
type
listener
struct
{
server
*
grpc
.
Server
nodeInfo
*
NodeInfo
p2pserver
*
P2p
S
erver
p2pserver
*
P2p
s
erver
node
*
Node
netlistener
net
.
Listener
}
...
...
vendor/github.com/33cn/chain33/p2p/netaddress.go
View file @
b2638e9d
...
...
@@ -219,32 +219,33 @@ func (na *NetAddress) ReachabilityTo(o *NetAddress) int {
return
Teredo
}
else
if
o
.
IP
.
To4
()
!=
nil
{
return
Ipv4
}
else
{
// ipv6
return
Ipv6Weak
}
// ipv6
return
Ipv6Weak
}
else
if
na
.
IP
.
To4
()
!=
nil
{
if
o
.
Routable
()
&&
o
.
IP
.
To4
()
!=
nil
{
return
Ipv4
}
return
Default
}
else
/* ipv6 */
{
var
tunnelled
bool
// Is our v6 is tunnelled?
if
o
.
RFC3964
()
||
o
.
RFC6052
()
||
o
.
RFC6145
()
{
tunnelled
=
true
}
if
!
o
.
Routable
()
{
return
Default
}
else
if
o
.
RFC4380
()
{
return
Teredo
}
else
if
o
.
IP
.
To4
()
!=
nil
{
return
Ipv4
}
else
if
tunnelled
{
// only prioritise ipv6 if we aren't tunnelling it.
return
Ipv6Weak
}
return
Ipv6Strong
}
/* ipv6 */
var
tunnelled
bool
// Is our v6 is tunnelled?
if
o
.
RFC3964
()
||
o
.
RFC6052
()
||
o
.
RFC6145
()
{
tunnelled
=
true
}
if
!
o
.
Routable
()
{
return
Default
}
else
if
o
.
RFC4380
()
{
return
Teredo
}
else
if
o
.
IP
.
To4
()
!=
nil
{
return
Ipv4
}
else
if
tunnelled
{
// only prioritise ipv6 if we aren't tunnelling it.
return
Ipv6Weak
}
return
Ipv6Strong
}
// RFC1918: IPv4 Private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12)
...
...
vendor/github.com/33cn/chain33/p2p/p2pserver.go
View file @
b2638e9d
This diff is collapsed.
Click to expand it.
vendor/github.com/33cn/chain33/queue/client.go
View file @
b2638e9d
...
...
@@ -188,7 +188,7 @@ func (client *client) isEnd(data Message, ok bool) bool {
if
atomic
.
LoadInt32
(
&
client
.
isClosed
)
==
1
{
return
true
}
if
data
.
Data
==
nil
&&
data
.
I
d
==
0
&&
data
.
Ty
==
0
{
if
data
.
Data
==
nil
&&
data
.
I
D
==
0
&&
data
.
Ty
==
0
{
return
true
}
return
false
...
...
vendor/github.com/33cn/chain33/queue/queue.go
View file @
b2638e9d
...
...
@@ -229,14 +229,14 @@ func (q *queue) Client() Client {
type
Message
struct
{
Topic
string
Ty
int64
I
d
int64
I
D
int64
Data
interface
{}
chReply
chan
Message
}
// NewMessage new message
func
NewMessage
(
id
int64
,
topic
string
,
ty
int64
,
data
interface
{})
(
msg
Message
)
{
msg
.
I
d
=
id
msg
.
I
D
=
id
msg
.
Ty
=
ty
msg
.
Data
=
data
msg
.
Topic
=
topic
...
...
@@ -275,7 +275,7 @@ func (msg Message) Reply(replyMsg Message) {
// String print the message information
func
(
msg
Message
)
String
()
string
{
return
fmt
.
Sprintf
(
"{topic:%s, Ty:%s, Id:%d, Err:%v, Ch:%v}"
,
msg
.
Topic
,
types
.
GetEventName
(
int
(
msg
.
Ty
)),
msg
.
I
d
,
msg
.
Err
(),
msg
.
chReply
!=
nil
)
types
.
GetEventName
(
int
(
msg
.
Ty
)),
msg
.
I
D
,
msg
.
Err
(),
msg
.
chReply
!=
nil
)
}
// ReplyErr reply error
...
...
vendor/github.com/33cn/chain33/system/crypto/sm2/sm2.go
View file @
b2638e9d
...
...
@@ -20,8 +20,8 @@ import (
//const
const
(
SM2
_RPIVATEKEY_LENGTH
=
32
SM2
_PUBLICKEY_LENGTH
=
65
SM2
PrivateKeyLength
=
32
SM2
PublicKeyLength
=
65
)
//Driver 驱动
...
...
@@ -29,8 +29,8 @@ type Driver struct{}
//GenKey 生成私钥
func
(
d
Driver
)
GenKey
()
(
crypto
.
PrivKey
,
error
)
{
privKeyBytes
:=
[
SM2
_RPIVATEKEY_LENGTH
]
byte
{}
copy
(
privKeyBytes
[
:
],
crypto
.
CRandBytes
(
SM2
_RPIVATEKEY_LENGTH
))
privKeyBytes
:=
[
SM2
PrivateKeyLength
]
byte
{}
copy
(
privKeyBytes
[
:
],
crypto
.
CRandBytes
(
SM2
PrivateKeyLength
))
priv
,
_
:=
privKeyFromBytes
(
sm2
.
P256Sm2
(),
privKeyBytes
[
:
])
copy
(
privKeyBytes
[
:
],
SerializePrivateKey
(
priv
))
return
PrivKeySM2
(
privKeyBytes
),
nil
...
...
@@ -38,11 +38,11 @@ func (d Driver) GenKey() (crypto.PrivKey, error) {
//PrivKeyFromBytes 字节转为私钥
func
(
d
Driver
)
PrivKeyFromBytes
(
b
[]
byte
)
(
privKey
crypto
.
PrivKey
,
err
error
)
{
if
len
(
b
)
!=
SM2
_RPIVATEKEY_LENGTH
{
if
len
(
b
)
!=
SM2
PrivateKeyLength
{
return
nil
,
errors
.
New
(
"invalid priv key byte"
)
}
privKeyBytes
:=
new
([
SM2
_RPIVATEKEY_LENGTH
]
byte
)
copy
(
privKeyBytes
[
:
],
b
[
:
SM2
_RPIVATEKEY_LENGTH
])
privKeyBytes
:=
new
([
SM2
PrivateKeyLength
]
byte
)
copy
(
privKeyBytes
[
:
],
b
[
:
SM2
PrivateKeyLength
])
priv
,
_
:=
privKeyFromBytes
(
sm2
.
P256Sm2
(),
privKeyBytes
[
:
])
...
...
@@ -52,10 +52,10 @@ func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error) {
//PubKeyFromBytes 字节转为公钥
func
(
d
Driver
)
PubKeyFromBytes
(
b
[]
byte
)
(
pubKey
crypto
.
PubKey
,
err
error
)
{
if
len
(
b
)
!=
SM2
_PUBLICKEY_LENGTH
{
if
len
(
b
)
!=
SM2
PublicKeyLength
{
return
nil
,
errors
.
New
(
"invalid pub key byte"
)
}
pubKeyBytes
:=
new
([
SM2
_PUBLICKEY_LENGTH
]
byte
)
pubKeyBytes
:=
new
([
SM2
PublicKeyLength
]
byte
)
copy
(
pubKeyBytes
[
:
],
b
[
:
])
return
PubKeySM2
(
*
pubKeyBytes
),
nil
}
...
...
@@ -76,11 +76,11 @@ func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error) {
}
//PrivKeySM2 私钥
type
PrivKeySM2
[
SM2
_RPIVATEKEY_LENGTH
]
byte
type
PrivKeySM2
[
SM2
PrivateKeyLength
]
byte
//Bytes 字节格式
func
(
privKey
PrivKeySM2
)
Bytes
()
[]
byte
{
s
:=
make
([]
byte
,
SM2
_RPIVATEKEY_LENGTH
)
s
:=
make
([]
byte
,
SM2
PrivateKeyLength
)
copy
(
s
,
privKey
[
:
])
return
s
}
...
...
@@ -120,11 +120,11 @@ func (privKey PrivKeySM2) String() string {
}
//PubKeySM2 公钥
type
PubKeySM2
[
SM2
_PUBLICKEY_LENGTH
]
byte
type
PubKeySM2
[
SM2
PublicKeyLength
]
byte
//Bytes 字节格式
func
(
pubKey
PubKeySM2
)
Bytes
()
[]
byte
{
s
:=
make
([]
byte
,
SM2
_PUBLICKEY_LENGTH
)
s
:=
make
([]
byte
,
SM2
PublicKeyLength
)
copy
(
s
,
pubKey
[
:
])
return
s
}
...
...
vendor/github.com/33cn/chain33/system/crypto/sm2/utils.go
View file @
b2638e9d
...
...
@@ -103,7 +103,7 @@ func parsePubKey(pubKeyStr []byte, curve elliptic.Curve) (key *sm2.PublicKey, er
//SerializePublicKey 公钥序列化
func
SerializePublicKey
(
p
*
sm2
.
PublicKey
)
[]
byte
{
b
:=
make
([]
byte
,
0
,
SM2
_PUBLICKEY_LENGTH
)
b
:=
make
([]
byte
,
0
,
SM2
PublicKeyLength
)
b
=
append
(
b
,
0x4
)
b
=
paddedAppend
(
32
,
b
,
p
.
X
.
Bytes
())
return
paddedAppend
(
32
,
b
,
p
.
Y
.
Bytes
())
...
...
@@ -111,8 +111,8 @@ func SerializePublicKey(p *sm2.PublicKey) []byte {
//SerializePrivateKey 私钥序列化
func
SerializePrivateKey
(
p
*
sm2
.
PrivateKey
)
[]
byte
{
b
:=
make
([]
byte
,
0
,
SM2
_RPIVATEKEY_LENGTH
)
return
paddedAppend
(
SM2
_RPIVATEKEY_LENGTH
,
b
,
p
.
D
.
Bytes
())
b
:=
make
([]
byte
,
0
,
SM2
PrivateKeyLength
)
return
paddedAppend
(
SM2
PrivateKeyLength
,
b
,
p
.
D
.
Bytes
())
}
func
paddedAppend
(
size
uint
,
dst
,
src
[]
byte
)
[]
byte
{
...
...
vendor/github.com/33cn/chain33/system/init.go
View file @
b2638e9d
...
...
@@ -6,7 +6,7 @@
package
system
import
(
_
"github.com/33cn/chain33/system/consensus/init"
_
"github.com/33cn/chain33/system/consensus/init"
//register consensus init package
_
"github.com/33cn/chain33/system/crypto/init"
_
"github.com/33cn/chain33/system/dapp/init"
_
"github.com/33cn/chain33/system/store/init"
...
...
vendor/github.com/33cn/chain33/system/store/base.go
View file @
b2638e9d
...
...
@@ -172,23 +172,27 @@ func (store *BaseStore) GetQueueClient() queue.Client {
return
store
.
qclient
}
func
NewStoreListQuery
(
store
SubStore
,
req
*
types
.
StoreList
)
*
StoreListQuery
{
// NewStoreListQuery new store list query object
func
NewStoreListQuery
(
store
SubStore
,
req
*
types
.
StoreList
)
*
StorelistQuery
{
reply
:=
&
types
.
StoreListReply
{
Start
:
req
.
Start
,
End
:
req
.
End
,
Suffix
:
req
.
Suffix
,
Count
:
req
.
Count
,
Mode
:
req
.
Mode
}
return
&
Store
L
istQuery
{
StoreListReply
:
reply
,
req
:
req
,
store
:
store
}
return
&
Store
l
istQuery
{
StoreListReply
:
reply
,
req
:
req
,
store
:
store
}
}
type
StoreListQuery
struct
{
// StorelistQuery defines a type store list query
type
StorelistQuery
struct
{
store
SubStore
req
*
types
.
StoreList
*
types
.
StoreListReply
}
func
(
t
*
StoreListQuery
)
Run
()
*
types
.
StoreListReply
{
// Run store list query
func
(
t
*
StorelistQuery
)
Run
()
*
types
.
StoreListReply
{
t
.
store
.
IterateRangeByStateHash
(
t
.
req
.
StateHash
,
t
.
req
.
Start
,
t
.
req
.
End
,
true
,
t
.
IterateCallBack
)
return
t
.
StoreListReply
}
func
(
t
*
StoreListQuery
)
IterateCallBack
(
key
,
value
[]
byte
)
bool
{
// IterateCallBack store list query iterate callback
func
(
t
*
StorelistQuery
)
IterateCallBack
(
key
,
value
[]
byte
)
bool
{
if
t
.
Mode
==
1
{
//[start, end)模式
if
t
.
Num
>=
t
.
Count
{
t
.
NextKey
=
key
...
...
@@ -198,7 +202,8 @@ func (t *StoreListQuery) IterateCallBack(key, value []byte) bool {
t
.
Keys
=
append
(
t
.
Keys
,
cloneByte
(
key
))
t
.
Values
=
append
(
t
.
Values
,
cloneByte
(
value
))
return
false
}
else
if
t
.
Mode
==
2
{
//prefix + suffix模式,要对按prefix得到的数据key进行suffix的判断,符合条件的数据才是最终要的数据
}
if
t
.
Mode
==
2
{
//prefix + suffix模式,要对按prefix得到的数据key进行suffix的判断,符合条件的数据才是最终要的数据
if
len
(
key
)
>
len
(
t
.
Suffix
)
{
if
string
(
key
[
len
(
key
)
-
len
(
t
.
Suffix
)
:
])
==
string
(
t
.
Suffix
)
{
t
.
Num
++
...
...
@@ -209,16 +214,16 @@ func (t *StoreListQuery) IterateCallBack(key, value []byte) bool {
return
true
}
return
false
}
else
{
return
false
}
}
else
{
return
false
}
}
else
{
slog
.
Error
(
"StoreListReply.IterateCallBack unsupported mode"
,
"mode"
,
t
.
Mode
)
return
true
return
false
}
slog
.
Error
(
"StoreListReply.IterateCallBack unsupported mode"
,
"mode"
,
t
.
Mode
)
return
true
}
func
cloneByte
(
v
[]
byte
)
[]
byte
{
...
...
vendor/github.com/33cn/chain33/system/store/mavl/db/prune.go
View file @
b2638e9d
...
...
@@ -658,6 +658,7 @@ func deleteOldNode(db dbm.DB, mp map[string][]hashData, curHeight int64, lastKey
pruningHashNode
(
db
,
delMp
)
}
// PruningTreePrintDB pruning tree print db
func
PruningTreePrintDB
(
db
dbm
.
DB
,
prefix
[]
byte
)
{
it
:=
db
.
Iterator
(
prefix
,
nil
,
true
)
defer
it
.
Close
()
...
...
vendor/github.com/33cn/chain33/system/store/mavl/mavl_test.go
View file @
b2638e9d
...
...
@@ -214,7 +214,7 @@ func genPrefixEdge(prefix []byte) (r []byte) {
i
:=
len
(
prefix
)
-
1
for
i
>=
0
{
if
r
[
i
]
<
0xff
{
r
[
i
]
+=
1
r
[
i
]
++
break
}
else
{
i
--
...
...
@@ -294,7 +294,7 @@ func TestIterateCallBack_Mode1(t *testing.T) {
resp1
.
Count
=
5
resp1
.
Mode
=
1
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp1
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp1
}
store
.
IterateRangeByStateHash
(
hash1
,
resp1
.
Start
,
resp1
.
End
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp1
.
Values
)
...
...
@@ -314,7 +314,7 @@ func TestIterateCallBack_Mode1(t *testing.T) {
resp0
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp0
.
Count
=
5
resp0
.
Mode
=
1
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp0
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp0
}
store
.
IterateRangeByStateHash
(
hash0
,
resp0
.
Start
,
resp0
.
End
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp0
.
Values
)
...
...
@@ -334,7 +334,7 @@ func TestIterateCallBack_Mode1(t *testing.T) {
resp
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp
.
Count
=
1
resp
.
Mode
=
1
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp
}
store
.
IterateRangeByStateHash
(
hash2
,
resp
.
Start
,
resp
.
End
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp
.
Values
)
...
...
@@ -354,7 +354,7 @@ func TestIterateCallBack_Mode1(t *testing.T) {
resp
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp
.
Count
=
2
resp
.
Mode
=
1
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp
}
store
.
IterateRangeByStateHash
(
hash2
,
resp
.
Start
,
resp
.
End
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp
.
Values
)
...
...
@@ -422,7 +422,7 @@ func TestIterateCallBack_Mode2(t *testing.T) {
resp2
.
Count
=
5
resp2
.
Mode
=
2
query
:=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp2
}
query
:=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp2
}
store
.
IterateRangeByStateHash
(
hash2
,
resp2
.
Start
,
nil
,
true
,
query
.
IterateCallBack
)
tool
:=
&
StatTool
{}
tool
.
AddItem
(
resp2
.
Values
)
...
...
@@ -442,7 +442,7 @@ func TestIterateCallBack_Mode2(t *testing.T) {
resp1
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp1
.
Count
=
5
resp1
.
Mode
=
2
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp1
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp1
}
store
.
IterateRangeByStateHash
(
hash1
,
resp1
.
Start
,
resp1
.
End
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp1
.
Values
)
...
...
@@ -462,7 +462,7 @@ func TestIterateCallBack_Mode2(t *testing.T) {
resp0
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp0
.
Count
=
5
resp0
.
Mode
=
2
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp0
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp0
}
store
.
IterateRangeByStateHash
(
hash0
,
resp0
.
Start
,
nil
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp0
.
Values
)
...
...
@@ -482,7 +482,7 @@ func TestIterateCallBack_Mode2(t *testing.T) {
resp
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp
.
Count
=
1
resp
.
Mode
=
2
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp
}
store
.
IterateRangeByStateHash
(
hash2
,
resp
.
Start
,
nil
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp
.
Values
)
...
...
@@ -502,7 +502,7 @@ func TestIterateCallBack_Mode2(t *testing.T) {
resp
.
End
=
genPrefixEdge
([]
byte
(
prefix
))
resp
.
Count
=
2
resp
.
Mode
=
2
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp
}
store
.
IterateRangeByStateHash
(
hash2
,
resp
.
Start
,
nil
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp
.
Values
)
...
...
@@ -522,7 +522,7 @@ func TestIterateCallBack_Mode2(t *testing.T) {
resp
.
End
=
genPrefixEdge
([]
byte
(
"mavl-coins-bty-exec-26htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:"
))
resp
.
Count
=
1
resp
.
Mode
=
2
query
=
&
drivers
.
Store
L
istQuery
{
StoreListReply
:
resp
}
query
=
&
drivers
.
Store
l
istQuery
{
StoreListReply
:
resp
}
store
.
IterateRangeByStateHash
(
hash2
,
resp
.
Start
,
resp
.
End
,
true
,
query
.
IterateCallBack
)
tool
.
AddItem
(
resp
.
Values
)
assert
.
Equal
(
t
,
int64
(
1
),
resp
.
Num
)
...
...
vendor/github.com/33cn/chain33/types/config.go
View file @
b2638e9d
...
...
@@ -33,7 +33,7 @@ var (
// coin conversation
const
(
Coin
int64
=
1e8
MaxCoin
int64
=
9e18
MaxCoin
int64
=
1e17
MaxTxSize
=
100000
//100K
MaxTxGroupSize
int32
=
20
MaxBlockSize
=
20000000
//20M
...
...
vendor/github.com/33cn/chain33/types/jsonpb/jsonpb.go
View file @
b2638e9d
...
...
@@ -107,25 +107,25 @@ func defaultResolveAny(typeURL string) (proto.Message, error) {
return
reflect
.
New
(
mt
.
Elem
())
.
Interface
()
.
(
proto
.
Message
),
nil
}
// JSONPB
M
arshaler is implemented by protobuf messages that customize the
// JSONPB
m
arshaler is implemented by protobuf messages that customize the
// way they are marshaled to JSON. Messages that implement this should
// also implement JSONPBUnmarshaler so that the custom format can be
// parsed.
//
// The JSON marshaling must follow the proto to JSON specification:
// https://developers.google.com/protocol-buffers/docs/proto3#json
type
JSONPB
M
arshaler
interface
{
type
JSONPB
m
arshaler
interface
{
MarshalJSONPB
(
*
Marshaler
)
([]
byte
,
error
)
}
// JSONPB
U
nmarshaler is implemented by protobuf messages that customize
// JSONPB
u
nmarshaler is implemented by protobuf messages that customize
// the way they are unmarshaled from JSON. Messages that implement this
// should also implement JSONPBMarshaler so that the custom format can be
// produced.
//
// The JSON unmarshaling must follow the JSON to proto specification:
// https://developers.google.com/protocol-buffers/docs/proto3#json
type
JSONPB
U
nmarshaler
interface
{
type
JSONPB
u
nmarshaler
interface
{
UnmarshalJSONPB
(
*
Unmarshaler
,
[]
byte
)
error
}
...
...
@@ -171,7 +171,7 @@ type wkt interface {
// marshalObject writes a struct to the Writer.
func
(
m
*
Marshaler
)
marshalObject
(
out
*
errWriter
,
v
proto
.
Message
,
indent
,
typeURL
string
)
error
{
if
jsm
,
ok
:=
v
.
(
JSONPB
M
arshaler
);
ok
{
if
jsm
,
ok
:=
v
.
(
JSONPB
m
arshaler
);
ok
{
b
,
err
:=
jsm
.
MarshalJSONPB
(
m
)
if
err
!=
nil
{
return
err
...
...
@@ -727,7 +727,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
if
targetType
.
Kind
()
==
reflect
.
Ptr
{
// If input value is "null" and target is a pointer type, then the field should be treated as not set
// UNLESS the target is structpb.Value, in which case it should be set to structpb.NullValue.
_
,
isJSONPBUnmarshaler
:=
target
.
Interface
()
.
(
JSONPB
U
nmarshaler
)
_
,
isJSONPBUnmarshaler
:=
target
.
Interface
()
.
(
JSONPB
u
nmarshaler
)
if
string
(
inputValue
)
==
"null"
&&
targetType
!=
reflect
.
TypeOf
(
&
stpb
.
Value
{})
&&
!
isJSONPBUnmarshaler
{
return
nil
}
...
...
@@ -736,7 +736,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
return
u
.
unmarshalValue
(
target
.
Elem
(),
inputValue
,
prop
)
}
if
jsu
,
ok
:=
target
.
Addr
()
.
Interface
()
.
(
JSONPB
U
nmarshaler
);
ok
{
if
jsu
,
ok
:=
target
.
Addr
()
.
Interface
()
.
(
JSONPB
u
nmarshaler
);
ok
{
return
jsu
.
UnmarshalJSONPB
(
u
,
[]
byte
(
inputValue
))
}
...
...
vendor/github.com/33cn/chain33/util/cli/chain33.go
View file @
b2638e9d
...
...
@@ -9,6 +9,7 @@
//消息队列本身可插拔,可以支持各种队列
//同时共识模式也是可以插拔的。
//rpc 服务也是可以插拔的
package
cli
import
(
...
...
vendor/github.com/33cn/chain33/util/testnode/testnode.go
View file @
b2638e9d
...
...
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// package testnode 提供一个通用的测试节点,用于单元测试和集成测试。
package
testnode
import
(
...
...
vendor/github.com/33cn/chain33/wallet/bipwallet/bipwallet.go
View file @
b2638e9d
...
...
@@ -12,7 +12,7 @@ import (
bip39
"github.com/33cn/chain33/wallet/bipwallet/go-bip39"
bip44
"github.com/33cn/chain33/wallet/bipwallet/go-bip44"
"github.com/33cn/chain33/wallet/bipwallet/transformer"
_
"github.com/33cn/chain33/wallet/bipwallet/transformer/btcbase"
_
"github.com/33cn/chain33/wallet/bipwallet/transformer/btcbase"
//register btcbase package
)
// https://github.com/satoshilabs/slips/blob/master/slip-0044.md
...
...
vendor/github.com/33cn/chain33/wallet/seed.go
View file @
b2638e9d
...
...
@@ -156,7 +156,9 @@ func GetPrivkeyBySeed(db dbm.DB, seed string) (string, error) {
}
index
=
backupindex
+
1
}
if
SignType
!=
1
&&
SignType
!=
2
{
return
""
,
types
.
ErrNotSupport
}
//secp256k1
if
SignType
==
1
{
...
...
@@ -204,10 +206,6 @@ func GetPrivkeyBySeed(db dbm.DB, seed string) (string, error) {
//seedlog.Error("GetPrivkeyBySeed", "index", index, "secretKey", secretKey, "publicKey", publicKey)
Hexsubprivkey
=
secretKey
}
else
if
SignType
==
3
{
//sm2
return
""
,
types
.
ErrNotSupport
}
else
{
return
""
,
types
.
ErrNotSupport
}
// back up index in db
var
pubkeyindex
[]
byte
...
...
vendor/github.com/33cn/chain33/wallet/wallet_msg.go
View file @
b2638e9d
...
...
@@ -14,7 +14,7 @@ import (
func
(
wallet
*
Wallet
)
ProcRecvMsg
()
{
defer
wallet
.
wg
.
Done
()
for
msg
:=
range
wallet
.
client
.
Recv
()
{
walletlog
.
Debug
(
"wallet recv"
,
"msg"
,
types
.
GetEventName
(
int
(
msg
.
Ty
)),
"Id"
,
msg
.
I
d
)
walletlog
.
Debug
(
"wallet recv"
,
"msg"
,
types
.
GetEventName
(
int
(
msg
.
Ty
)),
"Id"
,
msg
.
I
D
)
beg
:=
types
.
Now
()
reply
,
err
:=
wallet
.
ExecWallet
(
&
msg
)
if
err
!=
nil
{
...
...
@@ -23,7 +23,7 @@ func (wallet *Wallet) ProcRecvMsg() {
}
else
{
msg
.
Reply
(
wallet
.
api
.
NewMessage
(
""
,
0
,
reply
))
}
walletlog
.
Debug
(
"end process"
,
"msg.id"
,
msg
.
I
d
,
"cost"
,
types
.
Since
(
beg
))
walletlog
.
Debug
(
"end process"
,
"msg.id"
,
msg
.
I
D
,
"cost"
,
types
.
Since
(
beg
))
}
}
...
...
vendor/github.com/33cn/chain33/wallet/wallet_proc.go
View file @
b2638e9d
...
...
@@ -458,10 +458,10 @@ func (wallet *Wallet) ProcImportPrivKey(PrivKey *types.ReqWalletImportPrivkey) (
if
Account
.
Privkey
==
Encrypteredstr
{
walletlog
.
Error
(
"ProcImportPrivKey Privkey is exist in wallet!"
)
return
nil
,
types
.
ErrPrivkeyExist
}
else
{
walletlog
.
Error
(
"ProcImportPrivKey!"
,
"Account.Privkey"
,
Account
.
Privkey
,
"input Privkey"
,
PrivKey
.
Privkey
)
return
nil
,
types
.
ErrPrivkey
}
walletlog
.
Error
(
"ProcImportPrivKey!"
,
"Account.Privkey"
,
Account
.
Privkey
,
"input Privkey"
,
PrivKey
.
Privkey
)
return
nil
,
types
.
ErrPrivkey
}
var
walletaccount
types
.
WalletAccount
...
...
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