Skip to content

Commit 688a667

Browse files
authored
Add chainID to actioninjector (iotexproject#152)
1 parent 7aed89f commit 688a667

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tools/actioninjector/actioninjector.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
exp "github.com/iotexproject/iotex-core/explorer/idl/explorer"
2828
"github.com/iotexproject/iotex-core/iotxaddress"
2929
"github.com/iotexproject/iotex-core/logger"
30-
"github.com/iotexproject/iotex-core/pkg/enc"
3130
"github.com/iotexproject/iotex-core/testutil"
3231
)
3332

@@ -49,6 +48,8 @@ type PKPair struct {
4948
func main() {
5049
// path of config file containing all the public/private key paris of addresses getting transfers from Creator in genesis block
5150
var configPath string
51+
// chain ID. Default is 67305985
52+
var chainID int
5253
// target address for jrpc connection. Default is "127.0.0.1:14004"
5354
var addr string
5455
// number of transfer injections. Default is 50
@@ -91,6 +92,7 @@ func main() {
9192
var resetInterval int
9293

9394
flag.StringVar(&configPath, "injector-config-path", "./tools/actioninjector/gentsfaddrs.yaml", "path of config file of genesis transfer addresses")
95+
flag.IntVar(&chainID, "chain", 67305985, "id of target chain")
9496
flag.StringVar(&addr, "addr", "127.0.0.1:14004", "target ip:port for jrpc connection")
9597
flag.IntVar(&transferNum, "transfer-num", 50, "number of transfer injections")
9698
flag.IntVar(&transferGasLimit, "transfer-gas-limit", 1000000, "transfer gas limit")
@@ -128,7 +130,7 @@ func main() {
128130
// Construct iotex addresses for loaded senders
129131
addrs := []*iotxaddress.Address{}
130132
for _, pkPair := range addresses.PKPairs {
131-
addr := testutil.ConstructAddress(enc.MachineEndian.Uint32(iotxaddress.ChainID), pkPair.PubKey, pkPair.PriKey)
133+
addr := testutil.ConstructAddress(uint32(chainID), pkPair.PubKey, pkPair.PriKey)
132134
addrs = append(addrs, addr)
133135
}
134136
admins := addrs[len(addrs)-adminNumber:]

tools/actioninjector/actioninjector_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestActionInjector(t *testing.T) {
6767
// Construct iotex addresses for loaded senders
6868
addrs := make([]*iotxaddress.Address, 0)
6969
for _, pkPair := range addresses.PKPairs {
70-
addr := testutil.ConstructAddress(1, pkPair.PubKey, pkPair.PriKey)
70+
addr := testutil.ConstructAddress(chainID, pkPair.PubKey, pkPair.PriKey)
7171
addrs = append(addrs, addr)
7272
}
7373

0 commit comments

Comments
 (0)