Skip to content

Commit 14db3bc

Browse files
modify test case
1 parent 217b4ca commit 14db3bc

File tree

3 files changed

+5
-22
lines changed

3 files changed

+5
-22
lines changed

dapp-chain/side-chain/src/test/java/stest/tron/wallet/common/client/utils/PublicMethed.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public static GrpcAPI.Return broadcastTransaction(Transaction transaction,
410410
public static String triggerContract(byte[] contractAddress, String method, String argsStr,
411411
Boolean isHex, long callValue, long feeLimit, byte[] ownerAddress,
412412
String priKey, WalletGrpc.WalletBlockingStub blockingStubFull){
413-
return triggerContractSideChain(contractAddress, method, argsStr, isHex, callValue, feeLimit,
413+
return triggerContract(contractAddress, method, argsStr, isHex, callValue, feeLimit,
414414
"0", 0, ownerAddress, priKey, blockingStubFull);
415415

416416
}
@@ -528,13 +528,7 @@ public static String triggerContractSideChain(
528528
String priKey, WalletGrpc.WalletBlockingStub blockingStubFull
529529
){
530530
//LOADCONF
531-
532-
final String mainGateWayAddress = Configuration.getByPath("testng.conf")
533-
.getString("gateway_address.key1");
534-
535-
byte[] mainGateWay = WalletClient.decodeFromBase58Check(mainGateWayAddress);
536-
537-
531+
byte[] mainGateWay = PublicMethed.getMaingatewayByteAddr();
538532

539533
Wallet.setAddressPreFixByte(CommonConstant.ADD_PRE_FIX_BYTE_MAINNET);
540534
ECKey temKey = null;

dapp-chain/side-chain/src/test/java/stest/tron/wallet/common/client/utils/TransactionUtilsForDailybuild.java

-12
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,6 @@ public static Transaction sign(Transaction transaction, ECKey myKey, byte[] chai
182182

183183
public static Transaction sign(Transaction transaction, ECKey myKey) {
184184
ByteString lockSript = ByteString.copyFrom(myKey.getAddress());
185-
Transaction.Builder transactionBuilderSigned = transaction.toBuilder();
186-
187-
byte[] hash = Sha256Hash.hash(transaction.getRawData().toByteArray());
188-
List<Contract> listContract = transaction.getRawData().getContractList();
189-
for (int i = 0; i < listContract.size(); i++) {
190-
ECDSASignature signature = myKey.sign(hash);
191-
ByteString bsSign = ByteString.copyFrom(signature.toByteArray());
192-
transactionBuilderSigned.addSignature(
193-
bsSign);//Each contract may be signed with a different private key in the future.
194-
}
195-
196-
transaction = transactionBuilderSigned.build();
197185
boolean isSideChain = false;
198186
return TransactionUtils
199187
.sign(transaction, myKey, Wallet.decodeFromBase58Check(mainGateWay), isSideChain);

dapp-chain/side-chain/src/test/java/stest/tron/wallet/witness/WalletTestWitness001.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.tron.api.GrpcAPI;
1818
import org.tron.api.GrpcAPI.NumberMessage;
1919
import org.tron.api.GrpcAPI.Return;
20+
import org.tron.api.GrpcAPI.TransactionExtention;
2021
import org.tron.api.WalletGrpc;
2122
import org.tron.common.crypto.ECKey;
2223
import org.tron.common.utils.ByteArray;
@@ -175,8 +176,8 @@ public Boolean voteWitness(HashMap<String, String> witness, byte[] addRess, Stri
175176
}
176177

177178
Contract.VoteWitnessContract contract = builder.build();
178-
179-
Transaction transaction = blockingStubFull.voteWitnessAccount(contract);
179+
TransactionExtention transactionExtention = blockingStubFull.voteWitnessAccount2(contract);
180+
Transaction transaction = transactionExtention.getTransaction();
180181
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
181182
logger.info("transaction == null");
182183
return false;

0 commit comments

Comments
 (0)