-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NODE-2616 Refactored validation of transaction version (#3906)
- Loading branch information
Showing
52 changed files
with
223 additions
and
266 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
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
30 changes: 12 additions & 18 deletions
30
node/src/main/scala/com/wavesplatform/transaction/PBSince.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,25 +1,19 @@ | ||
package com.wavesplatform.transaction | ||
|
||
import com.wavesplatform.protobuf.transaction.PBTransactions | ||
|
||
trait PBSince { self: Transaction with VersionedTransaction => | ||
def protobufVersion: TxVersion | ||
final def isProtobufVersion: Boolean = self.version >= protobufVersion | ||
|
||
override def bytesSize: Int = | ||
if (isProtobufVersion) PBTransactions.protobuf(self).serializedSize else bytes().length | ||
} | ||
sealed trait PBSince | ||
|
||
object PBSince { | ||
trait V1 extends PBSince { self: Transaction with VersionedTransaction => | ||
override def protobufVersion: TxVersion = TxVersion.V1 | ||
} | ||
trait V1 extends PBSince | ||
trait V2 extends PBSince | ||
trait V3 extends PBSince | ||
|
||
trait V2 extends PBSince { self: Transaction with VersionedTransaction => | ||
override def protobufVersion: TxVersion = TxVersion.V2 | ||
} | ||
def version(tx: PBSince): TxVersion = | ||
tx match { | ||
case _: V1 => TxVersion.V1 | ||
case _: V2 => TxVersion.V2 | ||
case _: V3 => TxVersion.V3 | ||
} | ||
|
||
trait V3 extends PBSince { self: Transaction with VersionedTransaction => | ||
override def protobufVersion: TxVersion = TxVersion.V3 | ||
} | ||
def affects(tx: PBSince & Versioned): Boolean = | ||
tx.version >= version(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
2 changes: 1 addition & 1 deletion
2
node/src/main/scala/com/wavesplatform/transaction/SigProofsSwitch.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,6 +1,6 @@ | ||
package com.wavesplatform.transaction | ||
|
||
trait SigProofsSwitch extends ProvenTransaction { self: Transaction with VersionedTransaction => | ||
trait SigProofsSwitch extends ProvenTransaction { self: Transaction with Versioned => | ||
def usesLegacySignature: Boolean = | ||
self.version == Transaction.V1 | ||
} |
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
Oops, something went wrong.