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
fe95f521
Commit
fe95f521
authored
Sep 23, 2019
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete useless code
parent
0008026e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
109 deletions
+0
-109
dpos_test.go
plugin/consensus/dpos/dpos_test.go
+0
-44
node_test.go
plugin/consensus/dpos/node_test.go
+0
-65
No files found.
plugin/consensus/dpos/dpos_test.go
View file @
fe95f521
...
...
@@ -368,7 +368,6 @@ func DposPerf() {
}
else
{
fmt
.
Println
(
"SendTopNRegistTx failed"
)
}
//sendTopNRegistTx(dposClient.csState, reg)
time
.
Sleep
(
2
*
time
.
Second
)
fmt
.
Println
(
"=======start QueryTopNCandidators!======="
)
...
...
@@ -582,49 +581,6 @@ func sendRegistVrfRPTx(cs *ConsensusState, info *dty.DposVrfRPRegist) bool {
return
true
}
/*
func sendTopNRegistTx(cs *ConsensusState, reg *dty.TopNCandidatorRegist) bool {
//info.Pubkey = strings.ToUpper(hex.EncodeToString(cs.privValidator.GetPubKey().Bytes()))
obj := dty.CanonicalTopNCandidator(reg.Cand)
reg.Cand.Hash = obj.ID()
reg.Cand.SignerPubkey = cs.privValidator.GetPubKey().Bytes()
byteCB, err := json.Marshal(reg.Cand)
if err != nil {
dposlog.Error("marshal TopNCandidator failed", "err", err)
}
sig, err := cs.privValidator.SignMsg(byteCB)
if err != nil {
dposlog.Error("TopNCandidator failed.", "err", err)
return false
}
reg.Cand.Signature = sig.Bytes()
tx, err := cs.client.CreateTopNRegistTx(reg)
if err != nil {
dposlog.Error("CreateTopNRegistTx failed.", "err", err)
return false
}
tx.Fee = fee
cs.privValidator.SignTx(tx)
dposlog.Info("Sign TopNRegistTx ok.")
reply, err := c.SendTransaction(context.Background(), tx)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return false
}
if !reply.IsOk {
fmt.Fprintln(os.Stderr, errors.New(string(reply.GetMsg())))
return false
}
return true
}
*/
func
sendTransferTx
(
fromKey
,
to
string
,
amount
int64
)
bool
{
signer
:=
util
.
HexToPrivkey
(
fromKey
)
var
tx
*
types
.
Transaction
...
...
plugin/consensus/dpos/node_test.go
View file @
fe95f521
...
...
@@ -455,7 +455,6 @@ func TestNode(t *testing.T) {
fmt
.
Println
(
"=======start TestNode!======="
)
Init
()
q1
,
chain1
,
s1
,
mem1
,
exec1
,
cs1
,
p2p1
:=
initEnvDpos1
(
"chain33.test1.toml"
)
//q2, chain2, s2, mem2, exec2, cs2, p2p2 := initEnvDpos2("chain33.test2.toml")
defer
clearTestData1
()
defer
chain1
.
Close
()
...
...
@@ -466,14 +465,6 @@ func TestNode(t *testing.T) {
defer
cs1
.
Close
()
defer
p2p1
.
Close
()
//defer chain2.Close()
//defer mem2.Close()
//defer exec2.Close()
//defer s2.Close()
//defer q2.Close()
//defer cs2.Close()
//defer p2p2.Close()
time
.
Sleep
(
2
*
time
.
Second
)
_
,
_
,
err
:=
createConn
(
"127.0.0.1:8802"
)
...
...
@@ -481,11 +472,6 @@ func TestNode(t *testing.T) {
_
,
_
,
err
=
createConn
(
"127.0.0.1:8802"
)
}
//_, _, err = createConn("127.0.0.1:8804")
//for err != nil {
// _, _, err = createConn("127.0.0.1:8804")
//}
fmt
.
Println
(
"node1 ip:"
,
cs1
.
(
*
Client
)
.
GetNode
()
.
IP
)
fmt
.
Println
(
"node1 id:"
,
cs1
.
(
*
Client
)
.
GetNode
()
.
ID
)
fmt
.
Println
(
"node1 network:"
,
cs1
.
(
*
Client
)
.
GetNode
()
.
Network
)
...
...
@@ -514,8 +500,6 @@ func TestNode(t *testing.T) {
fmt
.
Println
(
"TestNodeCompatibleWith ok"
)
//time.Sleep(2 * time.Second)
fmt
.
Println
(
q1
.
Name
())
fmt
.
Println
(
cs1
.
(
*
Client
)
.
testFlag
)
fmt
.
Println
(
cs1
.
(
*
Client
)
.
GetConsensusState
()
!=
nil
)
...
...
@@ -529,19 +513,10 @@ func TestNode(t *testing.T) {
fmt
.
Println
(
cs1
.
(
*
Client
)
.
GenesisDoc
()
.
ChainID
)
fmt
.
Println
(
"Validator index: "
,
cs1
.
(
*
Client
)
.
ValidatorIndex
())
//go cs2.(*Client).GetNode().DialPeerWithAddress("127.0.0.1:36656")
//require.Nil(t, err)
//err = cs1.(*Client).GetNode().DialPeerWithAddress("127.0.0.1:36657")
//require.Nil(t, err)
time
.
Sleep
(
1
*
time
.
Second
)
//cs1.(*Client).StopC()
if
cs1
.
(
*
Client
)
.
GetNode
()
.
IsRunning
()
{
fmt
.
Println
(
"=======cs1 is running======="
)
//cs1.(*Client).GetConsensusState().Stop()
//cs1.(*Client).GetNode().Stop()
}
else
{
fmt
.
Println
(
"======= cs1 is not running======="
)
}
...
...
@@ -622,43 +597,3 @@ func initEnvDpos1(configName string) (queue.Queue, *blockchain.BlockChain, queue
return
q
,
chain
,
s
,
mem
,
exec
,
cs
,
network
}
/*
func initEnvDpos2(configName string) (queue.Queue, *blockchain.BlockChain, queue.Module, queue.Module, *executor.Executor, queue.Module, queue.Module) {
var q = queue.New("channel2")
flag.Parse()
cfg, sub := types.InitCfg(configName)
types.Init(cfg.Title, cfg)
chain := blockchain.New(cfg.BlockChain)
chain.SetQueueClient(q.Client())
exec := executor.New(cfg.Exec, sub.Exec)
exec.SetQueueClient(q.Client())
types.SetMinFee(0)
s := store.New(cfg.Store, sub.Store)
s.SetQueueClient(q.Client())
var subcfg subConfig
if sub != nil {
types.MustDecode(sub.Consensus["dpos"], &subcfg)
}
encode, _ := json.Marshal(subcfg)
fmt.Println(string(encode))
cs := New(cfg.Consensus, sub.Consensus["dpos"])
cs.(*Client).SetTestFlag()
cs.SetQueueClient(q.Client())
mem := mempool.New(cfg.Mempool, nil)
mem.SetQueueClient(q.Client())
network := p2p.New(cfg.P2P)
network.SetQueueClient(q.Client())
rpc.InitCfg(cfg.RPC)
gapi := rpc.NewGRpcServer(q.Client(), nil)
go gapi.Listen()
return q, chain, s, mem, exec, cs, network
}
*/
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