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
394872dc
Commit
394872dc
authored
Dec 11, 2020
by
madengji
Committed by
vipwzw
Jan 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjust to 40960
parent
12dccb29
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
minerCustom.go
plugin/dapp/paracross/executor/minerCustom.go
+4
-3
minerCustom_test.go
plugin/dapp/paracross/executor/minerCustom_test.go
+10
-9
paracross.pb.go
plugin/dapp/paracross/types/paracross.pb.go
+2
-1
No files found.
plugin/dapp/paracross/executor/minerCustom.go
View file @
394872dc
...
@@ -6,11 +6,12 @@ package executor
...
@@ -6,11 +6,12 @@ package executor
import
(
import
(
"fmt"
"fmt"
"github.com/33cn/chain33/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"math"
"math"
"strconv"
"strconv"
"strings"
"strings"
"github.com/33cn/chain33/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
)
)
const
(
const
(
...
@@ -59,7 +60,7 @@ func getCustomReward(cfg *types.Chain33Config, height int64) (int64, int64, int6
...
@@ -59,7 +60,7 @@ func getCustomReward(cfg *types.Chain33Config, height int64) (int64, int64, int6
func
getNHeight
(
n
uint32
)
int64
{
func
getNHeight
(
n
uint32
)
int64
{
v
:=
1
<<
n
v
:=
1
<<
n
return
4096
*
(
int64
(
v
)
-
1
)
return
4096
0
*
(
int64
(
v
)
-
1
)
}
}
//高度 4096*(2^n -1)+1 开始减半, n=1:1~4096, n=2:4096+1~12288
//高度 4096*(2^n -1)+1 开始减半, n=1:1~4096, n=2:4096+1~12288
...
...
plugin/dapp/paracross/executor/minerCustom_test.go
View file @
394872dc
...
@@ -6,24 +6,25 @@ package executor
...
@@ -6,24 +6,25 @@ package executor
import
(
import
(
"fmt"
"fmt"
"github.com/bmizerany/assert"
"testing"
"testing"
"github.com/bmizerany/assert"
_
"github.com/33cn/plugin/plugin/crypto/bls"
_
"github.com/33cn/plugin/plugin/crypto/bls"
)
)
func
TestGetNHeight
(
t
*
testing
.
T
)
{
func
TestGetNHeight
(
t
*
testing
.
T
)
{
h
:=
getNHeight
(
1
)
h
:=
getNHeight
(
1
)
assert
.
Equal
(
t
,
int64
(
4096
),
h
)
assert
.
Equal
(
t
,
int64
(
4096
0
),
h
)
h
=
getNHeight
(
2
)
h
=
getNHeight
(
2
)
assert
.
Equal
(
t
,
int64
(
12288
),
h
)
assert
.
Equal
(
t
,
int64
(
12288
0
),
h
)
h
=
getNHeight
(
6
)
h
=
getNHeight
(
6
)
assert
.
Equal
(
t
,
int64
(
258048
),
h
)
assert
.
Equal
(
t
,
int64
(
258048
0
),
h
)
h
=
getNHeight
(
7
)
h
=
getNHeight
(
7
)
assert
.
Equal
(
t
,
int64
(
520192
),
h
)
assert
.
Equal
(
t
,
int64
(
520192
0
),
h
)
}
}
...
@@ -31,16 +32,16 @@ func TestGetN(t *testing.T) {
...
@@ -31,16 +32,16 @@ func TestGetN(t *testing.T) {
n
:=
getCurrentN
(
1
)
n
:=
getCurrentN
(
1
)
assert
.
Equal
(
t
,
uint32
(
7
),
n
)
assert
.
Equal
(
t
,
uint32
(
7
),
n
)
n
=
getCurrentN
(
262144
)
n
=
getCurrentN
(
262144
0
)
assert
.
Equal
(
t
,
uint32
(
7
),
n
)
assert
.
Equal
(
t
,
uint32
(
7
),
n
)
n
=
getCurrentN
(
26214
5
)
n
=
getCurrentN
(
26214
41
)
assert
.
Equal
(
t
,
uint32
(
8
),
n
)
assert
.
Equal
(
t
,
uint32
(
8
),
n
)
n
=
getCurrentN
(
3932160
)
n
=
getCurrentN
(
3932160
0
)
assert
.
Equal
(
t
,
uint32
(
10
),
n
)
assert
.
Equal
(
t
,
uint32
(
10
),
n
)
n
=
getCurrentN
(
3932161
)
n
=
getCurrentN
(
393216
0
1
)
assert
.
Equal
(
t
,
uint32
(
11
),
n
)
assert
.
Equal
(
t
,
uint32
(
11
),
n
)
}
}
...
...
plugin/dapp/paracross/types/paracross.pb.go
View file @
394872dc
...
@@ -6,12 +6,13 @@ package types
...
@@ -6,12 +6,13 @@ package types
import
(
import
(
context
"context"
context
"context"
fmt
"fmt"
fmt
"fmt"
math
"math"
types
"github.com/33cn/chain33/types"
types
"github.com/33cn/chain33/types"
proto
"github.com/golang/protobuf/proto"
proto
"github.com/golang/protobuf/proto"
grpc
"google.golang.org/grpc"
grpc
"google.golang.org/grpc"
codes
"google.golang.org/grpc/codes"
codes
"google.golang.org/grpc/codes"
status
"google.golang.org/grpc/status"
status
"google.golang.org/grpc/status"
math
"math"
)
)
// Reference imports to suppress errors if they are not otherwise used.
// Reference imports to suppress errors if they are not otherwise used.
...
...
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