Skip to content

Commit

Permalink
Fix distribution method
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Makoed committed Dec 18, 2018
1 parent 66df0f8 commit 1a6a0e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ class AssetDistributionSuite extends BaseTransactionSuite with CancelAfterFailur
waitForTx = true
)

nodes.waitForHeightArise()

val distribution = node.assetDistribution(issueTx, None, None, None)

distribution.size shouldBe (recievers.size + 1)
distribution(issuer.address) shouldBe (issueAmount - 10 * recievers.length)

assert(recievers.forall(rc => distribution(rc.address) == 10), "Distribution correct")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,11 @@ class LevelDBWriter(writableDB: DB, fs: FunctionalitySettings, val maxCacheSize:
(for {
seqNr <- (1 to db.get(Keys.addressesForAssetSeqNr(assetId))).par
addressId <- db.get(Keys.addressesForAsset(assetId, seqNr)).par
balance = db.get(Keys.assetBalance(addressId, assetId)(height))
actualHeight <- db
.get(Keys.assetBalanceHistory(addressId, assetId))
.filterNot(_ > height)
.headOption
balance = db.get(Keys.assetBalance(addressId, assetId)(actualHeight))
if balance > 0
} yield db.get(Keys.idToAddress(addressId)) -> balance).toMap.seq
}
Expand Down

0 comments on commit 1a6a0e5

Please sign in to comment.