Unverified Commit 44050dce authored by 33cn's avatar 33cn Committed by GitHub

Merge pull request #656 from vipwzw/fix_tick_time

fix ticket test time
parents ed17f184 e4aefed4
...@@ -2,6 +2,7 @@ Title="local" ...@@ -2,6 +2,7 @@ Title="local"
TestNet=true TestNet=true
FixTime=false FixTime=false
[log] [log]
# 日志级别,支持debug(dbug)/info/warn/error(eror)/crit # 日志级别,支持debug(dbug)/info/warn/error(eror)/crit
loglevel = "debug" loglevel = "debug"
...@@ -82,7 +83,7 @@ maxTxNumber = 1600 ...@@ -82,7 +83,7 @@ maxTxNumber = 1600
maxTxNumber = 10000 maxTxNumber = 10000
[mver.consensus.ForkChainParamV2] [mver.consensus.ForkChainParamV2]
powLimitBits = "0x1f2fffff" powLimitBits = "0x2f2fffff"
[mver.consensus.ForkTicketFundAddrV1] [mver.consensus.ForkTicketFundAddrV1]
fundKeyAddr = "1Ji3W12KGScCM7C2p8bg635sNkayDM8MGY" fundKeyAddr = "1Ji3W12KGScCM7C2p8bg635sNkayDM8MGY"
...@@ -113,7 +114,7 @@ genesisBlockTime=1514533394 ...@@ -113,7 +114,7 @@ genesisBlockTime=1514533394
[[consensus.sub.ticket.genesis]] [[consensus.sub.ticket.genesis]]
minerAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" minerAddr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
returnAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" returnAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
count=10000 count=3000
[[consensus.sub.ticket.genesis]] [[consensus.sub.ticket.genesis]]
minerAddr="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo" minerAddr="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
......
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"crypto/ecdsa" "crypto/ecdsa"
"fmt" "fmt"
"testing" "testing"
"time"
"github.com/33cn/chain33/account" "github.com/33cn/chain33/account"
"github.com/33cn/chain33/common/crypto" "github.com/33cn/chain33/common/crypto"
...@@ -68,14 +69,18 @@ func testTicket(t *testing.T) { ...@@ -68,14 +69,18 @@ func testTicket(t *testing.T) {
status, err = mock33.GetAPI().GetWalletStatus() status, err = mock33.GetAPI().GetWalletStatus()
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, true, status.IsAutoMining) assert.Equal(t, true, status.IsAutoMining)
err = mock33.WaitHeight(50) start := time.Now()
height := int64(0)
hastclose := false
hastopen := false
for {
height += 20
err = mock33.WaitHeight(height)
assert.Nil(t, err) assert.Nil(t, err)
//查询票是否自动close,并且购买了新的票 //查询票是否自动close,并且购买了新的票
req := &types.ReqWalletTransactionList{Count: 1000} req := &types.ReqWalletTransactionList{Count: 1000}
list, err := mock33.GetAPI().WalletTransactionList(req) list, err := mock33.GetAPI().WalletTransactionList(req)
assert.Nil(t, err) assert.Nil(t, err)
hastclose := false
hastopen := false
for _, tx := range list.TxDetails { for _, tx := range list.TxDetails {
if tx.ActionName == "tclose" && tx.Receipt.Ty == 2 { if tx.ActionName == "tclose" && tx.Receipt.Ty == 2 {
hastclose = true hastclose = true
...@@ -84,6 +89,10 @@ func testTicket(t *testing.T) { ...@@ -84,6 +89,10 @@ func testTicket(t *testing.T) {
hastopen = true hastopen = true
} }
} }
if hastopen == true && hastclose == true || time.Since(start) > 100*time.Second {
break
}
}
assert.Equal(t, true, hastclose) assert.Equal(t, true, hastclose)
assert.Equal(t, true, hastopen) assert.Equal(t, true, hastopen)
//查询合约中的余额 //查询合约中的余额
......
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