Only validate param change after parsing is done

This commit is contained in:
Florian Reimair 2019-08-20 12:06:20 +02:00
parent 0501412d8e
commit bd3f999e5c
No known key found for this signature in database
GPG key ID: 05634D8D7A7954C8

View file

@ -63,9 +63,13 @@ public class ChangeParamValidator extends ProposalValidator implements Consensus
public void validateDataFields(Proposal proposal) throws ProposalValidationException { public void validateDataFields(Proposal proposal) throws ProposalValidationException {
try { try {
super.validateDataFields(proposal); super.validateDataFields(proposal);
ChangeParamProposal changeParamProposal = (ChangeParamProposal) proposal;
validateParamValue(changeParamProposal.getParam(), changeParamProposal.getParamValue(), getBlockHeight(proposal)); // Only once parsing is complete we can check for param changes
checkArgument(changeParamProposal.getParamValue().length() <= 200, "ParamValue must not exceed 200 chars"); if (daoStateService.isParseBlockChainComplete()) {
ChangeParamProposal changeParamProposal = (ChangeParamProposal) proposal;
validateParamValue(changeParamProposal.getParam(), changeParamProposal.getParamValue(), getBlockHeight(proposal));
checkArgument(changeParamProposal.getParamValue().length() <= 200, "ParamValue must not exceed 200 chars");
}
} catch (ProposalValidationException e) { } catch (ProposalValidationException e) {
throw e; throw e;
} catch (Throwable throwable) { } catch (Throwable throwable) {