Lower the tx load on txgen

pull/165/head
Rongjian Lan 6 years ago
parent 456fa4e4ec
commit a89d877110
  1. 2
      client/txgen/main.go
  2. 6
      client/txgen/txgen/account_txs_generator.go

@ -218,7 +218,7 @@ func main() {
lock.Unlock() lock.Unlock()
subsetCounter++ subsetCounter++
time.Sleep(10000 * time.Millisecond) time.Sleep(60000 * time.Millisecond)
} }
} else { } else {
for { for {

@ -21,15 +21,15 @@ type Settings struct {
func GenerateSimulatedTransactionsAccount(shardID int, dataNodes []*node.Node, setting Settings) (types.Transactions, types.Transactions) { func GenerateSimulatedTransactionsAccount(shardID int, dataNodes []*node.Node, setting Settings) (types.Transactions, types.Transactions) {
_ = setting // TODO: take use of settings _ = setting // TODO: take use of settings
node := dataNodes[shardID] node := dataNodes[shardID]
txs := make([]*types.Transaction, 1000) txs := make([]*types.Transaction, 100)
for i := 0; i < 100; i++ { for i := 0; i < 100; i++ {
baseNonce := node.Worker.GetCurrentState().GetNonce(crypto.PubkeyToAddress(node.TestBankKeys[i].PublicKey)) baseNonce := node.Worker.GetCurrentState().GetNonce(crypto.PubkeyToAddress(node.TestBankKeys[i].PublicKey))
for j := 0; j < 10; j++ { for j := 0; j < 1; j++ {
randomUserKey, _ := crypto.GenerateKey() randomUserKey, _ := crypto.GenerateKey()
randomUserAddress := crypto.PubkeyToAddress(randomUserKey.PublicKey) randomUserAddress := crypto.PubkeyToAddress(randomUserKey.PublicKey)
tx, _ := types.SignTx(types.NewTransaction(baseNonce+uint64(j), randomUserAddress, uint32(shardID), big.NewInt(1000), params.TxGas, nil, nil), types.HomesteadSigner{}, node.TestBankKeys[i]) tx, _ := types.SignTx(types.NewTransaction(baseNonce+uint64(j), randomUserAddress, uint32(shardID), big.NewInt(1000), params.TxGas, nil, nil), types.HomesteadSigner{}, node.TestBankKeys[i])
txs[i*10+j] = tx txs[i*1+j] = tx
} }
} }
return txs, nil return txs, nil

Loading…
Cancel
Save