|
|
@ -2,19 +2,19 @@ package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bufio" |
|
|
|
"bufio" |
|
|
|
|
|
|
|
"encoding/hex" |
|
|
|
"flag" |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"harmony-benchmark/blockchain" |
|
|
|
"harmony-benchmark/blockchain" |
|
|
|
|
|
|
|
"harmony-benchmark/consensus" |
|
|
|
"harmony-benchmark/log" |
|
|
|
"harmony-benchmark/log" |
|
|
|
"harmony-benchmark/node" |
|
|
|
"harmony-benchmark/node" |
|
|
|
"harmony-benchmark/p2p" |
|
|
|
"harmony-benchmark/p2p" |
|
|
|
"math/rand" |
|
|
|
"math/rand" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
|
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
"harmony-benchmark/consensus" |
|
|
|
|
|
|
|
"encoding/hex" |
|
|
|
|
|
|
|
"strconv" |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// Get numTxs number of Fake transactions based on the existing UtxoPool.
|
|
|
|
// Get numTxs number of Fake transactions based on the existing UtxoPool.
|
|
|
@ -50,7 +50,7 @@ func getNewFakeTransactions(dataNode *node.Node, numTxs int) []*blockchain.Trans |
|
|
|
for index, value := range utxoMap { |
|
|
|
for index, value := range utxoMap { |
|
|
|
countAll++ |
|
|
|
countAll++ |
|
|
|
if rand.Intn(100) <= 20 { // 20% sample rate to select UTXO to use for new transactions
|
|
|
|
if rand.Intn(100) <= 20 { // 20% sample rate to select UTXO to use for new transactions
|
|
|
|
// Spend the money of current UTXO to a random address in [1 - 1000]
|
|
|
|
// Spend the money of current UTXO to a random address in [1 - 1000]
|
|
|
|
txin := blockchain.TXInput{txId, index, address} |
|
|
|
txin := blockchain.TXInput{txId, index, address} |
|
|
|
txout := blockchain.TXOutput{value, strconv.Itoa(rand.Intn(1000))} |
|
|
|
txout := blockchain.TXOutput{value, strconv.Itoa(rand.Intn(1000))} |
|
|
|
tx := blockchain.Transaction{[32]byte{}, []blockchain.TXInput{txin}, []blockchain.TXOutput{txout}} |
|
|
|
tx := blockchain.Transaction{[32]byte{}, []blockchain.TXInput{txin}, []blockchain.TXOutput{txout}} |
|
|
|