@@ -38,6 +38,7 @@ public class ContractLinkage004 {
3838 String contractName ;
3939 String code ;
4040 String abi ;
41+ Long currentFee ;
4142
4243 ECKey ecKey1 = new ECKey (Utils .getRandom ());
4344 byte [] linkage004Address = ecKey1 .getAddress ();
@@ -56,7 +57,7 @@ public void beforeClass() {
5657 .usePlaintext (true )
5758 .build ();
5859 blockingStubFull = WalletGrpc .newBlockingStub (channelFull );
59- Assert .assertTrue (PublicMethed .sendcoin (linkage004Address ,20000000L ,fromAddress ,
60+ Assert .assertTrue (PublicMethed .sendcoin (linkage004Address ,2000000000000L ,fromAddress ,
6061 testKey003 ,blockingStubFull ));
6162 Assert .assertTrue (PublicMethed .freezeBalance (linkage004Address ,1000000L ,
6263 3 ,linkage004Key ,blockingStubFull ));
@@ -153,6 +154,8 @@ public void getTransactionInfoById() {
153154 logger .info ("This time txid is " + txid );
154155
155156 Optional <TransactionInfo > infoById = PublicMethed .getTransactionInfoById (txid ,blockingStubFull );
157+ currentFee = infoById .get ().getFee ();
158+ logger .info ("current fee is " + currentFee .toString ());
156159 Assert .assertTrue (infoById .isPresent ());
157160 Assert .assertTrue (infoById .get ().getFee () > 0 );
158161 //logger.info(Integer.toString(infoById.get().getResultValue()));
@@ -163,7 +166,7 @@ public void getTransactionInfoById() {
163166 //Assert.assertTrue(infoById.get().getReceipt().getStorageDelta() > 200);
164167 }
165168
166- @ Test (enabled = false )
169+ @ Test (enabled = true )
167170 public void testFeeLimitIsTooSmall () {
168171 Account account = PublicMethed .queryAccount (linkage004Address ,blockingStubFull );
169172 Long maxFeeLimit = 0L ;
@@ -176,7 +179,7 @@ public void testFeeLimitIsTooSmall() {
176179 Assert .assertTrue (infoById .get ().getResultValue () == 1 );
177180
178181 //When the fee limit is only short with 1 sun.
179- maxFeeLimit = 14082200L - 1L ;
182+ maxFeeLimit = currentFee - 1L ;
180183 txid = PublicMethed .deployContractAndGetTransactionInfoById (contractName ,abi ,code ,
181184 "" ,maxFeeLimit , 0L , 50 ,null ,linkage004Key ,linkage004Address ,blockingStubFull );
182185 logger .info ("testFeeLimitIsTooSmall, the txid is " + txid );
@@ -185,7 +188,7 @@ public void testFeeLimitIsTooSmall() {
185188 Assert .assertTrue (infoById .get ().getResultValue () == 1 );
186189
187190 //When the fee limit is just ok.
188- maxFeeLimit = 14082200L ;
191+ maxFeeLimit = currentFee ;
189192 txid = PublicMethed .deployContractAndGetTransactionInfoById (contractName ,abi ,code ,
190193 "" ,maxFeeLimit , 0L , 50 ,null ,linkage004Key ,linkage004Address ,blockingStubFull );
191194 logger .info ("testFeeLimitIsTooSmall, the txid is " + txid );
0 commit comments