|
|
@ -106,7 +106,7 @@ UTXOLOOP: |
|
|
|
|
|
|
|
|
|
|
|
randNum := rand.Intn(100) |
|
|
|
randNum := rand.Intn(100) |
|
|
|
|
|
|
|
|
|
|
|
if setting.crossShard && randNum < 0 { // 1/3 cross shard transactions: add another txinput from another shard
|
|
|
|
if setting.crossShard && randNum < 30 { // 1/3 cross shard transactions: add another txinput from another shard
|
|
|
|
generateCrossShardTx(&txInfo) |
|
|
|
generateCrossShardTx(&txInfo) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
generateSingleShardTx(&txInfo) |
|
|
|
generateSingleShardTx(&txInfo) |
|
|
@ -126,8 +126,8 @@ UTXOLOOP: |
|
|
|
|
|
|
|
|
|
|
|
func generateCrossShardTx(txInfo *TxInfo) { |
|
|
|
func generateCrossShardTx(txInfo *TxInfo) { |
|
|
|
nodeShardID := txInfo.dataNodes[txInfo.shardID].Consensus.ShardID |
|
|
|
nodeShardID := txInfo.dataNodes[txInfo.shardID].Consensus.ShardID |
|
|
|
// shard with neighboring Id
|
|
|
|
// a random shard to spend money to
|
|
|
|
crossShardId := (int(nodeShardID) + 1) % len(txInfo.dataNodes) |
|
|
|
crossShardId := rand.Intn(len(txInfo.dataNodes)) |
|
|
|
|
|
|
|
|
|
|
|
crossShardNode := txInfo.dataNodes[crossShardId] |
|
|
|
crossShardNode := txInfo.dataNodes[crossShardId] |
|
|
|
crossShardUtxosMap := crossShardNode.UtxoPool.UtxoMap[txInfo.address] |
|
|
|
crossShardUtxosMap := crossShardNode.UtxoPool.UtxoMap[txInfo.address] |
|
|
|