Skip to content

Commit 50d1657

Browse files
bysomeonevipwzw
authored andcommitted
solo:update bench test
1 parent 9ee2040 commit 50d1657

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

system/consensus/solo/solo.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
5353
if subcfg.GenesisBlockTime == 0 {
5454
subcfg.GenesisBlockTime = cfg.GenesisBlockTime
5555
}
56-
solo := &Client{c, &subcfg, time.Duration(subcfg.WaitTxMs) * time.Millisecond}
56+
solo := &Client{
57+
BaseClient: c,
58+
subcfg: &subcfg,
59+
sleepTime: time.Duration(subcfg.WaitTxMs) * time.Millisecond,
60+
}
5761
c.SetChild(solo)
5862
return solo
5963
}

system/consensus/solo/solo_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ var (
205205
txtype *string
206206
accountnum *int
207207
txsize *int
208+
port *int
208209
)
209210

210211
func init() {
@@ -218,6 +219,7 @@ func init() {
218219
txtype = flag.String("txtype", "none", "set tx type, coins/none")
219220
accountnum = flag.Int("accountnum", 10, "set account num for transfer bench, default 10")
220221
txsize = flag.Int("txsize", 32, "set none tx size byte")
222+
port = flag.Int("port", 9902, "set grpc port")
221223
testing.Init()
222224
flag.Parse()
223225

@@ -272,7 +274,7 @@ func BenchmarkSolo(b *testing.B) {
272274
cfg.GetModuleConfig().Mempool.MinTxFeeRate = 0
273275
cfg.SetMinFee(0)
274276
}
275-
cfg.GetModuleConfig().RPC.GrpcBindAddr = "localhost:8802"
277+
cfg.GetModuleConfig().RPC.GrpcBindAddr = fmt.Sprintf("localhost:%d", *port)
276278
cfg.GetModuleConfig().Crypto.EnableTypes = []string{secp256k1.Name, none.Name}
277279
subcfg := cfg.GetSubConfig()
278280
coinSub, _ := types.ModifySubConfig(subcfg.Exec["coins"], "disableAddrReceiver", true)

util/testnode/testnode.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ func (m *mockP2P) SetQueueClient(client queue.Client) {
512512
msg.Reply(client.NewMessage(p2pKey, types.EventPeerList, &types.PeerList{}))
513513
case types.EventGetNetInfo:
514514
msg.Reply(client.NewMessage(p2pKey, types.EventPeerList, &types.NodeNetInfo{}))
515-
case types.EventTxBroadcast, types.EventBlockBroadcast:
515+
case types.EventTxBroadcast, types.EventBlockBroadcast, types.EventAddBlock:
516516
client.FreeMessage(msg)
517517
default:
518518
msg.ReplyErr("p2p->Do not support "+types.GetEventName(int(msg.Ty)), types.ErrNotSupport)

0 commit comments

Comments
 (0)