Skip to content

Commit bebc5b3

Browse files
authored
fix(crypto): throw exception if system shielded tx is not supported. (#6514)
* fix: throw exception if system shielded tx is not supported. * update the exception msg.
1 parent 6ffedb4 commit bebc5b3

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

framework/src/main/java/org/tron/core/db/Manager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,14 +874,13 @@ public boolean pushTransaction(final TransactionCapsule trx)
874874

875875
if (isShieldedTransaction(trx.getInstance()) && !chainBaseManager.getDynamicPropertiesStore()
876876
.supportShieldedTransaction()) {
877-
return false;
877+
throw new ContractValidateException("ShieldedTransferContract is not supported.");
878878
}
879879

880880
if (isExchangeTransaction(trx.getInstance())) {
881881
throw new ContractValidateException("ExchangeTransactionContract is rejected");
882882
}
883883

884-
885884
pushTransactionQueue.add(trx);
886885
Metrics.gaugeInc(MetricKeys.Gauge.MANAGER_QUEUE, 1,
887886
MetricLabels.Gauge.QUEUE_QUEUED);

framework/src/test/java/org/tron/core/db/ManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public void transactionTest() {
320320
dbManager.pushTransaction(trans0);
321321
dbManager.pushTransaction(trans);
322322
} catch (Exception e) {
323-
Assert.assertTrue(e instanceof TaposException);
323+
Assert.assertTrue(e instanceof ContractValidateException);
324324
}
325325
dbManager.rePush(trans0);
326326
ReflectUtils.invokeMethod(dbManager,"filterOwnerAddress",

framework/src/test/java/org/tron/core/zksnark/ShieldedReceiveTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,9 @@ public void testBroadcastBeforeAllowZksnark()
314314
transactionCap = TransactionUtils.addTransactionSign(transactionCap.getInstance(),
315315
ADDRESS_ONE_PRIVATE_KEY, chainBaseManager.getAccountStore());
316316
try {
317-
boolean res = dbManager.pushTransaction(transactionCap);
318-
Assert.assertFalse(res);
317+
dbManager.pushTransaction(transactionCap);
319318
} catch (Exception e) {
320-
Assert.fail(e.getMessage());
319+
Assert.assertTrue(e instanceof ContractValidateException);
321320
}
322321
}
323322

0 commit comments

Comments
 (0)