From 326756b90fc1597a809702985e796e7bc201e31a Mon Sep 17 00:00:00 2001 From: hanlinbo123 <152951473+hanlinbo123@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:52:25 +0800 Subject: [PATCH] (ClientWrapper): add block transactions details (#29) * (ClientWrapper): add block transactions details (BCOSDriver): assemble block transactions details * (ClientWrapper): add block transactions details (BCOSDriver): assemble block transactions details * (BCOSStubCallContractIntegTest): update BCOSStubCallContractIntegTest and Formatted code --------- Co-authored-by: lbhan2 --- build.gradle | 2 +- .../BCOSStubCallContractIntegTest.java | 7 +- .../wecross/stub/bcos3/BCOSConnection.java | 3 +- .../webank/wecross/stub/bcos3/BCOSDriver.java | 123 +++++++++++++++++- .../bcos3/client/AbstractClientWrapper.java | 5 +- .../stub/bcos3/client/ClientBlockManager.java | 2 +- .../stub/bcos3/client/ClientWrapper.java | 2 +- .../stub/bcos3/contract/BlockUtility.java | 2 +- .../stub/bcos3/BlockManagerImplMock.java | 2 +- .../bcos3/client/ClientWrapperImplMock.java | 3 +- .../client/ClientWrapperTxVerifyMock.java | 2 +- .../ClientWrapperWithExceptionMock.java | 3 +- 12 files changed, 140 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 969064f..0a3d44d 100644 --- a/build.gradle +++ b/build.gradle @@ -74,7 +74,7 @@ List logger = [ dependencies { compile logger - implementation ('com.webank:wecross-java-stub:1.3.2-SNAPSHOT') { + implementation ('com.webank:wecross-java-stub:1.4.0-SNAPSHOT') { exclude group: "io.netty" exclude group: 'org.fisco-bcos', module: 'tcnative' } diff --git a/src/integTest/java/com/webank/wecross/stub/bcos3/integration/BCOSStubCallContractIntegTest.java b/src/integTest/java/com/webank/wecross/stub/bcos3/integration/BCOSStubCallContractIntegTest.java index 5db911b..741545c 100644 --- a/src/integTest/java/com/webank/wecross/stub/bcos3/integration/BCOSStubCallContractIntegTest.java +++ b/src/integTest/java/com/webank/wecross/stub/bcos3/integration/BCOSStubCallContractIntegTest.java @@ -8,6 +8,7 @@ import com.webank.wecross.stub.Path; import com.webank.wecross.stub.ResourceInfo; import com.webank.wecross.stub.StubConstant; +import com.webank.wecross.stub.Transaction; import com.webank.wecross.stub.TransactionContext; import com.webank.wecross.stub.TransactionRequest; import com.webank.wecross.stub.bcos3.AsyncBfsService; @@ -232,9 +233,9 @@ public void getBlockHeaderIntegTest() throws InterruptedException { driver.asyncGetBlock(blockNumber, false, connection, (e2, block) -> { assertNull(e2); BlockHeader blockHeader = block.getBlockHeader(); - List transactionsHashes = block.getTransactionsHashes(); - assertEquals(1, transactionsHashes.size()); - assertTrue(Objects.nonNull(transactionsHashes.get(0))); + List transactionsWithDetail = block.getTransactionsWithDetail(); + assertEquals(1, transactionsWithDetail.size()); + assertTrue(Objects.nonNull(transactionsWithDetail.get(0))); assertTrue(block.getRawBytes().length > 1); assertTrue(Objects.nonNull(blockHeader)); assertTrue(Objects.nonNull(blockHeader.getHash())); diff --git a/src/main/java/com/webank/wecross/stub/bcos3/BCOSConnection.java b/src/main/java/com/webank/wecross/stub/bcos3/BCOSConnection.java index f6a21ed..807f84b 100644 --- a/src/main/java/com/webank/wecross/stub/bcos3/BCOSConnection.java +++ b/src/main/java/com/webank/wecross/stub/bcos3/BCOSConnection.java @@ -474,8 +474,7 @@ public void handleAsyncGetBlockRequest(Request request, Callback callback) { Response response = new Response(); try { BigInteger blockNumber = new BigInteger(request.getData()); - BcosBlock.Block block = clientWrapper.getBlockByNumber(blockNumber.longValue()); - + BcosBlock.Block block = clientWrapper.getBlockByNumber(blockNumber.longValue(), false); try { BcosBlockHeader.BlockHeader blockHeader = clientWrapper.getBlockHeaderByNumber(blockNumber.longValue()); diff --git a/src/main/java/com/webank/wecross/stub/bcos3/BCOSDriver.java b/src/main/java/com/webank/wecross/stub/bcos3/BCOSDriver.java index 172c9b5..878e786 100644 --- a/src/main/java/com/webank/wecross/stub/bcos3/BCOSDriver.java +++ b/src/main/java/com/webank/wecross/stub/bcos3/BCOSDriver.java @@ -35,10 +35,13 @@ import java.nio.ByteBuffer; import java.security.InvalidParameterException; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.tuple.ImmutablePair; import org.fisco.bcos.sdk.jni.utilities.tx.TransactionBuilderJniObj; import org.fisco.bcos.sdk.jni.utilities.tx.TxPair; import org.fisco.bcos.sdk.v3.client.protocol.model.JsonTransactionResponse; +import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock; import org.fisco.bcos.sdk.v3.client.protocol.response.Call; import org.fisco.bcos.sdk.v3.codec.ContractCodec; import org.fisco.bcos.sdk.v3.codec.FunctionEncoderInterface; @@ -1133,7 +1136,21 @@ public void asyncGetBlock( callback.onResponse(new Exception(response.getErrorMessage()), null); } else { try { - Block block = BlockUtility.convertToBlock(response.getData(), false); + Block block = + BlockUtility.convertToBlock(response.getData(), onlyHeader); + if (block.getTransactionsHashes().isEmpty()) { + BcosBlock.Block bcosBlock = + ObjectMapperFactory.getObjectMapper() + .readValue( + response.getData(), BcosBlock.Block.class); + for (int i = 0; i < bcosBlock.getTransactionObject().size(); i++) { + BcosBlock.TransactionObject transactionObject = + (BcosBlock.TransactionObject) + bcosBlock.getTransactions().get(i); + assembleJsonTransactionResponse( + blockNumber, transactionObject, connection, block); + } + } if (blockVerifierString != null && blockNumber != 0) { BCOSBlockHeader bcosBlockHeader = (BCOSBlockHeader) block.blockHeader; @@ -1211,6 +1228,110 @@ public void asyncGetTransaction( }); } + private void assembleJsonTransactionResponse( + long blockNumber, + JsonTransactionResponse jsonTransactionResponse, + Connection connection, + Block block) + throws Exception { + byte[] txBytes = + ObjectMapperFactory.getObjectMapper().writeValueAsBytes(jsonTransactionResponse); + + String methodId; + String input; + String path; + String resource; + String xaTransactionID = "0"; + String transactionHash = jsonTransactionResponse.getHash(); + Transaction transaction = new Transaction(); + transaction.setTxBytes(txBytes); + transaction.setAccountIdentity(jsonTransactionResponse.getFrom()); + transaction.setTransactionByProxy(true); + transaction.getTransactionResponse().setHash(transactionHash); + transaction.getTransactionResponse().setBlockNumber(blockNumber); + transaction.getTransactionResponse().setTimestamp(jsonTransactionResponse.getImportTime()); + String proxyInput = jsonTransactionResponse.getInput(); + if (proxyInput.startsWith( + Hex.toHexStringWithPrefix( + functionEncoder.buildMethodId(FunctionUtility.ProxySendTXMethod)))) { + Tuple3 proxyResult = + FunctionUtility.getSendTransactionProxyWithoutTxIdFunctionInput( + proxyInput, isWasm); + resource = proxyResult.getValue2(); + input = Numeric.toHexString(proxyResult.getValue3()); + methodId = input.substring(0, FunctionUtility.MethodIDWithHexPrefixLength); + if (logger.isDebugEnabled()) { + logger.debug(" resource: {}, methodId: {}", resource, methodId); + } + } else if (proxyInput.startsWith( + Hex.toHexStringWithPrefix( + functionEncoder.buildMethodId( + FunctionUtility.ProxySendTransactionTXMethod)))) { + Tuple6 proxyInputResult = + FunctionUtility.getSendTransactionProxyFunctionInput(proxyInput, isWasm); + xaTransactionID = proxyInputResult.getValue2(); + path = proxyInputResult.getValue4(); + resource = Path.decode(path).getResource(); + String methodSig = proxyInputResult.getValue5(); + methodId = Hex.toHexString(functionEncoder.buildMethodId(methodSig)); + if (logger.isDebugEnabled()) { + logger.debug("path: {}, methodSig: {}, methodId: {}", path, methodSig, methodId); + } + } else { + // transaction not send by proxy + transaction.setTransactionByProxy(false); + block.getTransactionsWithDetail().add(transaction); + return; + } + transaction + .getTransactionRequest() + .getOptions() + .put(StubConstant.XA_TRANSACTION_ID, xaTransactionID); + transaction.setResource(resource); + // query ABI + String finalMethodId = methodId; + CompletableFuture future = new CompletableFuture<>(); + asyncBfsService.queryABI( + resource, + this, + connection, + (queryABIException, abi) -> { + if (Objects.nonNull(queryABIException)) { + logger.error( + "Query abi failed, transactionHash: {}, e: ", + transactionHash, + queryABIException); + future.completeExceptionally(queryABIException); + } + future.complete(abi); + }); + try { + String abi = future.get(10, TimeUnit.SECONDS); + ABIDefinition function = + abiDefinitionFactory + .loadABI(abi) + .getMethodIDToFunctions() + .get(ByteBuffer.wrap(Hex.decode(finalMethodId))); + if (Objects.isNull(function)) { + logger.warn( + "Maybe abi is upgraded, Load function failed, methodId: {}", finalMethodId); + } else { + transaction.getTransactionRequest().setMethod(function.getName()); + } + } catch (Exception e) { + logger.error( + "Maybe Query abi failed, transactionHash: {},resource:{} MethodId: {},e:", + transactionHash, + resource, + finalMethodId, + e); + } + block.getTransactionsWithDetail().add(transaction); + if (logger.isTraceEnabled()) { + logger.trace("blockNumber: {}, block: {}", blockNumber, block); + } + } + private void assembleTransaction( String transactionHash, JsonTransactionResponse jsonTransactionResponse, diff --git a/src/main/java/com/webank/wecross/stub/bcos3/client/AbstractClientWrapper.java b/src/main/java/com/webank/wecross/stub/bcos3/client/AbstractClientWrapper.java index 2c73176..cf27d63 100644 --- a/src/main/java/com/webank/wecross/stub/bcos3/client/AbstractClientWrapper.java +++ b/src/main/java/com/webank/wecross/stub/bcos3/client/AbstractClientWrapper.java @@ -29,9 +29,10 @@ public AbstractClientWrapper(Client client) { } @Override - public BcosBlock.Block getBlockByNumber(long blockNumber) throws IOException { + public BcosBlock.Block getBlockByNumber(long blockNumber, boolean onlyTxHash) + throws IOException { BcosBlock blockByNumber = - getClient().getBlockByNumber(BigInteger.valueOf(blockNumber), false, true); + getClient().getBlockByNumber(BigInteger.valueOf(blockNumber), false, onlyTxHash); return blockByNumber.getBlock(); } diff --git a/src/main/java/com/webank/wecross/stub/bcos3/client/ClientBlockManager.java b/src/main/java/com/webank/wecross/stub/bcos3/client/ClientBlockManager.java index 0ab5457..777d8b6 100644 --- a/src/main/java/com/webank/wecross/stub/bcos3/client/ClientBlockManager.java +++ b/src/main/java/com/webank/wecross/stub/bcos3/client/ClientBlockManager.java @@ -20,7 +20,7 @@ public long getBlockNumber() throws IOException { } public Block getBlock(long blockNumber) throws IOException { - BcosBlock.Block block = clientWrapper.getBlockByNumber(blockNumber); + BcosBlock.Block block = clientWrapper.getBlockByNumber(blockNumber, true); return BlockUtility.convertToBlock(block, false); } diff --git a/src/main/java/com/webank/wecross/stub/bcos3/client/ClientWrapper.java b/src/main/java/com/webank/wecross/stub/bcos3/client/ClientWrapper.java index fcdd462..e1d6b96 100644 --- a/src/main/java/com/webank/wecross/stub/bcos3/client/ClientWrapper.java +++ b/src/main/java/com/webank/wecross/stub/bcos3/client/ClientWrapper.java @@ -12,7 +12,7 @@ /** Wrapper interface for JavaSDK */ public interface ClientWrapper { - BcosBlock.Block getBlockByNumber(long blockNumber) throws IOException; + BcosBlock.Block getBlockByNumber(long blockNumber, boolean onlyTxHash) throws IOException; BcosBlockHeader.BlockHeader getBlockHeaderByNumber(long blockNumber) throws IOException; diff --git a/src/main/java/com/webank/wecross/stub/bcos3/contract/BlockUtility.java b/src/main/java/com/webank/wecross/stub/bcos3/contract/BlockUtility.java index fbb54dc..bcba1f8 100644 --- a/src/main/java/com/webank/wecross/stub/bcos3/contract/BlockUtility.java +++ b/src/main/java/com/webank/wecross/stub/bcos3/contract/BlockUtility.java @@ -85,7 +85,7 @@ public static Block convertToBlock(BcosBlock.Block block, boolean onlyHeader) /** tx list */ List txs = new ArrayList<>(); - if (!onlyHeader) { + if (!onlyHeader && !block.getTransactionHashes().isEmpty()) { for (int i = 0; i < block.getTransactions().size(); i++) { BcosBlock.TransactionHash transactionHash = (BcosBlock.TransactionHash) block.getTransactions().get(i); diff --git a/src/test/java/com/webank/wecross/stub/bcos3/BlockManagerImplMock.java b/src/test/java/com/webank/wecross/stub/bcos3/BlockManagerImplMock.java index 98b6cf0..16d7554 100644 --- a/src/test/java/com/webank/wecross/stub/bcos3/BlockManagerImplMock.java +++ b/src/test/java/com/webank/wecross/stub/bcos3/BlockManagerImplMock.java @@ -24,7 +24,7 @@ public long getBlockNumber() throws IOException { public byte[] getBlockHeader(long l) { try { - BcosBlock.Block block = clientWrapper.getBlockByNumber(l); + BcosBlock.Block block = clientWrapper.getBlockByNumber(l, true); BlockHeader blockHeader = BlockUtility.convertToBlockHeader(block); return ObjectMapperFactory.getObjectMapper().writeValueAsBytes(blockHeader); } catch (IOException e) { diff --git a/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperImplMock.java b/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperImplMock.java index 6b85b6d..3e94d3f 100644 --- a/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperImplMock.java +++ b/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperImplMock.java @@ -60,7 +60,8 @@ public ClientWrapperImplMock() { } @Override - public BcosBlock.Block getBlockByNumber(long blockNumber) throws IOException { + public BcosBlock.Block getBlockByNumber(long blockNumber, boolean onlyTxHash) + throws IOException { String blockJson = "{\"consensusWeights\":[1,1],\"extraData\":\"0x\",\"gasUsed\":\"1114278\",\"hash\":\"0xc403e7f3255c7822e86075c1b97c4de359a511030794af8f8c74692e1b494e03\",\"number\":9,\"parentInfo\":[{\"blockHash\":\"0x84a1387f18dc03ee329050715819566d8962225b8cee25ce5db5f2d863f3ec3a\",\"blockNumber\":8}],\"receiptsRoot\":\"0x121775bcc0ef53db7fd984d012d7a855990bd873f493564e5de0b3b43745e297\",\"sealer\":0,\"sealerList\":[\"0x97af395f31cd52868162c790c2248e23f65c85a64cd0581d323515f6afffc0138279292a55f7bd706f8f1602f142b12a3407a45334eb0cf7daeb064dcec69369\",\"0xffa9aa23918afcfa5c20a07177e83731c46f153b3ce33b98cb3c4b61c767d06296ef9c1b7f7c6737c3077a6ec61c1a86d665475629cecd1c209b3f9a3b8688dc\"],\"signatureList\":[{\"sealerIndex\":0,\"signature\":\"0x01d116a8e7faaf8822911ebe97261b80653bff3082077a04efc1f758a0b290eb1abc413f8c429bdc280a1ece318607cf614eaa7c2eb6751845a2bec1a798495900\"},{\"sealerIndex\":1,\"signature\":\"0x38ad518cfab1c1b830f4f26b99c75c87860320b8ef02672720cf9c4529ca379c75d642636490c7dcd9abc7d6a1f5280ce4d04aae6c4669f66b03bbe9803f2d5a01\"}],\"stateRoot\":\"0x71eb54a4996de36cb36ba52136f9a2e87f6c40627b3ab9c87ca9fb641073f013\",\"timestamp\":1667550861150,\"transactions\":[\"0x4803a0eee41c3d6f585913071cdaca955f70b023120648143373102c83e39bf5\",\"0xa89c07b85efeaeb602ad688895dc5f7fed29b26c2c5ecae80099a4f9c1c8f4c1\",\"0xddc1b82bb2a76311984f5ad31a5df3395ae0eb2d1985e2dbfdede77d13ffe21f\",\"0x724792b07d72938afaa7d1af271bc249b0a6ce529ed8796c5f7d8a74e5fc5110\",\"0x41e115d3b06ecdf99f3406102f6a9aac93efdbd0a9d4f6fae134465845190ba0\",\"0xcdc7bc7df2c8206f8ab3a95a1a26cababff07f479e786432dab29e35d027703d\",\"0xe4c739590938bf4169a8139019403c2ccfcef3996cfbf71638e16d38a2988ff4\",\"0xbc34f391fb114d3c2e58c79d2d53ee94049e1b8826f808cd1a3df15f73603931\",\"0xf4d9a1b1d825afc64cf51e2e67ab00181d3a26532eb3996eeb9f0f6ce794fc31\",\"0x37482c537f48186adf5b91e3bc8f7461cf93dd7ef8050d4af13822e327d3b966\",\"0xe0a7cb5b1203086e78d2e3e0669397ec3efb35d74b7184f8bbd39e3944cbb502\",\"0x3c90977952af6b890febe7a726688d33c9f2179f65d90a0cd345dbb049f3dee1\",\"0xc66777b2d66b96ea625deb32d543bbbd66327b9b1ffd149c8203ad99d3fde2bf\",\"0x10e77e7b03501167c7577e7d0d31aa4fe7074b4578263e6b9208deb23d2d960d\",\"0xf3421699230b54b0b1b863b924d8918f033782721269e0f087769e0f4690a3d3\",\"0x0c36ab2720599546cbab1a856f30ac3f083af6c145c31d64ff2a30ad6a0a2aac\",\"0xf6f14d0cd1d33b85426375cbda176d13cf48dcded95cc0c0aafe34f57d38b5b4\",\"0xf116212394b43e8bb2023e362a9607c5262c199b8d9128cb04031a460503c431\",\"0xa5014d2fe03ad786ec32bd76739d0d53f50fb89344b52fadb1455a3bb46a80e3\",\"0x54533f6dc61ea9b7197cec3d25c3a2268acab81379d0e7f9ba656d8036210e96\",\"0xadff4d2a66d3ffc1cc2f9b3e8e55c13d2acc6ae478bf64978425ef08663f43d0\",\"0x9d30feb6b23b8e35df695fd45ddbaccf9e2adc5f41e680f067f8f7fa60ad999d\",\"0x44d2388bf03738c3ed0fdbab06cc12fe1735b197c7f7cba20729e72d22038392\",\"0x0e1ad907103a6710e15be99a18a74e8a81c2481fb2e01f3dfc08cd7c00156c72\",\"0xf7269392ef937ba492316a309a7a908a89dac9f64abedb270e5d441778c8e11b\",\"0xa6c5bc68e885a05e18ec4df4b7bea4ae0aa34a1aca8a74280b3a38ac7eddd1e9\",\"0x8cfae1560598c657d276f7a798dea685ef6b29e504b6bdddb36a404ecd90723b\",\"0x793fe55d71ab9a098390804491d66e4fc3772b43d57b83ea632417451a76d5c7\",\"0x6d1e3d3c4e6c1186e2231285883b21f39de0ca1419ffe250e299ac2f9cf31c82\",\"0x4bea8a08c57970258b73ef49ca7b124ac8299a1a92efb69bd4078a0ca2ce3f11\",\"0x12ad556d00af6fb3799689e34ca6adcad7f70a281c7a8fd2cfd3465366117461\",\"0x814b439a52921d7fe5c57be945491cc31393c4cd4b43b688d116192bdbbee596\",\"0xd25b9fff6c204075f517acd7fee165cb04782352501349939ed8b9aa88a365ae\",\"0x4a7a6cfb853e0c030c412fb8d9cbc457a1568a7fda3a8fb92030de1806e18ac0\",\"0xa53ed2ea96cbb1327c2b2cb40c9feb9d8727d36e80ed9a236f594692e087ff96\",\"0xe673b20420c22e26e9997b5fa73ca2e2a321d9e7e04280ba16c39256ed9c6a8c\",\"0xa6b41955b9b1ee1340244d2dba5e648c7ce16a525cdeb43e7f8c9df82ecd304b\",\"0xdad5f66e4799b16a594d23adeb02b4059a94b5449ce319facc4044d38cdff354\",\"0x718d01dbefb0d4a944e86be2f09de1fee4718544b0564561adbe5a998a556e72\",\"0x74d480c91d838a62cd77109ae6aa5dc74a661541030b8ed2d9479050eaa6a2ef\",\"0xeb23bc649a138b6d1d8a79eb11074275631382fec7151e4b0926bc3515bb98e3\",\"0x2093c00678e4fd1c2ae653677c20e0a7338717f6130cf357336fcb920cd3db6f\",\"0x970a8e6ef5a3ba1ece44b87747730e1269b1b1d7a3b574914c9015841f2916fe\",\"0x58d1dce7c4ad2fad74748adcc8d25e57fe0ff0dae62fb6c5dd699f891fb556ca\",\"0x536f673c131e19f92735e0f77cb669efdfb04f15e9ee5095eec1ea290ae97548\",\"0x272765b69b9d400c3f3d90906f0ebcdc2016e67113e3bf670ee9e98d38a39de3\",\"0x96a9240afb7803cb91f6280f2ab9bdc4bbc7dee89901ff099a0a27049ad4de16\",\"0x91c80eaac79f294180a12e6def545837cb01df6ce2344a603b1eaf33c5bd6d74\",\"0xb6ed9766531166d245c6e155cf5def013bc12cf5639bed291ca2cea681a508cb\",\"0x339967cc6b48f27c983b704ca3217385f1759b539fc04244ed639be9d71d428c\",\"0xf48a6d79eeefa43e6e8d8c319f53f689431725d432a058f8040fee9c9dfcdf8d\"],\"txsRoot\":\"0xaddb42e1db5ef2625c610506b46c745d2418263463b5beb537cf5c10e8d387dd\",\"version\":50331649}"; ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper(); diff --git a/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperTxVerifyMock.java b/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperTxVerifyMock.java index 59d556b..8fd0b6f 100644 --- a/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperTxVerifyMock.java +++ b/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperTxVerifyMock.java @@ -30,7 +30,7 @@ public ClientWrapperTxVerifyMock() throws JsonProcessingException { } @Override - public BcosBlock.Block getBlockByNumber(long blockNumber) { + public BcosBlock.Block getBlockByNumber(long blockNumber, boolean onlyTxHash) { return block; } diff --git a/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperWithExceptionMock.java b/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperWithExceptionMock.java index 0d00909..568fdf8 100644 --- a/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperWithExceptionMock.java +++ b/src/test/java/com/webank/wecross/stub/bcos3/client/ClientWrapperWithExceptionMock.java @@ -12,7 +12,8 @@ public class ClientWrapperWithExceptionMock extends ClientWrapperImplMock { @Override - public BcosBlock.Block getBlockByNumber(long blockNumber) throws IOException { + public BcosBlock.Block getBlockByNumber(long blockNumber, boolean onlyTxHash) + throws IOException { throw new IOException(" IOException"); }