@@ -1806,12 +1806,12 @@ public Exchange getExchangeById(ByteString exchangeId) {
18061806 return null ;
18071807 }
18081808
1809- private boolean getFullNodeAllowShieldedTransaction () {
1810- return Args .getInstance ().isFullNodeAllowShieldedTransactionArgs ();
1809+ private boolean getAllowShieldedTransactionApi () {
1810+ return Args .getInstance ().isAllowShieldedTransactionApi ();
18111811 }
18121812
1813- private void checkFullNodeAllowShieldedTransaction () throws ZksnarkException {
1814- if (!getFullNodeAllowShieldedTransaction ()) {
1813+ private void checkAllowShieldedTransactionApi () throws ZksnarkException {
1814+ if (!getAllowShieldedTransactionApi ()) {
18151815 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
18161816 }
18171817 }
@@ -1831,7 +1831,7 @@ public BytesMessage getNullifier(ByteString id) {
18311831
18321832 private long getBlockNumber (OutputPoint outPoint )
18331833 throws BadItemException , ZksnarkException {
1834- if (!getFullNodeAllowShieldedTransaction ()) {
1834+ if (!getAllowShieldedTransactionApi ()) {
18351835 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
18361836 }
18371837 ByteString txId = outPoint .getHash ();
@@ -1848,7 +1848,7 @@ private long getBlockNumber(OutputPoint outPoint)
18481848 private IncrementalMerkleVoucherContainer createWitness (OutputPoint outPoint , Long blockNumber )
18491849 throws ItemNotFoundException , BadItemException ,
18501850 InvalidProtocolBufferException , ZksnarkException {
1851- if (!getFullNodeAllowShieldedTransaction ()) {
1851+ if (!getAllowShieldedTransactionApi ()) {
18521852 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
18531853 }
18541854 ByteString txId = outPoint .getHash ();
@@ -1946,7 +1946,7 @@ private IncrementalMerkleVoucherContainer createWitness(OutputPoint outPoint, Lo
19461946 private void updateWitnesses (List <IncrementalMerkleVoucherContainer > witnessList , long large ,
19471947 int synBlockNum ) throws ItemNotFoundException , BadItemException ,
19481948 InvalidProtocolBufferException , ZksnarkException {
1949- if (!getFullNodeAllowShieldedTransaction ()) {
1949+ if (!getAllowShieldedTransactionApi ()) {
19501950 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
19511951 }
19521952 long start = large ;
@@ -2023,7 +2023,7 @@ private void updateLowWitness(IncrementalMerkleVoucherContainer witness, long bl
20232023 }
20242024
20252025 private void validateInput (OutputPointInfo request ) throws BadItemException , ZksnarkException {
2026- if (!getFullNodeAllowShieldedTransaction ()) {
2026+ if (!getAllowShieldedTransactionApi ()) {
20272027 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
20282028 }
20292029 if (request .getBlockNum () < 0 || request .getBlockNum () > 1000 ) {
@@ -2051,7 +2051,7 @@ private void validateInput(OutputPointInfo request) throws BadItemException, Zks
20512051 public IncrementalMerkleVoucherInfo getMerkleTreeVoucherInfo (OutputPointInfo request )
20522052 throws ItemNotFoundException , BadItemException ,
20532053 InvalidProtocolBufferException , ZksnarkException {
2054- checkFullNodeAllowShieldedTransaction ();
2054+ checkAllowShieldedTransactionApi ();
20552055
20562056 validateInput (request );
20572057 IncrementalMerkleVoucherInfo .Builder result = IncrementalMerkleVoucherInfo .newBuilder ();
@@ -2097,7 +2097,7 @@ public IncrementalMerkleVoucherInfo getMerkleTreeVoucherInfo(OutputPointInfo req
20972097 }
20982098
20992099 public IncrementalMerkleTree getMerkleTreeOfBlock (long blockNum ) throws ZksnarkException {
2100- if (!getFullNodeAllowShieldedTransaction ()) {
2100+ if (!getAllowShieldedTransactionApi ()) {
21012101 throw new ZksnarkException (SHIELDED_ID_NOT_ALLOWED );
21022102 }
21032103 if (blockNum < 0 ) {
@@ -2166,7 +2166,7 @@ public ReceiveNote createReceiveNoteRandom(long value) throws ZksnarkException,
21662166
21672167 public TransactionCapsule createShieldedTransaction (PrivateParameters request )
21682168 throws ContractValidateException , RuntimeException , ZksnarkException , BadItemException {
2169- checkFullNodeAllowShieldedTransaction ();
2169+ checkAllowShieldedTransactionApi ();
21702170
21712171 ZenTransactionBuilder builder = new ZenTransactionBuilder (this );
21722172
@@ -2268,7 +2268,7 @@ public TransactionCapsule createShieldedTransaction(PrivateParameters request)
22682268 public TransactionCapsule createShieldedTransactionWithoutSpendAuthSig (
22692269 PrivateParametersWithoutAsk request )
22702270 throws ContractValidateException , ZksnarkException , BadItemException {
2271- checkFullNodeAllowShieldedTransaction ();
2271+ checkAllowShieldedTransactionApi ();
22722272
22732273 ZenTransactionBuilder builder = new ZenTransactionBuilder (this );
22742274
@@ -2385,7 +2385,7 @@ private void shieldedOutput(List<ReceiveNote> shieldedReceives,
23852385
23862386
23872387 public ShieldedAddressInfo getNewShieldedAddress () throws BadItemException , ZksnarkException {
2388- checkFullNodeAllowShieldedTransaction ();
2388+ checkAllowShieldedTransactionApi ();
23892389
23902390 ShieldedAddressInfo .Builder addressInfo = ShieldedAddressInfo .newBuilder ();
23912391
@@ -2418,15 +2418,15 @@ public ShieldedAddressInfo getNewShieldedAddress() throws BadItemException, Zksn
24182418 }
24192419
24202420 public BytesMessage getSpendingKey () throws ZksnarkException {
2421- checkFullNodeAllowShieldedTransaction ();
2421+ checkAllowShieldedTransactionApi ();
24222422
24232423 byte [] sk = SpendingKey .random ().getValue ();
24242424 return BytesMessage .newBuilder ().setValue (ByteString .copyFrom (sk )).build ();
24252425 }
24262426
24272427 public ExpandedSpendingKeyMessage getExpandedSpendingKey (ByteString spendingKey )
24282428 throws BadItemException , ZksnarkException {
2429- checkFullNodeAllowShieldedTransaction ();
2429+ checkAllowShieldedTransactionApi ();
24302430
24312431 if (Objects .isNull (spendingKey )) {
24322432 throw new BadItemException ("spendingKey is null" );
@@ -2452,7 +2452,7 @@ public ExpandedSpendingKeyMessage getExpandedSpendingKey(ByteString spendingKey)
24522452
24532453 public BytesMessage getAkFromAsk (ByteString ask ) throws
24542454 BadItemException , ZksnarkException {
2455- checkFullNodeAllowShieldedTransaction ();
2455+ checkAllowShieldedTransactionApi ();
24562456
24572457 if (Objects .isNull (ask )) {
24582458 throw new BadItemException ("ask is null" );
@@ -2468,7 +2468,7 @@ public BytesMessage getAkFromAsk(ByteString ask) throws
24682468
24692469 public BytesMessage getNkFromNsk (ByteString nsk ) throws
24702470 BadItemException , ZksnarkException {
2471- checkFullNodeAllowShieldedTransaction ();
2471+ checkAllowShieldedTransactionApi ();
24722472
24732473 if (Objects .isNull (nsk )) {
24742474 throw new BadItemException ("nsk is null" );
@@ -2484,7 +2484,7 @@ public BytesMessage getNkFromNsk(ByteString nsk) throws
24842484
24852485 public IncomingViewingKeyMessage getIncomingViewingKey (byte [] ak , byte [] nk )
24862486 throws ZksnarkException {
2487- checkFullNodeAllowShieldedTransaction ();
2487+ checkAllowShieldedTransactionApi ();
24882488
24892489 byte [] ivk = new byte [32 ]; // the incoming viewing key
24902490 JLibrustzcash .librustzcashCrhIvk (new CrhIvkParams (ak , nk , ivk ));
@@ -2495,7 +2495,7 @@ public IncomingViewingKeyMessage getIncomingViewingKey(byte[] ak, byte[] nk)
24952495 }
24962496
24972497 public DiversifierMessage getDiversifier () throws ZksnarkException {
2498- checkFullNodeAllowShieldedTransaction ();
2498+ checkAllowShieldedTransactionApi ();
24992499
25002500 byte [] d ;
25012501 while (true ) {
@@ -2511,15 +2511,15 @@ public DiversifierMessage getDiversifier() throws ZksnarkException {
25112511 }
25122512
25132513 public BytesMessage getRcm () throws ZksnarkException {
2514- checkFullNodeAllowShieldedTransaction ();
2514+ checkAllowShieldedTransactionApi ();
25152515
25162516 byte [] rcm = Note .generateR ();
25172517 return BytesMessage .newBuilder ().setValue (ByteString .copyFrom (rcm )).build ();
25182518 }
25192519
25202520 public PaymentAddressMessage getPaymentAddress (IncomingViewingKey ivk ,
25212521 DiversifierT d ) throws BadItemException , ZksnarkException {
2522- checkFullNodeAllowShieldedTransaction ();
2522+ checkAllowShieldedTransactionApi ();
25232523
25242524 if (!JLibrustzcash .librustzcashCheckDiversifier (d .getData ())) {
25252525 throw new BadItemException ("d is not valid" );
@@ -2543,7 +2543,7 @@ public PaymentAddressMessage getPaymentAddress(IncomingViewingKey ivk,
25432543
25442544 public SpendResult isSpend (NoteParameters noteParameters ) throws
25452545 ZksnarkException , InvalidProtocolBufferException , BadItemException , ItemNotFoundException {
2546- checkFullNodeAllowShieldedTransaction ();
2546+ checkAllowShieldedTransactionApi ();
25472547
25482548 GrpcAPI .Note note = noteParameters .getNote ();
25492549 byte [] ak = noteParameters .getAk ().toByteArray ();
@@ -2599,7 +2599,7 @@ public SpendResult isSpend(NoteParameters noteParameters) throws
25992599
26002600 public BytesMessage createSpendAuthSig (SpendAuthSigParameters spendAuthSigParameters )
26012601 throws ZksnarkException {
2602- checkFullNodeAllowShieldedTransaction ();
2602+ checkAllowShieldedTransactionApi ();
26032603
26042604 byte [] result = new byte [64 ];
26052605 SpendSigParams spendSigParams = new SpendSigParams (
@@ -2613,7 +2613,7 @@ public BytesMessage createSpendAuthSig(SpendAuthSigParameters spendAuthSigParame
26132613 }
26142614
26152615 public BytesMessage createShieldNullifier (NfParameters nfParameters ) throws ZksnarkException {
2616- checkFullNodeAllowShieldedTransaction ();
2616+ checkAllowShieldedTransactionApi ();
26172617
26182618 byte [] ak = nfParameters .getAk ().toByteArray ();
26192619 byte [] nk = nfParameters .getNk ().toByteArray ();
@@ -2649,7 +2649,7 @@ public BytesMessage createShieldNullifier(NfParameters nfParameters) throws Zksn
26492649
26502650 public BytesMessage getShieldTransactionHash (Transaction transaction )
26512651 throws ContractValidateException , ZksnarkException {
2652- checkFullNodeAllowShieldedTransaction ();
2652+ checkAllowShieldedTransactionApi ();
26532653
26542654 List <Contract > contract = transaction .getRawData ().getContractList ();
26552655 if (contract == null || contract .isEmpty ()) {
@@ -3354,7 +3354,7 @@ private GrpcAPI.DecryptNotes queryNoteByIvk(long startNum, long endNum, byte[] i
33543354 */
33553355 public GrpcAPI .DecryptNotes scanNoteByIvk (long startNum , long endNum ,
33563356 byte [] ivk ) throws BadItemException , ZksnarkException {
3357- checkFullNodeAllowShieldedTransaction ();
3357+ checkAllowShieldedTransactionApi ();
33583358
33593359 return queryNoteByIvk (startNum , endNum , ivk );
33603360 }
@@ -3365,7 +3365,7 @@ public GrpcAPI.DecryptNotes scanNoteByIvk(long startNum, long endNum,
33653365 public GrpcAPI .DecryptNotesMarked scanAndMarkNoteByIvk (long startNum , long endNum ,
33663366 byte [] ivk , byte [] ak , byte [] nk ) throws BadItemException , ZksnarkException ,
33673367 InvalidProtocolBufferException , ItemNotFoundException {
3368- checkFullNodeAllowShieldedTransaction ();
3368+ checkAllowShieldedTransactionApi ();
33693369
33703370 GrpcAPI .DecryptNotes srcNotes = queryNoteByIvk (startNum , endNum , ivk );
33713371 GrpcAPI .DecryptNotesMarked .Builder builder = GrpcAPI .DecryptNotesMarked .newBuilder ();
@@ -3398,7 +3398,7 @@ public GrpcAPI.DecryptNotesMarked scanAndMarkNoteByIvk(long startNum, long endNu
33983398 */
33993399 public GrpcAPI .DecryptNotes scanNoteByOvk (long startNum , long endNum ,
34003400 byte [] ovk ) throws BadItemException , ZksnarkException {
3401- checkFullNodeAllowShieldedTransaction ();
3401+ checkAllowShieldedTransactionApi ();
34023402
34033403 GrpcAPI .DecryptNotes .Builder builder = GrpcAPI .DecryptNotes .newBuilder ();
34043404 if (!(startNum >= 0 && endNum > startNum && endNum - startNum <= 1000 )) {
@@ -3538,7 +3538,7 @@ private void buildShieldedTRC20Output(ShieldedTRC20ParametersBuilder builder,
35383538 public ShieldedTRC20Parameters createShieldedContractParameters (
35393539 PrivateShieldedTRC20Parameters request )
35403540 throws ContractValidateException , ZksnarkException , ContractExeException {
3541- checkFullNodeAllowShieldedTransaction ();
3541+ checkAllowShieldedTransactionApi ();
35423542
35433543 ShieldedTRC20ParametersBuilder builder = new ShieldedTRC20ParametersBuilder ();
35443544
@@ -3675,7 +3675,7 @@ private void buildShieldedTRC20InputWithAK(
36753675 public ShieldedTRC20Parameters createShieldedContractParametersWithoutAsk (
36763676 PrivateShieldedTRC20ParametersWithoutAsk request )
36773677 throws ZksnarkException , ContractValidateException , ContractExeException {
3678- checkFullNodeAllowShieldedTransaction ();
3678+ checkAllowShieldedTransactionApi ();
36793679
36803680 ShieldedTRC20ParametersBuilder builder = new ShieldedTRC20ParametersBuilder ();
36813681 byte [] shieldedTRC20ContractAddress = request .getShieldedTRC20ContractAddress ().toByteArray ();
@@ -3971,7 +3971,7 @@ public DecryptNotesTRC20 scanShieldedTRC20NotesByIvk(
39713971 long startNum , long endNum , byte [] shieldedTRC20ContractAddress ,
39723972 byte [] ivk , byte [] ak , byte [] nk , ProtocolStringList topicsList )
39733973 throws BadItemException , ZksnarkException , ContractExeException {
3974- checkFullNodeAllowShieldedTransaction ();
3974+ checkAllowShieldedTransactionApi ();
39753975
39763976 return queryTRC20NoteByIvk (startNum , endNum ,
39773977 shieldedTRC20ContractAddress , ivk , ak , nk , topicsList );
@@ -4050,7 +4050,7 @@ private Optional<DecryptNotesTRC20.NoteTx> getNoteTxFromLogListByOvk(
40504050 public DecryptNotesTRC20 scanShieldedTRC20NotesByOvk (long startNum , long endNum ,
40514051 byte [] ovk , byte [] shieldedTRC20ContractAddress , ProtocolStringList topicsList )
40524052 throws ZksnarkException , BadItemException {
4053- checkFullNodeAllowShieldedTransaction ();
4053+ checkAllowShieldedTransactionApi ();
40544054
40554055 DecryptNotesTRC20 .Builder builder = DecryptNotesTRC20 .newBuilder ();
40564056 if (!(startNum >= 0 && endNum > startNum && endNum - startNum <= 1000 )) {
@@ -4113,7 +4113,7 @@ private byte[] getShieldedTRC20Nullifier(GrpcAPI.Note note, long pos, byte[] ak,
41134113
41144114 public GrpcAPI .NullifierResult isShieldedTRC20ContractNoteSpent (NfTRC20Parameters request ) throws
41154115 ZksnarkException , ContractExeException {
4116- checkFullNodeAllowShieldedTransaction ();
4116+ checkAllowShieldedTransactionApi ();
41174117
41184118 return GrpcAPI .NullifierResult .newBuilder ()
41194119 .setIsSpent (isShieldedTRC20NoteSpent (request .getNote (),
@@ -4236,7 +4236,7 @@ public byte[] getShieldedContractScalingFactor(byte[] contractAddress)
42364236 public BytesMessage getTriggerInputForShieldedTRC20Contract (
42374237 ShieldedTRC20TriggerContractParameters request )
42384238 throws ZksnarkException , ContractValidateException {
4239- checkFullNodeAllowShieldedTransaction ();
4239+ checkAllowShieldedTransactionApi ();
42404240
42414241 ShieldedTRC20Parameters shieldedTRC20Parameters = request .getShieldedTRC20Parameters ();
42424242 List <BytesMessage > spendAuthoritySignature = request .getSpendAuthoritySignatureList ();
0 commit comments