Commit 5a0b57b3 authored by 张振华's avatar 张振华

update

parents a70c378e d19a436b
......@@ -10,13 +10,14 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/33cn/chain33/types"
"reflect"
"runtime/debug"
"sync"
"sync/atomic"
"time"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/common/crypto"
dpostype "github.com/33cn/plugin/plugin/consensus/dpos/types"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
......@@ -33,7 +34,7 @@ const (
voteFail = 2
//VrfQueryTypeM vrf query type 为查询M信息
VrfQueryTypeM = 0
VrfQueryTypeM = 0
//VrfQueryTypeRP vrf query type 为查询RP信息
VrfQueryTypeRP = 1
......
......@@ -8,11 +8,12 @@ import (
"bytes"
"encoding/hex"
"fmt"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/util"
"strings"
"time"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/util"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/common/merkle"
......@@ -49,11 +50,11 @@ var (
dposPeriod = dposBlockInterval * dposContinueBlockNum
zeroHash [32]byte
dposPort = "36656"
shuffleType int32 = dposShuffleTypeOrderByVrfInfo //shuffleType为1表示使用固定出块顺序,为2表示使用vrf信息进行出块顺序洗牌
whetherUpdateTopN = false //是否更新topN,如果为true,根据下面几个配置项定期更新topN节点;如果为false,则一直使用初始配置的节点,不关注投票结果
blockNumToUpdateDelegate int64 = 20000
registTopNHeightLimit int64 = 100
updateTopNHeightLimit int64 = 200
shuffleType int32 = dposShuffleTypeOrderByVrfInfo //shuffleType为1表示使用固定出块顺序,为2表示使用vrf信息进行出块顺序洗牌
whetherUpdateTopN = false //是否更新topN,如果为true,根据下面几个配置项定期更新topN节点;如果为false,则一直使用初始配置的节点,不关注投票结果
blockNumToUpdateDelegate int64 = 20000
registTopNHeightLimit int64 = 100
updateTopNHeightLimit int64 = 200
)
func init() {
......
package dpos
import (
"github.com/stretchr/testify/assert"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestTicker(t *testing.T) {
......
......@@ -18,9 +18,13 @@ It has these top-level messages:
*/
package types
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
......
package types
import (
"os"
"testing"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"os"
"testing"
)
const (
......
......@@ -5,22 +5,23 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"io"
"os"
"sort"
"strings"
"testing"
"time"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
privValidatorFile = `{"address":"2FA286246F0222C4FF93210E91AECE0C66723F15","pub_key":{"type":"secp256k1","data":"03EF0E1D3112CF571743A3318125EDE2E52A4EB904BCBAA4B1F75020C2846A7EB4"},"last_height":1679,"last_round":0,"last_step":3,"last_signature":{"type":"secp256k1","data":"37892A916D6E487ADF90F9E88FE37024597677B6C6FED47444AD582F74144B3D6E4B364EAF16AF03A4E42827B6D3C86415D734A5A6CCA92E114B23EB9265AF09"},"last_signbytes":"7B22636861696E5F6964223A22636861696E33332D5A326367466A222C22766F7465223A7B22626C6F636B5F6964223A7B2268617368223A224F6A657975396B2B4149426A6E4859456739584765356A7A462B673D222C227061727473223A7B2268617368223A6E756C6C2C22746F74616C223A307D7D2C22686569676874223A313637392C22726F756E64223A302C2274696D657374616D70223A22323031382D30382D33315430373A35313A34332E3935395A222C2274797065223A327D7D","priv_key":{"type":"secp256k1","data":"5A6A14DA6F5A42835E529D75D87CC8904544F59EEE5387A37D87EEAD194D7EB2"}}`
strAddr = "2FA286246F0222C4FF93210E91AECE0C66723F15"
strPubkey = "03EF0E1D3112CF571743A3318125EDE2E52A4EB904BCBAA4B1F75020C2846A7EB4"
strAddr = "2FA286246F0222C4FF93210E91AECE0C66723F15"
strPubkey = "03EF0E1D3112CF571743A3318125EDE2E52A4EB904BCBAA4B1F75020C2846A7EB4"
addr1 = "79F9608B6826762CACCA843E81AE86837ABFFB21"
addr2 = "3480088E35099CBA75958DAE7A364A8AAD2C1BD0"
......
......@@ -9,10 +9,11 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/33cn/chain33/common/address"
"io"
"time"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
)
......
......@@ -2,6 +2,7 @@ package types
import (
"encoding/json"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
......
......@@ -3,14 +3,15 @@ package types
import (
"bytes"
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"os"
"os/signal"
"strings"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func init() {
......@@ -91,10 +92,10 @@ func TestKill(t *testing.T) {
}
var (
goIndex = 0
goIndex = 0
goIndexMutex sync.Mutex
goSum = 0
goSum = 0
goSumMutex sync.Mutex
)
......
......@@ -4,12 +4,13 @@ import (
"bytes"
"encoding/hex"
"fmt"
"strings"
"testing"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"strings"
"testing"
)
const (
......
......@@ -8,6 +8,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/33cn/chain33/common/address"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
dty "github.com/33cn/plugin/plugin/dapp/dposvote/types"
......
......@@ -3,6 +3,7 @@ package dpos
import (
"bytes"
"encoding/hex"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
......@@ -17,7 +18,7 @@ import (
const (
genesisContent = `{"genesis_time":"2018-08-16T15:38:56.951569432+08:00","chain_id":"chain33-Z2cgFj","validators":[{"pub_key":{"type":"secp256k1","data":"03EF0E1D3112CF571743A3318125EDE2E52A4EB904BCBAA4B1F75020C2846A7EB4"},"name":""},{"pub_key":{"type":"secp256k1","data":"027848E7FA630B759DB406940B5506B666A344B1060794BBF314EB459D40881BB3"},"name":""},{"pub_key":{"type":"secp256k1","data":"03F4AB6659E61E8512C9A24AC385CC1AC4D52B87D10ADBDF060086EA82BE62CDDE"},"name":""}],"app_hash":null}`
pubkey11 = "03541AB9887951C038273648545072E5B6A46A639BFF535F3957E8150CBE2A70D7"
pubkey11 = "03541AB9887951C038273648545072E5B6A46A639BFF535F3957E8150CBE2A70D7"
)
var (
......
......@@ -10,12 +10,13 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/33cn/chain33/common/crypto"
"math/rand"
"strconv"
"strings"
"time"
"github.com/33cn/chain33/common/crypto"
vrf "github.com/33cn/chain33/common/vrf/secp256k1"
jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
rpctypes "github.com/33cn/chain33/rpc/types"
......
......@@ -8,6 +8,9 @@ import (
"bytes"
"encoding/hex"
"fmt"
"sort"
"strings"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/db"
......@@ -15,8 +18,6 @@ import (
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
dty "github.com/33cn/plugin/plugin/dapp/dposvote/types"
"sort"
"strings"
)
const (
......@@ -99,7 +100,6 @@ func queryVrfByTime(kvdb db.KVDB, req *dty.DposVrfQuery) (types.Message, error)
return queryVrfByCycle(kvdb, req)
}
func getJSONVrfs(vrfs []*dty.VrfInfo) []*dty.JSONVrfInfo {
var jsonVrfs []*dty.JSONVrfInfo
for i := 0; i < len(vrfs); i++ {
......
......@@ -6,6 +6,7 @@ package executor
import (
"fmt"
"github.com/33cn/chain33/types"
dty "github.com/33cn/plugin/plugin/dapp/dposvote/types"
)
......
......@@ -50,22 +50,22 @@ const (
RegistFrozenCoins = 1000000000000
//VoteTypeNone 非投票类型
VoteTypeNone int32 = 1
VoteTypeNone int32 = 1
//VoteTypeVote 投票类型
VoteTypeVote int32 = 2
VoteTypeVote int32 = 2
//VoteTypeCancelVote 撤销投票类型
VoteTypeCancelVote int32 = 3
VoteTypeCancelVote int32 = 3
//VoteTypeCancelAllVote 撤销所有投票类型
VoteTypeCancelAllVote int32 = 4
//TopNCandidatorsVoteInit topN投票状态:初始状态
TopNCandidatorsVoteInit int64 = 0
TopNCandidatorsVoteInit int64 = 0
//TopNCandidatorsVoteMajorOK topN投票状态:2/3多数达成一致
TopNCandidatorsVoteMajorOK int64 = 1
TopNCandidatorsVoteMajorOK int64 = 1
//TopNCandidatorsVoteMajorFail topN投票状态:2/3多数达成一致失败
TopNCandidatorsVoteMajorFail int64 = 2
......
This diff is collapsed.
......@@ -5,6 +5,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/33cn/chain33/common/crypto"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
)
......
This diff is collapsed.
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