Skip to content

Commit

Permalink
optimized asset distribution test
Browse files Browse the repository at this point in the history
  • Loading branch information
DrBlast committed Nov 15, 2023
1 parent 61c3df7 commit ffee9f3
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AssetDistributionSuite extends BaseTransactionSuite with CancelAfterFailur

nodes.waitForHeightArise()

val issueTx = node.issue(issuer, "TestCoin", "no description", issueAmount, 8, false, issueFee, waitForTx = true).id
val issueTx = node.issue(issuer, "TestCoin", "no description", issueAmount, 8, reissuable = false, issueFee, waitForTx = true).id

node.massTransfer(
issuer,
Expand Down Expand Up @@ -75,7 +75,7 @@ class AssetDistributionSuite extends BaseTransactionSuite with CancelAfterFailur
test("'Asset distribution' works properly") {
val receivers = for (i <- 0 until 10) yield KeyPair(s"receiver#$i".getBytes("UTF-8"))

val issueTx = node.issue(issuer, "TestCoin#2", "no description", issueAmount, 8, false, issueFee, waitForTx = true).id
val issueTx = node.issue(issuer, "TestCoin#2", "no description", issueAmount, 8, reissuable = false, issueFee, waitForTx = true).id

node
.massTransfer(
Expand All @@ -99,7 +99,7 @@ class AssetDistributionSuite extends BaseTransactionSuite with CancelAfterFailur
test("Correct last page and entry count") {
val receivers = for (i <- 0 until 50) yield KeyPair(s"receiver#$i".getBytes("UTF-8"))

val issueTx = node.issue(issuer, "TestCoin#2", "no description", issueAmount, 8, false, issueFee, waitForTx = true).id
val issueTx = node.issue(issuer, "TestCoin#2", "no description", issueAmount, 8, reissuable = false, issueFee, waitForTx = true).id

node
.massTransfer(
Expand All @@ -125,12 +125,14 @@ class AssetDistributionSuite extends BaseTransactionSuite with CancelAfterFailur
}

test("Unlimited list") {
val assetId = node.issue(issuer, "TestCoin#2", "no description", issueAmount, 8, reissuable = false, issueFee, waitForTx = true).id

val receivers = for (i <- 0 until 2000) yield KeyPair(s"receiver#$i".getBytes("UTF-8"))

val assetId = node.issue(issuer, "TestCoin#2", "no description", issueAmount, 8, false, issueFee, waitForTx = true).id
val transfers = receivers.map { r => MassTransferTransaction.Transfer(r.toAddress.toString, 10L) }.toList

receivers.foreach { receiver =>
node.transfer(issuer, receiver.toAddress.toString, 10, assetId = Some(assetId))
transfers.grouped(100).foreach { t =>
node.massTransfer(issuer, t, minFee + t.length * minFee, assetId = Some(assetId))
}

node.waitFor("empty utx")(_.utxSize, (_: Int) == 0, 1 second)
Expand Down

0 comments on commit ffee9f3

Please sign in to comment.