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
1c51e32d
Commit
1c51e32d
authored
May 23, 2019
by
kingwang
Committed by
33cn
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 05/23
parent
df09995f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
38 additions
and
72 deletions
+38
-72
mock_blockchain_test.go
...or/github.com/33cn/chain33/client/mock_blockchain_test.go
+2
-6
http.go
vendor/github.com/33cn/chain33/rpc/http.go
+5
-7
coins.go
vendor/github.com/33cn/chain33/system/dapp/commands/coins.go
+1
-1
stat.go
vendor/github.com/33cn/chain33/system/dapp/commands/stat.go
+0
-0
types.go
...thub.com/33cn/chain33/system/dapp/commands/types/types.go
+0
-20
register.go
vendor/github.com/33cn/chain33/system/dapp/register.go
+14
-6
fork.go
vendor/github.com/33cn/chain33/types/fork.go
+2
-0
statistic.proto
vendor/github.com/33cn/chain33/types/proto/statistic.proto
+0
-27
statistic.pb.go
vendor/github.com/33cn/chain33/types/statistic.pb.go
+0
-0
guodun.toml
vendor/github.com/33cn/chain33/types/testdata/guodun.toml
+1
-0
local.mvertest.toml
...ithub.com/33cn/chain33/types/testdata/local.mvertest.toml
+1
-0
tx.go
vendor/github.com/33cn/chain33/types/tx.go
+12
-5
No files found.
vendor/github.com/33cn/chain33/client/mock_blockchain_test.go
View file @
1c51e32d
...
@@ -129,12 +129,8 @@ func (m *mockBlockChain) SetQueueClient(q queue.Queue) {
...
@@ -129,12 +129,8 @@ func (m *mockBlockChain) SetQueueClient(q queue.Queue) {
msg
.
ReplyErr
(
"Do not support"
,
types
.
ErrInvalidParam
)
msg
.
ReplyErr
(
"Do not support"
,
types
.
ErrInvalidParam
)
}
}
case
types
.
EventLocalList
:
case
types
.
EventLocalList
:
if
req
,
ok
:=
msg
.
GetData
()
.
(
*
types
.
LocalDBList
);
ok
{
if
_
,
ok
:=
msg
.
GetData
()
.
(
*
types
.
LocalDBList
);
ok
{
if
len
(
req
.
Key
)
>
0
&&
bytes
.
Equal
(
req
.
Key
,
[]
byte
(
"Statistics:TicketInfoOrder:Addr:case1"
))
{
msg
.
Reply
(
client
.
NewMessage
(
blockchainKey
,
types
.
EventReplyQuery
,
&
types
.
LocalReplyValue
{}))
msg
.
Reply
(
client
.
NewMessage
(
blockchainKey
,
types
.
EventReplyQuery
,
&
types
.
TicketMinerInfo
{}))
}
else
{
msg
.
Reply
(
client
.
NewMessage
(
blockchainKey
,
types
.
EventReplyQuery
,
&
types
.
LocalReplyValue
{}))
}
}
else
{
}
else
{
msg
.
ReplyErr
(
"Do not support"
,
types
.
ErrInvalidParam
)
msg
.
ReplyErr
(
"Do not support"
,
types
.
ErrInvalidParam
)
}
}
...
...
vendor/github.com/33cn/chain33/rpc/http.go
View file @
1c51e32d
...
@@ -76,17 +76,15 @@ func (j *JSONRPCServer) Listen() (int, error) {
...
@@ -76,17 +76,15 @@ func (j *JSONRPCServer) Listen() (int, error) {
}
}
//格式做一个检查
//格式做一个检查
client
,
err
:=
parseJSONRpcParams
(
data
)
client
,
err
:=
parseJSONRpcParams
(
data
)
errstr
:=
"nil"
if
err
!=
nil
{
if
err
!=
nil
{
errstr
=
err
.
Error
()
err
=
fmt
.
Errorf
(
`invalid json request err:%s`
,
err
.
Error
())
log
.
Debug
(
"JSONRPCServer"
,
"request"
,
string
(
data
),
"parseErr"
,
err
)
writeError
(
w
,
r
,
0
,
err
.
Error
())
return
}
}
funcName
:=
strings
.
Split
(
client
.
Method
,
"."
)[
len
(
strings
.
Split
(
client
.
Method
,
"."
))
-
1
]
funcName
:=
strings
.
Split
(
client
.
Method
,
"."
)[
len
(
strings
.
Split
(
client
.
Method
,
"."
))
-
1
]
if
!
checkFilterPrintFuncBlacklist
(
funcName
)
{
if
!
checkFilterPrintFuncBlacklist
(
funcName
)
{
log
.
Debug
(
"JSONRPCServer"
,
"request"
,
string
(
data
),
"err"
,
errstr
)
log
.
Debug
(
"JSONRPCServer"
,
"request"
,
string
(
data
))
}
if
err
!=
nil
{
writeError
(
w
,
r
,
0
,
fmt
.
Sprintf
(
`parse request err %s`
,
err
.
Error
()))
return
}
}
//Release local request
//Release local request
ipaddr
:=
net
.
ParseIP
(
ip
)
ipaddr
:=
net
.
ParseIP
(
ip
)
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/coins.go
View file @
1c51e32d
...
@@ -215,7 +215,7 @@ func createTxGroup(cmd *cobra.Command, args []string) {
...
@@ -215,7 +215,7 @@ func createTxGroup(cmd *cobra.Command, args []string) {
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
return
}
}
err
=
group
.
Check
(
0
,
types
.
GInt
(
"MinFee"
),
types
.
GInt
(
"MaxFee"
))
err
=
group
.
Check
WithFork
(
true
,
true
,
0
,
types
.
GInt
(
"MinFee"
),
types
.
GInt
(
"MaxFee"
))
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
return
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/stat.go
View file @
1c51e32d
This diff is collapsed.
Click to expand it.
vendor/github.com/33cn/chain33/system/dapp/commands/types/types.go
View file @
1c51e32d
...
@@ -148,26 +148,6 @@ type GetTotalCoinsResult struct {
...
@@ -148,26 +148,6 @@ type GetTotalCoinsResult struct {
DifferenceAmount
string
`json:"differenceAmount,omitempty"`
DifferenceAmount
string
`json:"differenceAmount,omitempty"`
}
}
// GetTicketStatisticResult defines ticketstatistic result rpc command
type
GetTicketStatisticResult
struct
{
CurrentOpenCount
int64
`json:"currentOpenCount"`
TotalMinerCount
int64
`json:"totalMinerCount"`
TotalCloseCount
int64
`json:"totalCloseCount"`
}
// GetTicketMinerInfoResult defines ticker minerinformation result rpc command
type
GetTicketMinerInfoResult
struct
{
TicketID
string
`json:"ticketId"`
Status
string
`json:"status"`
PrevStatus
string
`json:"prevStatus"`
IsGenesis
bool
`json:"isGenesis"`
CreateTime
string
`json:"createTime"`
MinerTime
string
`json:"minerTime"`
CloseTime
string
`json:"closeTime"`
MinerValue
int64
`json:"minerValue,omitempty"`
MinerAddress
string
`json:"minerAddress,omitempty"`
}
// UTXOGlobalIndex defines utxo globalindex command
// UTXOGlobalIndex defines utxo globalindex command
type
UTXOGlobalIndex
struct
{
type
UTXOGlobalIndex
struct
{
// Height int64 `json:"height,omitempty"`
// Height int64 `json:"height,omitempty"`
...
...
vendor/github.com/33cn/chain33/system/dapp/register.go
View file @
1c51e32d
...
@@ -35,20 +35,28 @@ func Register(name string, create DriverCreate, height int64) {
...
@@ -35,20 +35,28 @@ func Register(name string, create DriverCreate, height int64) {
if
_
,
dup
:=
registedExecDriver
[
name
];
dup
{
if
_
,
dup
:=
registedExecDriver
[
name
];
dup
{
panic
(
"Execute: Register called twice for driver "
+
name
)
panic
(
"Execute: Register called twice for driver "
+
name
)
}
}
driver
With
Height
:=
&
driverWithHeight
{
driverHeight
:=
&
driverWithHeight
{
create
:
create
,
create
:
create
,
height
:
height
,
height
:
height
,
}
}
registedExecDriver
[
name
]
=
driverWithHeight
registedExecDriver
[
name
]
=
driverHeight
//考虑到前期平行链兼容性和防止误操作(平行链下转账到一个主链合约),也会注册主链合约(不带前缀)的地址
registerAddress
(
name
)
execDrivers
[
ExecAddress
(
name
)]
=
driverHeight
if
types
.
IsPara
()
{
if
types
.
IsPara
()
{
paraHeight
:=
types
.
GetFork
(
"ForkEnableParaRegExec"
)
if
paraHeight
<
height
{
paraHeight
=
height
}
//平行链的合约地址是通过user.p.x.name计算的
//平行链的合约地址是通过user.p.x.name计算的
paraDriverName
:=
types
.
ExecName
(
name
)
paraDriverName
:=
types
.
ExecName
(
name
)
registerAddress
(
paraDriverName
)
registerAddress
(
paraDriverName
)
execDrivers
[
ExecAddress
(
paraDriverName
)]
=
driverWithHeight
execDrivers
[
ExecAddress
(
paraDriverName
)]
=
&
driverWithHeight
{
create
:
create
,
height
:
paraHeight
,
}
}
}
//考虑到前期平行链兼容性和防止误操作(平行链下转账到一个主链合约),也会注册主链合约(不带前缀)的地址
registerAddress
(
name
)
execDrivers
[
ExecAddress
(
name
)]
=
driverWithHeight
}
}
// LoadDriver load driver
// LoadDriver load driver
...
...
vendor/github.com/33cn/chain33/types/fork.go
View file @
1c51e32d
...
@@ -214,6 +214,8 @@ func SetTestNetFork() {
...
@@ -214,6 +214,8 @@ func SetTestNetFork() {
systemFork
.
SetFork
(
"chain33"
,
"ForkLocalDBAccess"
,
1572391
)
systemFork
.
SetFork
(
"chain33"
,
"ForkLocalDBAccess"
,
1572391
)
systemFork
.
SetFork
(
"chain33"
,
"ForkTxGroupPara"
,
1687250
)
systemFork
.
SetFork
(
"chain33"
,
"ForkTxGroupPara"
,
1687250
)
systemFork
.
SetFork
(
"chain33"
,
"ForkBase58AddressCheck"
,
1800000
)
systemFork
.
SetFork
(
"chain33"
,
"ForkBase58AddressCheck"
,
1800000
)
//这个fork只影响平行链,注册类似user.p.x.exec的driver,新开的平行链设为0即可,老的平行链要设置新的高度
systemFork
.
SetFork
(
"chain33"
,
"ForkEnableParaRegExec"
,
0
)
}
}
...
...
vendor/github.com/33cn/chain33/types/proto/statistic.proto
View file @
1c51e32d
...
@@ -34,33 +34,6 @@ message IterateRangeByStateHash {
...
@@ -34,33 +34,6 @@ message IterateRangeByStateHash {
int64
count
=
4
;
int64
count
=
4
;
}
}
message
TicketStatistic
{
//当前在挖的ticket
int64
currentOpenCount
=
1
;
//一共挖到的ticket
int64
totalMinerCount
=
2
;
//一共取消的ticket
int64
totalCancleCount
=
3
;
}
message
TicketMinerInfo
{
string
ticketId
=
1
;
// 1 -> 可挖矿 2 -> 已挖成功 3-> 已关闭
int32
status
=
2
;
int32
prevStatus
=
3
;
// genesis 创建的私钥比较特殊
bool
isGenesis
=
4
;
//创建ticket时间
int64
createTime
=
5
;
// ticket挖矿时间
int64
minerTime
=
6
;
//关闭ticket时间
int64
closeTime
=
7
;
//挖到的币的数目
int64
minerValue
=
8
;
string
minerAddress
=
9
;
}
message
TotalAmount
{
message
TotalAmount
{
// 统计的总数
// 统计的总数
int64
total
=
1
;
int64
total
=
1
;
...
...
vendor/github.com/33cn/chain33/types/statistic.pb.go
View file @
1c51e32d
This diff is collapsed.
Click to expand it.
vendor/github.com/33cn/chain33/types/testdata/guodun.toml
View file @
1c51e32d
...
@@ -176,6 +176,7 @@ ForkMultiSignAddress=1298600
...
@@ -176,6 +176,7 @@ ForkMultiSignAddress=1298600
ForkBlockCheck
=
1725000
ForkBlockCheck
=
1725000
ForkLocalDBAccess
=
1
ForkLocalDBAccess
=
1
ForkBase58AddressCheck
=
1800000
ForkBase58AddressCheck
=
1800000
ForkEnableParaRegExec
=
0
[fork.sub.coins]
[fork.sub.coins]
Enable
=
0
Enable
=
0
...
...
vendor/github.com/33cn/chain33/types/testdata/local.mvertest.toml
View file @
1c51e32d
...
@@ -197,6 +197,7 @@ ForkMultiSignAddress=1298600
...
@@ -197,6 +197,7 @@ ForkMultiSignAddress=1298600
ForkBlockCheck
=
1
ForkBlockCheck
=
1
ForkLocalDBAccess
=
0
ForkLocalDBAccess
=
0
ForkBase58AddressCheck
=
1800000
ForkBase58AddressCheck
=
1800000
ForkEnableParaRegExec
=
0
[fork.sub.coins]
[fork.sub.coins]
Enable
=
0
Enable
=
0
...
...
vendor/github.com/33cn/chain33/types/tx.go
View file @
1c51e32d
...
@@ -11,7 +11,7 @@ import (
...
@@ -11,7 +11,7 @@ import (
"reflect"
"reflect"
"time"
"time"
"github.com/hashicorp/golang-lru"
lru
"github.com/hashicorp/golang-lru"
"strconv"
"strconv"
...
@@ -172,8 +172,8 @@ func (txgroup *Transactions) IsExpire(height, blocktime int64) bool {
...
@@ -172,8 +172,8 @@ func (txgroup *Transactions) IsExpire(height, blocktime int64) bool {
return
false
return
false
}
}
//Check
height == 0 的时候,不做检查
//Check
WithFork 和fork 无关的有个检查函数
func
(
txgroup
*
Transactions
)
Check
(
height
,
minfee
,
maxFee
int64
)
error
{
func
(
txgroup
*
Transactions
)
Check
WithFork
(
checkFork
,
paraFork
bool
,
height
,
minfee
,
maxFee
int64
)
error
{
txs
:=
txgroup
.
Txs
txs
:=
txgroup
.
Txs
if
len
(
txs
)
<
2
{
if
len
(
txs
)
<
2
{
return
ErrTxGroupCountLessThanTwo
return
ErrTxGroupCountLessThanTwo
...
@@ -193,7 +193,7 @@ func (txgroup *Transactions) Check(height, minfee, maxFee int64) error {
...
@@ -193,7 +193,7 @@ func (txgroup *Transactions) Check(height, minfee, maxFee int64) error {
}
}
//txgroup 只允许一条平行链的交易, 且平行链txgroup须全部是平行链tx
//txgroup 只允许一条平行链的交易, 且平行链txgroup须全部是平行链tx
//如果平行链已经在主链分叉高度前运行了一段时间且有跨链交易,平行链需要自己设置这个fork
//如果平行链已经在主链分叉高度前运行了一段时间且有跨链交易,平行链需要自己设置这个fork
if
IsFork
(
height
,
"ForkTxGroupPara"
)
{
if
paraFork
{
if
len
(
para
)
>
1
{
if
len
(
para
)
>
1
{
tlog
.
Info
(
"txgroup has multi para transaction"
)
tlog
.
Info
(
"txgroup has multi para transaction"
)
return
ErrTxGroupParaCount
return
ErrTxGroupParaCount
...
@@ -225,7 +225,7 @@ func (txgroup *Transactions) Check(height, minfee, maxFee int64) error {
...
@@ -225,7 +225,7 @@ func (txgroup *Transactions) Check(height, minfee, maxFee int64) error {
if
txs
[
0
]
.
Fee
<
totalfee
{
if
txs
[
0
]
.
Fee
<
totalfee
{
return
ErrTxFeeTooLow
return
ErrTxFeeTooLow
}
}
if
txs
[
0
]
.
Fee
>
maxFee
&&
maxFee
>
0
&&
IsFork
(
height
,
"ForkBlockCheck"
)
{
if
txs
[
0
]
.
Fee
>
maxFee
&&
maxFee
>
0
&&
checkFork
{
return
ErrTxFeeTooHigh
return
ErrTxFeeTooHigh
}
}
//检查hash是否符合要求
//检查hash是否符合要求
...
@@ -261,6 +261,13 @@ func (txgroup *Transactions) Check(height, minfee, maxFee int64) error {
...
@@ -261,6 +261,13 @@ func (txgroup *Transactions) Check(height, minfee, maxFee int64) error {
return
nil
return
nil
}
}
//Check height == 0 的时候,不做检查
func
(
txgroup
*
Transactions
)
Check
(
height
,
minfee
,
maxFee
int64
)
error
{
paraFork
:=
IsFork
(
height
,
"ForkTxGroupPara"
)
checkFork
:=
IsFork
(
height
,
"ForkBlockCheck"
)
return
txgroup
.
CheckWithFork
(
checkFork
,
paraFork
,
height
,
minfee
,
maxFee
)
}
//TransactionCache 交易缓存结构
//TransactionCache 交易缓存结构
type
TransactionCache
struct
{
type
TransactionCache
struct
{
*
Transaction
*
Transaction
...
...
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