Commit e75a95c1 authored by pengjun's avatar pengjun Committed by vipwzw

#653 fix fmt

parent 33f0cc2d
...@@ -39,7 +39,7 @@ const ( ...@@ -39,7 +39,7 @@ const (
ProposalPOLID = byte(0x05) ProposalPOLID = byte(0x05)
VoteID = byte(0x06) VoteID = byte(0x06)
HasVoteID = byte(0x07) HasVoteID = byte(0x07)
VoteSetMaj23ID = byte(0X08) VoteSetMaj23ID = byte(0x08)
VoteSetBitsID = byte(0x09) VoteSetBitsID = byte(0x09)
ProposalHeartbeatID = byte(0x0a) ProposalHeartbeatID = byte(0x0a)
ProposalBlockID = byte(0x0b) ProposalBlockID = byte(0x0b)
...@@ -117,9 +117,9 @@ type RoundState struct { ...@@ -117,9 +117,9 @@ type RoundState struct {
// RoundStateMessage ... // RoundStateMessage ...
func (rs *RoundState) RoundStateMessage() *tmtypes.NewRoundStepMsg { func (rs *RoundState) RoundStateMessage() *tmtypes.NewRoundStepMsg {
return &tmtypes.NewRoundStepMsg{ return &tmtypes.NewRoundStepMsg{
Height: rs.Height, Height: rs.Height,
Round: int32(rs.Round), Round: int32(rs.Round),
Step: int32(rs.Step), Step: int32(rs.Step),
SecondsSinceStartTime: int32(time.Since(rs.StartTime).Seconds()), SecondsSinceStartTime: int32(time.Since(rs.StartTime).Seconds()),
LastCommitRound: int32(rs.LastCommit.Round()), LastCommitRound: int32(rs.LastCommit.Round()),
} }
......
...@@ -73,9 +73,9 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate { ...@@ -73,9 +73,9 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate {
UnknownExtKeyUsage: x509Cert.UnknownExtKeyUsage, UnknownExtKeyUsage: x509Cert.UnknownExtKeyUsage,
BasicConstraintsValid: x509Cert.BasicConstraintsValid, BasicConstraintsValid: x509Cert.BasicConstraintsValid,
IsCA: x509Cert.IsCA, IsCA: x509Cert.IsCA,
MaxPathLen: x509Cert.MaxPathLen, MaxPathLen: x509Cert.MaxPathLen,
MaxPathLenZero: x509Cert.MaxPathLenZero, MaxPathLenZero: x509Cert.MaxPathLenZero,
SubjectKeyId: x509Cert.SubjectKeyId, SubjectKeyId: x509Cert.SubjectKeyId,
AuthorityKeyId: x509Cert.AuthorityKeyId, AuthorityKeyId: x509Cert.AuthorityKeyId,
...@@ -136,9 +136,9 @@ func ParseSm2CertificateToX509(sm2Cert *sm2.Certificate) *x509.Certificate { ...@@ -136,9 +136,9 @@ func ParseSm2CertificateToX509(sm2Cert *sm2.Certificate) *x509.Certificate {
UnknownExtKeyUsage: sm2Cert.UnknownExtKeyUsage, UnknownExtKeyUsage: sm2Cert.UnknownExtKeyUsage,
BasicConstraintsValid: sm2Cert.BasicConstraintsValid, BasicConstraintsValid: sm2Cert.BasicConstraintsValid,
IsCA: sm2Cert.IsCA, IsCA: sm2Cert.IsCA,
MaxPathLen: sm2Cert.MaxPathLen, MaxPathLen: sm2Cert.MaxPathLen,
MaxPathLenZero: sm2Cert.MaxPathLenZero, MaxPathLenZero: sm2Cert.MaxPathLenZero,
SubjectKeyId: sm2Cert.SubjectKeyId, SubjectKeyId: sm2Cert.SubjectKeyId,
AuthorityKeyId: sm2Cert.AuthorityKeyId, AuthorityKeyId: sm2Cert.AuthorityKeyId,
......
...@@ -24,14 +24,14 @@ var ( ...@@ -24,14 +24,14 @@ var (
PrivKeyA = "0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b" // 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 PrivKeyA = "0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b" // 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
PrivKeyB = "0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4" // 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR PrivKeyB = "0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4" // 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR
Nodes = [][]byte{ Nodes = [][]byte{
[]byte("1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"), []byte("1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"),
[]byte("1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"), []byte("1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"),
} }
) )
func TestPokerbull(t *testing.T) { func TestPokerbull(t *testing.T) {
types.SetTitleOnlyForTest("chain33") types.SetTitleOnlyForTest("chain33")
total := int64(1000*types.Coin) total := int64(1000 * types.Coin)
accountA := types.Account{ accountA := types.Account{
Balance: total, Balance: total,
Frozen: 0, Frozen: 0,
...@@ -63,8 +63,8 @@ func TestPokerbull(t *testing.T) { ...@@ -63,8 +63,8 @@ func TestPokerbull(t *testing.T) {
// start game // start game
p1 := &pkt.PBGameStart{ p1 := &pkt.PBGameStart{
Value: 5*types.Coin, Value: 5 * types.Coin,
PlayerNum: 2, PlayerNum: 2,
} }
createTx, err := types.CallCreateTransaction(pkt.PokerBullX, "Start", p1) createTx, err := types.CallCreateTransaction(pkt.PokerBullX, "Start", p1)
if err != nil { if err != nil {
...@@ -126,7 +126,7 @@ func TestPokerbull(t *testing.T) { ...@@ -126,7 +126,7 @@ func TestPokerbull(t *testing.T) {
// continue game // continue game
p2 := &pkt.PBGameContinue{ p2 := &pkt.PBGameContinue{
GameId: common.ToHex(gameID), GameId: common.ToHex(gameID),
} }
createTx, err = types.CallCreateTransaction(pkt.PokerBullX, "Continue", p2) createTx, err = types.CallCreateTransaction(pkt.PokerBullX, "Continue", p2)
if err != nil { if err != nil {
...@@ -185,11 +185,11 @@ func TestPokerbull(t *testing.T) { ...@@ -185,11 +185,11 @@ func TestPokerbull(t *testing.T) {
} }
// query // query
res, err := exec.Query(pkt.FuncNameQueryGameByID, types.Encode(&pkt.QueryPBGameInfo{GameId:common.ToHex(gameID)})) res, err := exec.Query(pkt.FuncNameQueryGameByID, types.Encode(&pkt.QueryPBGameInfo{GameId: common.ToHex(gameID)}))
assert.Nil(t, err) assert.Nil(t, err)
assert.NotNil(t, res) assert.NotNil(t, res)
res, err = exec.Query(pkt.FuncNameQueryGameByAddr, types.Encode(&pkt.QueryPBGameInfo{Addr:string(Nodes[0])})) res, err = exec.Query(pkt.FuncNameQueryGameByAddr, types.Encode(&pkt.QueryPBGameInfo{Addr: string(Nodes[0])}))
assert.Nil(t, err) assert.Nil(t, err)
assert.NotNil(t, res) assert.NotNil(t, res)
...@@ -227,4 +227,4 @@ func signTx(tx *types.Transaction, hexPrivKey string) (*types.Transaction, error ...@@ -227,4 +227,4 @@ func signTx(tx *types.Transaction, hexPrivKey string) (*types.Transaction, error
tx.Sign(int32(signType), privKey) tx.Sign(int32(signType), privKey)
return tx, nil return tx, nil
} }
\ No newline at end of file
...@@ -43,7 +43,7 @@ func TestJRPCChannel(t *testing.T) { ...@@ -43,7 +43,7 @@ func TestJRPCChannel(t *testing.T) {
{fn: testQuitRawTxCmd}, {fn: testQuitRawTxCmd},
{fn: testPlayRawTxCmd}, {fn: testPlayRawTxCmd},
} }
for _, testCase := range testCases { for _, testCase := range testCases {
err := testCase.fn(t, jrpcClient) err := testCase.fn(t, jrpcClient)
assert.Nil(t, err) assert.Nil(t, err)
...@@ -96,7 +96,7 @@ func testContinueRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { ...@@ -96,7 +96,7 @@ func testContinueRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
} }
func testPlayRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testPlayRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
payload := &pty.PBGamePlay{GameId: "123", Round:1, Value:5, Address: []string{"a", "b"}} payload := &pty.PBGamePlay{GameId: "123", Round: 1, Value: 5, Address: []string{"a", "b"}}
params := &rpctypes.CreateTxIn{ params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pty.PokerBullX), Execer: types.ExecName(pty.PokerBullX),
ActionName: pty.CreatePlayTx, ActionName: pty.CreatePlayTx,
......
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