@@ -1806,12 +1806,8 @@ public Exchange getExchangeById(ByteString exchangeId) {
18061806 return null ;
18071807 }
18081808
1809- private boolean getAllowShieldedTransactionApi () {
1810- return Args .getInstance ().isAllowShieldedTransactionApi ();
1811- }
1812-
18131809 private void checkAllowShieldedTransactionApi () throws ZksnarkException {
1814- if (!getAllowShieldedTransactionApi ()) {
1810+ if (!Args . getInstance (). isAllowShieldedTransactionApi ()) {
18151811 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
18161812 }
18171813 }
@@ -1830,10 +1826,7 @@ public BytesMessage getNullifier(ByteString id) {
18301826 }
18311827
18321828 private long getBlockNumber (OutputPoint outPoint )
1833- throws BadItemException , ZksnarkException {
1834- if (!getAllowShieldedTransactionApi ()) {
1835- throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
1836- }
1829+ throws BadItemException {
18371830 ByteString txId = outPoint .getHash ();
18381831
18391832 long blockNum = chainBaseManager .getTransactionStore ().getBlockNumber (txId .toByteArray ());
@@ -1848,9 +1841,6 @@ private long getBlockNumber(OutputPoint outPoint)
18481841 private IncrementalMerkleVoucherContainer createWitness (OutputPoint outPoint , Long blockNumber )
18491842 throws ItemNotFoundException , BadItemException ,
18501843 InvalidProtocolBufferException , ZksnarkException {
1851- if (!getAllowShieldedTransactionApi ()) {
1852- throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
1853- }
18541844 ByteString txId = outPoint .getHash ();
18551845
18561846 //Get the tree in blockNum-1 position
@@ -1946,9 +1936,6 @@ private IncrementalMerkleVoucherContainer createWitness(OutputPoint outPoint, Lo
19461936 private void updateWitnesses (List <IncrementalMerkleVoucherContainer > witnessList , long large ,
19471937 int synBlockNum ) throws ItemNotFoundException , BadItemException ,
19481938 InvalidProtocolBufferException , ZksnarkException {
1949- if (!getAllowShieldedTransactionApi ()) {
1950- throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
1951- }
19521939 long start = large ;
19531940 long end = large + synBlockNum - 1 ;
19541941
@@ -2022,10 +2009,7 @@ private void updateLowWitness(IncrementalMerkleVoucherContainer witness, long bl
20222009 }
20232010 }
20242011
2025- private void validateInput (OutputPointInfo request ) throws BadItemException , ZksnarkException {
2026- if (!getAllowShieldedTransactionApi ()) {
2027- throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
2028- }
2012+ private void validateInput (OutputPointInfo request ) throws BadItemException {
20292013 if (request .getBlockNum () < 0 || request .getBlockNum () > 1000 ) {
20302014 throw new BadItemException ("request.BlockNum must be specified with range in [0, 1000]" );
20312015 }
@@ -2097,9 +2081,7 @@ public IncrementalMerkleVoucherInfo getMerkleTreeVoucherInfo(OutputPointInfo req
20972081 }
20982082
20992083 public IncrementalMerkleTree getMerkleTreeOfBlock (long blockNum ) throws ZksnarkException {
2100- if (!getAllowShieldedTransactionApi ()) {
2101- throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
2102- }
2084+ checkAllowShieldedTransactionApi ();
21032085 if (blockNum < 0 ) {
21042086 return null ;
21052087 }
0 commit comments