Commit 394872dc authored by madengji's avatar madengji Committed by vipwzw

adjust to 40960

parent 12dccb29
...@@ -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 40960 * (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
......
...@@ -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(40960), h)
h = getNHeight(2) h = getNHeight(2)
assert.Equal(t, int64(12288), h) assert.Equal(t, int64(122880), h)
h = getNHeight(6) h = getNHeight(6)
assert.Equal(t, int64(258048), h) assert.Equal(t, int64(2580480), h)
h = getNHeight(7) h = getNHeight(7)
assert.Equal(t, int64(520192), h) assert.Equal(t, int64(5201920), 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(2621440)
assert.Equal(t, uint32(7), n) assert.Equal(t, uint32(7), n)
n = getCurrentN(262145) n = getCurrentN(2621441)
assert.Equal(t, uint32(8), n) assert.Equal(t, uint32(8), n)
n = getCurrentN(3932160) n = getCurrentN(39321600)
assert.Equal(t, uint32(10), n) assert.Equal(t, uint32(10), n)
n = getCurrentN(3932161) n = getCurrentN(39321601)
assert.Equal(t, uint32(11), n) assert.Equal(t, uint32(11), n)
} }
......
...@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment