Skip to content

Commit

Permalink
Better code
Browse files Browse the repository at this point in the history
  • Loading branch information
xrtm000 committed Nov 13, 2023
1 parent 9e686b1 commit bac6043
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions node/src/main/scala/com/wavesplatform/database/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.wavesplatform.state.StateHash.SectionId
import com.wavesplatform.state.reader.LeaseDetails
import com.wavesplatform.transaction.Asset.IssuedAsset
import com.wavesplatform.transaction.lease.LeaseTransaction
import com.wavesplatform.transaction.{EthereumTransaction, GenesisTransaction, PBSince, PaymentTransaction, Transaction, TransactionParsers, TxValidationError, VersionedTransaction}
import com.wavesplatform.transaction.{EthereumTransaction, PBSince, Transaction, TransactionParsers, TxValidationError, VersionedTransaction}
import com.wavesplatform.utils.*
import monix.eval.Task
import monix.reactive.Observable
Expand Down Expand Up @@ -639,11 +639,9 @@ package object database {
def writeTransaction(v: (TxMeta, Transaction)): Array[Byte] = {
val (m, tx) = v
val ptx = tx match {
case lps: PBSince with VersionedTransaction if !PBSince.affects(lps) => TD.LegacyBytes(ByteString.copyFrom(tx.bytes()))
case _: GenesisTransaction => TD.LegacyBytes(ByteString.copyFrom(tx.bytes()))
case _: PaymentTransaction => TD.LegacyBytes(ByteString.copyFrom(tx.bytes()))
case lps: PBSince with VersionedTransaction if PBSince.affects(lps) => TD.WavesTransaction(PBTransactions.protobuf(tx))
case et: EthereumTransaction => TD.EthereumTransaction(ByteString.copyFrom(et.bytes()))
case _ => TD.WavesTransaction(PBTransactions.protobuf(tx))
case _ => TD.LegacyBytes(ByteString.copyFrom(tx.bytes()))
}
pb.TransactionData(ptx, m.status.protobuf, m.spentComplexity).toByteArray
}
Expand Down

0 comments on commit bac6043

Please sign in to comment.