Skip to content

Commit

Permalink
fix-838: comments on consensus + formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Nov 4, 2022
1 parent e5e6554 commit 0c2ba58
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ class ErgoBoxCandidate(val value: Long,
s"tokens: (${additionalTokens.map(t => ErgoAlgos.encode(t._1) + ":" + t._2).toArray.mkString(", ")}), " +
s"$additionalRegisters, creationHeight: $creationHeight)"

/** Additional tokens stored in the box, merged into a Map */
/** Additional tokens stored in the box, merged into a Map.
* This method is not used in ErgoTree and serialization, not part of consensus.
*/
lazy val tokens: Map[ModifierId, Long] = {
val merged = new mutable.HashMap[ModifierId, Long]
additionalTokens.foreach {
case (id, amount) => {
val mId = bytesToId(id)
merged.put(mId, java7.compat.Math.addExact(merged.getOrElse(mId, 0L), amount))
}
additionalTokens.foreach { case (id, amount) =>
val mId = bytesToId(id)
merged.put(mId, java7.compat.Math.addExact(merged.getOrElse(mId, 0L), amount))
}
merged.toMap
}
Expand Down

0 comments on commit 0c2ba58

Please sign in to comment.