Enforce version 2+ for DEPLOY_AT

This commit is contained in:
catbref 2020-05-19 08:35:25 +01:00
parent b4284515e7
commit 74f89af841

View File

@ -137,10 +137,12 @@ public class DeployAtTransaction extends Transaction {
return ValidationResult.NO_BALANCE; return ValidationResult.NO_BALANCE;
} }
// Check version from creation bytes
if (this.getVersion() < 2)
return ValidationResult.INVALID_CREATION_BYTES;
// Check creation bytes are valid (for v2+) // Check creation bytes are valid (for v2+)
if (this.getVersion() >= 2) { this.ensureATAddress();
// Do actual validation
ensureATAddress();
// Just enough AT data to allow API to query initial balances, etc. // Just enough AT data to allow API to query initial balances, etc.
String atAddress = this.deployATTransactionData.getAtAddress(); String atAddress = this.deployATTransactionData.getAtAddress();
@ -160,9 +162,6 @@ public class DeployAtTransaction extends Transaction {
// Not valid // Not valid
return ValidationResult.INVALID_CREATION_BYTES; return ValidationResult.INVALID_CREATION_BYTES;
} }
} else {
// Skip validation for old, dead ATs
}
return ValidationResult.OK; return ValidationResult.OK;
} }