forked from wavesplatform/Waves
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NODE-2362: New data entries limit calculation (wavesplatform#3588)
- Loading branch information
Showing
17 changed files
with
328 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
node/src/main/scala/com/wavesplatform/state/diffs/DataTransactionDiff.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
package com.wavesplatform.state.diffs | ||
|
||
import cats.syntax.either._ | ||
import com.wavesplatform.lang.ValidationError | ||
import com.wavesplatform.state._ | ||
import com.wavesplatform.transaction.DataTransaction | ||
import com.wavesplatform.transaction.validation.impl.DataTxValidator | ||
|
||
object DataTransactionDiff { | ||
|
||
def apply(blockchain: Blockchain)(tx: DataTransaction): Either[ValidationError, Diff] = { | ||
val sender = tx.sender.toAddress | ||
Right( | ||
Diff( | ||
portfolios = Map(sender -> Portfolio(-tx.fee, LeaseBalance.empty, Map.empty)), | ||
accountData = Map(sender -> AccountDataInfo(tx.data.map(item => item.key -> item).toMap)), | ||
scriptsRun = DiffsCommon.countScriptRuns(blockchain, tx) | ||
) | ||
for { | ||
// Validate data size | ||
_ <- DataTxValidator.payloadSizeValidation(blockchain, tx).toEither.leftMap(_.head) | ||
} yield Diff( | ||
portfolios = Map(sender -> Portfolio(-tx.fee, LeaseBalance.empty, Map.empty)), | ||
accountData = Map(sender -> AccountDataInfo(tx.data.map(item => item.key -> item).toMap)), | ||
scriptsRun = DiffsCommon.countScriptRuns(blockchain, tx) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.