diff --git a/source/base/pom.xml b/source/base/pom.xml
index 79b24a08..ab04450b 100644
--- a/source/base/pom.xml
+++ b/source/base/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
base
diff --git a/source/binary-proto/pom.xml b/source/binary-proto/pom.xml
index 1f59cd50..916dffce 100644
--- a/source/binary-proto/pom.xml
+++ b/source/binary-proto/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
binary-proto
diff --git a/source/consensus/consensus-bftsmart/pom.xml b/source/consensus/consensus-bftsmart/pom.xml
index b494c5bf..7c28ce70 100644
--- a/source/consensus/consensus-bftsmart/pom.xml
+++ b/source/consensus/consensus-bftsmart/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
consensus
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
consensus-bftsmart
diff --git a/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java b/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java
index 48c85f79..297ccebe 100644
--- a/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java
+++ b/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java
@@ -359,33 +359,107 @@ public class BftsmartNodeServer extends DefaultRecoverable implements NodeServer
* Used by consensus write phase, pre compute new block hash
*
*/
+// public BatchAppResultImpl preComputeAppHash(byte[][] commands) {
+// String batchId = messageHandle.beginBatch(realmName);
+// List> asyncFutureLinkedList = new ArrayList<>(commands.length);
+// List responseLinkedList = new ArrayList<>();
+// try {
+// int msgId = 0;
+// for (byte[] txContent : commands) {
+// AsyncFuture asyncFuture = messageHandle.processOrdered(msgId++, txContent, realmName, batchId);
+// asyncFutureLinkedList.add(asyncFuture);
+// }
+// StateSnapshot stateSnapshot = messageHandle.completeBatch(realmName, batchId);
+// byte[] blockHashBytes = stateSnapshot.getSnapshot();
+//
+// for (int i = 0; i< asyncFutureLinkedList.size(); i++) {
+// responseLinkedList.add(asyncFutureLinkedList.get(i).get());
+// }
+//
+//
+// return new BatchAppResultImpl(responseLinkedList, blockHashBytes, batchId);
+//
+// } catch (Exception e) {
+// // todo 需要处理应答码 404
+// LOGGER.error("Error occurred while processing ordered messages! --" + e.getMessage(), e);
+// messageHandle.rollbackBatch(realmName, batchId, TransactionState.IGNORED_BY_CONSENSUS_PHASE_PRECOMPUTE_ROLLBACK.CODE);
+// }
+//
+// return null;
+// }
+
+ /**
+ * Used by consensus write phase, pre compute new block hash
+ */
public BatchAppResultImpl preComputeAppHash(byte[][] commands) {
String batchId = messageHandle.beginBatch(realmName);
List> asyncFutureLinkedList = new ArrayList<>(commands.length);
List responseLinkedList = new ArrayList<>();
+ BatchAppResultImpl result;
try {
int msgId = 0;
- for (byte[] txContent : commands) {
- AsyncFuture asyncFuture = messageHandle.processOrdered(msgId++, txContent, realmName, batchId);
- asyncFutureLinkedList.add(asyncFuture);
- }
- StateSnapshot stateSnapshot = messageHandle.completeBatch(realmName, batchId);
- byte[] blockHashBytes = stateSnapshot.getSnapshot();
- for (int i = 0; i< asyncFutureLinkedList.size(); i++) {
- responseLinkedList.add(asyncFutureLinkedList.get(i).get());
+ boolean isOK = true;
+ TransactionState transactionState = TransactionState.IGNORED_BY_BLOCK_FULL_ROLLBACK;
+
+ for (int i = 0; i < commands.length; i++) {
+ byte[] txContent = commands[i];
+ try {
+ AsyncFuture asyncFuture = messageHandle.processOrdered(msgId++, txContent, realmName, batchId);
+ asyncFutureLinkedList.add(asyncFuture);
+ } catch (BlockRollbackException e) {
+ LOGGER.error("Error occurred while processing ordered messages! --" + e.getMessage(), e);
+ isOK = false;
+ // TODO: handle the BlockRollbackException in detail;
+ if (e instanceof DataVersionConflictException) {
+ transactionState = TransactionState.DATA_VERSION_CONFLICT;
+ }
+ break;
+ }
}
+ if (isOK) {
+ StateSnapshot stateSnapshot = messageHandle.completeBatch(realmName, batchId);
+ byte[] blockHashBytes = stateSnapshot.getSnapshot();
+
+ for (int i = 0; i < asyncFutureLinkedList.size(); i++) {
+ responseLinkedList.add(asyncFutureLinkedList.get(i).get());
+ }
+
+ result = new BatchAppResultImpl(responseLinkedList, blockHashBytes, batchId);
+ result.setErrorCode((byte) 0);
+
+ return result;
+ } else {
+
+ for (int i = 0; i < commands.length; i++) {
+ responseLinkedList.add(createAppResponse(commands[i],transactionState));
+ }
+
+ Random random = new Random();
+ byte[] rand = new byte[4];
+ random.nextBytes(rand);
- return new BatchAppResultImpl(responseLinkedList, blockHashBytes, batchId);
+ result = new BatchAppResultImpl(responseLinkedList, rand, batchId);
+ result.setErrorCode((byte) 1);
+
+ return result;
+ }
} catch (Exception e) {
- // todo 需要处理应答码 404
- LOGGER.error("Error occurred while processing ordered messages! --" + e.getMessage(), e);
- messageHandle.rollbackBatch(realmName, batchId, TransactionState.IGNORED_BY_CONSENSUS_PHASE_PRECOMPUTE_ROLLBACK.CODE);
+ LOGGER.error("Error occurred while genearte batch app result! --" + e.getMessage(), e);
+ throw e;
}
+ }
- return null;
+ public byte[] createAppResponse(byte[] command, TransactionState transactionState) {
+ TransactionRequest txRequest = BinaryProtocol.decode(command);
+
+ TxResponseMessage resp = new TxResponseMessage(txRequest.getTransactionContent().getHash());
+// resp.setExecutionState(TransactionState.IGNORED_BY_BLOCK_FULL_ROLLBACK);
+ resp.setExecutionState(transactionState);
+
+ return BinaryProtocol.encode(resp, TransactionResponse.class);
}
/**
diff --git a/source/consensus/consensus-framework/pom.xml b/source/consensus/consensus-framework/pom.xml
index 760a6ab1..fe2c09d3 100644
--- a/source/consensus/consensus-framework/pom.xml
+++ b/source/consensus/consensus-framework/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
consensus
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
consensus-framework
diff --git a/source/consensus/consensus-mq/pom.xml b/source/consensus/consensus-mq/pom.xml
index a5b8d2b9..1018a069 100644
--- a/source/consensus/consensus-mq/pom.xml
+++ b/source/consensus/consensus-mq/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
consensus
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
consensus-mq
diff --git a/source/consensus/pom.xml b/source/consensus/pom.xml
index 8717f318..31d76545 100644
--- a/source/consensus/pom.xml
+++ b/source/consensus/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
consensus
pom
diff --git a/source/contract/contract-framework/pom.xml b/source/contract/contract-framework/pom.xml
index 6d63dd33..48104b73 100644
--- a/source/contract/contract-framework/pom.xml
+++ b/source/contract/contract-framework/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
contract
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
contract-framework
diff --git a/source/contract/contract-jvm/pom.xml b/source/contract/contract-jvm/pom.xml
index 048c2fe4..b7650d54 100644
--- a/source/contract/contract-jvm/pom.xml
+++ b/source/contract/contract-jvm/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
contract
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
contract-jvm
diff --git a/source/contract/contract-maven-plugin/pom.xml b/source/contract/contract-maven-plugin/pom.xml
index 15aba980..88bf84bf 100644
--- a/source/contract/contract-maven-plugin/pom.xml
+++ b/source/contract/contract-maven-plugin/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
contract
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
contract-maven-plugin
maven-plugin
diff --git a/source/contract/contract-samples/pom.xml b/source/contract/contract-samples/pom.xml
index 0efd6577..b3faf4db 100644
--- a/source/contract/contract-samples/pom.xml
+++ b/source/contract/contract-samples/pom.xml
@@ -5,7 +5,7 @@
contract
com.jd.blockchain
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
4.0.0
diff --git a/source/contract/pom.xml b/source/contract/pom.xml
index 84b445d0..37ad3cd4 100644
--- a/source/contract/pom.xml
+++ b/source/contract/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
contract
pom
diff --git a/source/crypto/crypto-adv/pom.xml b/source/crypto/crypto-adv/pom.xml
index add49a54..ec205688 100644
--- a/source/crypto/crypto-adv/pom.xml
+++ b/source/crypto/crypto-adv/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
crypto
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
crypto-adv
diff --git a/source/crypto/crypto-classic/pom.xml b/source/crypto/crypto-classic/pom.xml
index 503c0fad..ade4aba4 100644
--- a/source/crypto/crypto-classic/pom.xml
+++ b/source/crypto/crypto-classic/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
crypto
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
crypto-classic
diff --git a/source/crypto/crypto-framework/pom.xml b/source/crypto/crypto-framework/pom.xml
index 16715cd6..62d89e52 100644
--- a/source/crypto/crypto-framework/pom.xml
+++ b/source/crypto/crypto-framework/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
crypto
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
crypto-framework
diff --git a/source/crypto/crypto-pki/pom.xml b/source/crypto/crypto-pki/pom.xml
index 84bf6965..9c4921f1 100644
--- a/source/crypto/crypto-pki/pom.xml
+++ b/source/crypto/crypto-pki/pom.xml
@@ -5,7 +5,7 @@
crypto
com.jd.blockchain
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
4.0.0
diff --git a/source/crypto/crypto-sm/pom.xml b/source/crypto/crypto-sm/pom.xml
index f561f5df..e2d3d58e 100644
--- a/source/crypto/crypto-sm/pom.xml
+++ b/source/crypto/crypto-sm/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
crypto
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
crypto-sm
diff --git a/source/crypto/pom.xml b/source/crypto/pom.xml
index aa9f1910..0cda5a25 100644
--- a/source/crypto/pom.xml
+++ b/source/crypto/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
crypto
pom
diff --git a/source/deployment/deployment-gateway/pom.xml b/source/deployment/deployment-gateway/pom.xml
index 88d55f59..6ed57e19 100644
--- a/source/deployment/deployment-gateway/pom.xml
+++ b/source/deployment/deployment-gateway/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
deployment
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
deployment-gateway
diff --git a/source/deployment/deployment-peer/pom.xml b/source/deployment/deployment-peer/pom.xml
index eef74bb7..4ac9f092 100644
--- a/source/deployment/deployment-peer/pom.xml
+++ b/source/deployment/deployment-peer/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
deployment
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
deployment-peer
diff --git a/source/deployment/pom.xml b/source/deployment/pom.xml
index ceb09f31..1f673989 100644
--- a/source/deployment/pom.xml
+++ b/source/deployment/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
deployment
pom
diff --git a/source/gateway/pom.xml b/source/gateway/pom.xml
index a49c0839..f1fb16b3 100644
--- a/source/gateway/pom.xml
+++ b/source/gateway/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
gateway
diff --git a/source/gateway/src/main/java/com/jd/blockchain/gateway/service/GatewayInterceptServiceHandler.java b/source/gateway/src/main/java/com/jd/blockchain/gateway/service/GatewayInterceptServiceHandler.java
index 44f22aad..a7668d8e 100644
--- a/source/gateway/src/main/java/com/jd/blockchain/gateway/service/GatewayInterceptServiceHandler.java
+++ b/source/gateway/src/main/java/com/jd/blockchain/gateway/service/GatewayInterceptServiceHandler.java
@@ -5,15 +5,26 @@ import com.jd.blockchain.gateway.PeerService;
import com.jd.blockchain.ledger.ContractCodeDeployOperation;
import com.jd.blockchain.ledger.Operation;
import com.jd.blockchain.ledger.TransactionRequest;
+import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.ResourceUtils;
+
+import java.io.File;
+import java.net.URL;
@Service
public class GatewayInterceptServiceHandler implements GatewayInterceptService {
+ private static String contractsPath;
+
@Autowired
private PeerService peerService;
+ static {
+ contractsPath = jarRootDir();
+ }
+
@Override
public void intercept(TransactionRequest txRequest) {
// 当前仅处理合约发布的请求
@@ -29,7 +40,34 @@ public class GatewayInterceptServiceHandler implements GatewayInterceptService {
}
private void contractCheck(final ContractCodeDeployOperation contractOP) {
+
// 校验chainCode
- ContractJarUtils.verify(contractOP.getChainCode());
+ ContractJarUtils.verify(contractsPath, contractOP.getChainCode());
+ }
+
+ private static String jarRootDir() {
+
+ try {
+ URL url = GatewayInterceptServiceHandler.class.getProtectionDomain().getCodeSource().getLocation();
+ String currPath = java.net.URLDecoder.decode(url.getPath(), "UTF-8");
+ if (currPath.contains("!/")) {
+ currPath = currPath.substring(5, currPath.indexOf("!/"));
+ }
+ if (currPath.endsWith(".jar")) {
+ currPath = currPath.substring(0, currPath.lastIndexOf("/") + 1);
+ }
+ File file = new File(currPath);
+
+ String homeDir = file.getParent();
+
+ String jarRootPath = homeDir + File.separator + "contracts";
+
+ FileUtils.forceMkdir(new File(jarRootPath));
+
+ return jarRootPath;
+
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
}
}
diff --git a/source/gateway/src/main/java/com/jd/blockchain/gateway/web/BlockBrowserController.java b/source/gateway/src/main/java/com/jd/blockchain/gateway/web/BlockBrowserController.java
index 50f528ba..2b480825 100644
--- a/source/gateway/src/main/java/com/jd/blockchain/gateway/web/BlockBrowserController.java
+++ b/source/gateway/src/main/java/com/jd/blockchain/gateway/web/BlockBrowserController.java
@@ -597,7 +597,7 @@ public class BlockBrowserController implements BlockchainExtendQueryService {
public AccountHeader[] getUsers(@PathVariable(name = "ledgerHash") HashDigest ledgerHash,
@RequestParam(name = "fromIndex", required = false, defaultValue = "0") int fromIndex,
@RequestParam(name = "count", required = false, defaultValue = "-1") int count) {
- return peerService.getQueryService().getUsers(ledgerHash, fromIndex, count);
+ return revertAccountHeader(peerService.getQueryService().getUsers(ledgerHash, fromIndex, count));
}
@RequestMapping(method = RequestMethod.GET, path = "ledgers/{ledgerHash}/accounts")
@@ -605,7 +605,7 @@ public class BlockBrowserController implements BlockchainExtendQueryService {
public AccountHeader[] getDataAccounts(@PathVariable(name = "ledgerHash") HashDigest ledgerHash,
@RequestParam(name = "fromIndex", required = false, defaultValue = "0") int fromIndex,
@RequestParam(name = "count", required = false, defaultValue = "-1") int count) {
- return peerService.getQueryService().getDataAccounts(ledgerHash, fromIndex, count);
+ return revertAccountHeader(peerService.getQueryService().getDataAccounts(ledgerHash, fromIndex, count));
}
@RequestMapping(method = RequestMethod.GET, path = "ledgers/{ledgerHash}/contracts")
@@ -613,6 +613,20 @@ public class BlockBrowserController implements BlockchainExtendQueryService {
public AccountHeader[] getContractAccounts(@PathVariable(name = "ledgerHash") HashDigest ledgerHash,
@RequestParam(name = "fromIndex", required = false, defaultValue = "0") int fromIndex,
@RequestParam(name = "count", required = false, defaultValue = "-1") int count) {
- return peerService.getQueryService().getContractAccounts(ledgerHash, fromIndex, count);
+ return revertAccountHeader(peerService.getQueryService().getContractAccounts(ledgerHash, fromIndex, count));
+ }
+
+ /**
+ * reverse the AccountHeader[] content; the latest record show first;
+ * @return
+ */
+ private AccountHeader[] revertAccountHeader(AccountHeader[] accountHeaders){
+ AccountHeader[] accounts = new AccountHeader[accountHeaders.length];
+ if(accountHeaders!=null && accountHeaders.length>0){
+ for (int i = 0; i < accountHeaders.length; i++) {
+ accounts[accountHeaders.length-1-i] = accountHeaders[i];
+ }
+ }
+ return accounts;
}
}
diff --git a/source/ledger/ledger-core/pom.xml b/source/ledger/ledger-core/pom.xml
index d042e57d..e6ad7aed 100644
--- a/source/ledger/ledger-core/pom.xml
+++ b/source/ledger/ledger-core/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
ledger
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
ledger-core
diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerQueryService.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerQueryService.java
index 55b989d5..41e70138 100644
--- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerQueryService.java
+++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerQueryService.java
@@ -392,7 +392,7 @@ public class LedgerQueryService implements BlockchainQueryService {
checkLedgerHash(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
UserAccountQuery userAccountSet = ledger.getUserAccountSet(block);
- int pages[] = QueryUtil.calFromIndexAndCount(fromIndex, count, (int) userAccountSet.getTotal());
+ int pages[] = QueryUtil.calFromIndexAndCountDescend(fromIndex, count, (int) userAccountSet.getTotal());
return userAccountSet.getHeaders(pages[0], pages[1]);
}
@@ -401,7 +401,7 @@ public class LedgerQueryService implements BlockchainQueryService {
checkLedgerHash(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
DataAccountQuery dataAccountSet = ledger.getDataAccountSet(block);
- int pages[] = QueryUtil.calFromIndexAndCount(fromIndex, count, (int) dataAccountSet.getTotal());
+ int pages[] = QueryUtil.calFromIndexAndCountDescend(fromIndex, count, (int) dataAccountSet.getTotal());
return dataAccountSet.getHeaders(pages[0], pages[1]);
}
@@ -410,7 +410,7 @@ public class LedgerQueryService implements BlockchainQueryService {
checkLedgerHash(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
ContractAccountQuery contractAccountSet = ledger.getContractAccountSet(block);
- int pages[] = QueryUtil.calFromIndexAndCount(fromIndex, count, (int) contractAccountSet.getTotal());
+ int pages[] = QueryUtil.calFromIndexAndCountDescend(fromIndex, count, (int) contractAccountSet.getTotal());
return contractAccountSet.getHeaders(pages[0], pages[1]);
}
diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionBatchProcessor.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionBatchProcessor.java
index ae62cdf7..3d2ebed9 100644
--- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionBatchProcessor.java
+++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionBatchProcessor.java
@@ -5,29 +5,11 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import com.jd.blockchain.ledger.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jd.blockchain.crypto.HashDigest;
-import com.jd.blockchain.ledger.BlockRollbackException;
-import com.jd.blockchain.ledger.BytesValue;
-import com.jd.blockchain.ledger.ContractDoesNotExistException;
-import com.jd.blockchain.ledger.DataAccountDoesNotExistException;
-import com.jd.blockchain.ledger.IllegalTransactionException;
-import com.jd.blockchain.ledger.LedgerBlock;
-import com.jd.blockchain.ledger.LedgerException;
-import com.jd.blockchain.ledger.LedgerPermission;
-import com.jd.blockchain.ledger.LedgerSecurityException;
-import com.jd.blockchain.ledger.Operation;
-import com.jd.blockchain.ledger.OperationResult;
-import com.jd.blockchain.ledger.OperationResultData;
-import com.jd.blockchain.ledger.ParticipantDoesNotExistException;
-import com.jd.blockchain.ledger.TransactionContent;
-import com.jd.blockchain.ledger.TransactionRequest;
-import com.jd.blockchain.ledger.TransactionResponse;
-import com.jd.blockchain.ledger.TransactionRollbackException;
-import com.jd.blockchain.ledger.TransactionState;
-import com.jd.blockchain.ledger.UserDoesNotExistException;
import com.jd.blockchain.ledger.core.TransactionRequestExtension.Credential;
import com.jd.blockchain.service.TransactionBatchProcess;
import com.jd.blockchain.service.TransactionBatchResult;
@@ -63,7 +45,7 @@ public class TransactionBatchProcessor implements TransactionBatchProcess {
/**
* @param newBlockEditor 新区块的数据编辑器;
- * @param ledgerQueryer 账本查询器,只包含新区块的前一个区块的数据集;即未提交新区块之前的经过共识的账本最新数据集;
+ * @param newBlockEditor 账本查询器,只包含新区块的前一个区块的数据集;即未提交新区块之前的经过共识的账本最新数据集;
* @param opHandles 操作处理对象注册表;
*/
public TransactionBatchProcessor(LedgerSecurityManager securityManager, LedgerEditor newBlockEditor,
@@ -153,6 +135,7 @@ public class TransactionBatchProcessor implements TransactionBatchProcess {
} catch (BlockRollbackException e) {
// 发生区块级别的处理异常,向上重新抛出异常进行处理,整个区块可能被丢弃;
+ resp = discard(request, e.getState());
LOGGER.error(String.format(
"Ignore transaction caused by BlockRollbackException! --[BlockHeight=%s][RequestHash=%s][TxHash=%s] --%s",
newBlockEditor.getBlockHeight(), request.getHash(), request.getTransactionContent().getHash(),
@@ -287,8 +270,12 @@ public class TransactionBatchProcessor implements TransactionBatchProcess {
newBlockEditor.getBlockHeight(), request.getHash(), request.getTransactionContent().getHash(),
e.getMessage()), e);
} catch (BlockRollbackException e) {
- // 回滚整个区块;
+ // rollback all the block;
+ // TODO: handle the BlockRollbackException in detail;
result = TransactionState.IGNORED_BY_BLOCK_FULL_ROLLBACK;
+ if (e instanceof DataVersionConflictException) {
+ result = TransactionState.DATA_VERSION_CONFLICT;
+ }
txCtx.rollback();
LOGGER.error(
String.format("Transaction was rolled back! --[BlockHeight=%s][RequestHash=%s][TxHash=%s] --%s",
diff --git a/source/ledger/ledger-model/pom.xml b/source/ledger/ledger-model/pom.xml
index ac2bc2c1..b0ea6b32 100644
--- a/source/ledger/ledger-model/pom.xml
+++ b/source/ledger/ledger-model/pom.xml
@@ -6,7 +6,7 @@
com.jd.blockchain
ledger
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
ledger-model
diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/contract/ContractJarUtils.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/contract/ContractJarUtils.java
index 775d0ec5..b2a3764b 100644
--- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/contract/ContractJarUtils.java
+++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/contract/ContractJarUtils.java
@@ -110,36 +110,46 @@ public class ContractJarUtils {
return dotClassName;
}
- public static void verify(byte[] chainCode) {
+ public static void verify(String contractPath, byte[] chainCode) {
if (chainCode == null || chainCode.length == 0) {
throw new IllegalStateException("Contract's chaincode is empty !!!");
}
// 首先生成合约文件
- File jarFile = newJarFile();
+ File jarFile = newJarTempFile();
try {
FileUtils.writeByteArrayToFile(jarFile, chainCode);
// 校验合约文件
- verify(jarFile);
+ verify(contractPath, jarFile);
} catch (Exception e) {
throw new IllegalStateException(e);
} finally {
// 删除文件
try {
- FileUtils.forceDelete(jarFile);
+ jarFile.deleteOnExit();
} catch (Exception e) {
- throw new IllegalStateException(e);
+ // DO NOTHING
}
}
}
- private static void verify(File jarFile) throws Exception {
+ public static void verify(byte[] chainCode) {
+ verify(null, chainCode);
+ }
+
+ private static void verify(String contractPath, File jarFile) throws Exception {
// 首先判断jarFile中是否含有META-INF/JDCHAIN.TXT,并将其读出
URL jarUrl = new URL("jar:file:" + jarFile.getPath() + "!/" + CONTRACT_MF);
InputStream inputStream = jarUrl.openStream();
if (inputStream == null) {
throw new IllegalStateException(CONTRACT_MF + " IS NULL !!!");
}
- byte[] bytes = IOUtils.toByteArray(inputStream);
+ byte[] bytes;
+
+ try {
+ bytes = IOUtils.toByteArray(inputStream);
+ } finally {
+ inputStream.close();
+ }
if (bytes == null || bytes.length == 0) {
throw new IllegalStateException(CONTRACT_MF + " IS Illegal !!!");
}
@@ -147,20 +157,25 @@ public class ContractJarUtils {
String txt = new String(bytes, StandardCharsets.UTF_8);
// 生成新的Jar包文件,该文件路径与JarFile基本一致
- File tempJar = newJarFile();
-
- // 复制除JDCHAIN.TXT之外的部分
- copy(jarFile, tempJar, null, null, CONTRACT_MF);
-
- // 生成新Jar包对应的Hash内容
- String verifyTxt = contractMF(FileUtils.readFileToByteArray(tempJar));
+ File tempJar = newJarTempFile();
+ try {
+ // 复制除JDCHAIN.TXT之外的部分
+ copy(jarFile, tempJar, null, null, CONTRACT_MF);
- // 删除临时文件
- FileUtils.forceDelete(tempJar);
+ // 生成新Jar包对应的Hash内容
+ String verifyTxt = contractMF(FileUtils.readFileToByteArray(tempJar));
- // 校验Jar包内容
- if (!txt.equals(verifyTxt)) {
- throw new IllegalStateException(String.format("Jar [%s] verify Illegal !!!", jarFile.getName()));
+ // 校验Jar包内容
+ if (!txt.equals(verifyTxt)) {
+ throw new IllegalStateException(String.format("Jar [%s] verify Illegal !!!", jarFile.getName()));
+ }
+ } finally {
+ try {
+ // 删除临时文件
+ tempJar.deleteOnExit();
+ } catch (Exception e) {
+ // DO NOTHING
+ }
}
}
@@ -218,11 +233,30 @@ public class ContractJarUtils {
}
}
- private static File newJarFile() {
- return new File("contract-" +
- System.currentTimeMillis() + "-" +
- System.nanoTime() + "-" +
- FILE_RANDOM.nextInt(1024) +
- ".jar");
+ private static File newJarTempFile() {
+
+ try {
+ return File.createTempFile("contract-" +
+ System.currentTimeMillis() + "-" +
+ System.nanoTime() + "-" +
+ FILE_RANDOM.nextInt(1024), ".jar");
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+//
+// if (contractPath != null && contractPath.length() > 0) {
+// return new File(contractPath + File.separator +
+// "contract-" +
+// System.currentTimeMillis() + "-" +
+// System.nanoTime() + "-" +
+// FILE_RANDOM.nextInt(1024) +
+// ".jar");
+// }
+//
+// return new File("contract-" +
+// System.currentTimeMillis() + "-" +
+// System.nanoTime() + "-" +
+// FILE_RANDOM.nextInt(1024) +
+// ".jar");
}
}
diff --git a/source/ledger/ledger-rpc/pom.xml b/source/ledger/ledger-rpc/pom.xml
index e87e4324..4cfed7d1 100644
--- a/source/ledger/ledger-rpc/pom.xml
+++ b/source/ledger/ledger-rpc/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
ledger
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
ledger-rpc
diff --git a/source/ledger/pom.xml b/source/ledger/pom.xml
index b501f8d5..89802d22 100644
--- a/source/ledger/pom.xml
+++ b/source/ledger/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
ledger
pom
diff --git a/source/manager/manager-booter/pom.xml b/source/manager/manager-booter/pom.xml
index 6822ffa9..885e16d9 100644
--- a/source/manager/manager-booter/pom.xml
+++ b/source/manager/manager-booter/pom.xml
@@ -5,7 +5,7 @@
manager
com.jd.blockchain
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
4.0.0
diff --git a/source/manager/manager-model/pom.xml b/source/manager/manager-model/pom.xml
index 849d7467..314477d3 100644
--- a/source/manager/manager-model/pom.xml
+++ b/source/manager/manager-model/pom.xml
@@ -5,7 +5,7 @@
manager
com.jd.blockchain
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
4.0.0
diff --git a/source/manager/manager-service/pom.xml b/source/manager/manager-service/pom.xml
index ef5b3c84..fef1aed0 100644
--- a/source/manager/manager-service/pom.xml
+++ b/source/manager/manager-service/pom.xml
@@ -5,7 +5,7 @@
manager
com.jd.blockchain
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
4.0.0
diff --git a/source/manager/manager-web/pom.xml b/source/manager/manager-web/pom.xml
index b3549772..0daaf057 100644
--- a/source/manager/manager-web/pom.xml
+++ b/source/manager/manager-web/pom.xml
@@ -5,7 +5,7 @@
manager
com.jd.blockchain
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
4.0.0
diff --git a/source/manager/pom.xml b/source/manager/pom.xml
index 58b084b6..2972bff7 100644
--- a/source/manager/pom.xml
+++ b/source/manager/pom.xml
@@ -11,8 +11,21 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
manager
pom
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/source/peer/pom.xml b/source/peer/pom.xml
index 14afda7f..9029deaa 100644
--- a/source/peer/pom.xml
+++ b/source/peer/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
peer
diff --git a/source/peer/src/main/java/com/jd/blockchain/peer/web/LedgerQueryController.java b/source/peer/src/main/java/com/jd/blockchain/peer/web/LedgerQueryController.java
index ad5f3aeb..741594ce 100644
--- a/source/peer/src/main/java/com/jd/blockchain/peer/web/LedgerQueryController.java
+++ b/source/peer/src/main/java/com/jd/blockchain/peer/web/LedgerQueryController.java
@@ -474,7 +474,7 @@ public class LedgerQueryController implements BlockchainQueryService {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
UserAccountQuery userAccountSet = ledger.getUserAccountSet(block);
- int pages[] = QueryUtil.calFromIndexAndCount(fromIndex, count, (int) userAccountSet.getTotal());
+ int pages[] = QueryUtil.calFromIndexAndCountDescend(fromIndex, count, (int) userAccountSet.getTotal());
return userAccountSet.getHeaders(pages[0], pages[1]);
}
@@ -494,7 +494,7 @@ public class LedgerQueryController implements BlockchainQueryService {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
DataAccountQuery dataAccountSet = ledger.getDataAccountSet(block);
- int pages[] = QueryUtil.calFromIndexAndCount(fromIndex, count, (int) dataAccountSet.getTotal());
+ int pages[] = QueryUtil.calFromIndexAndCountDescend(fromIndex, count, (int) dataAccountSet.getTotal());
return dataAccountSet.getHeaders(pages[0], pages[1]);
}
@@ -506,7 +506,7 @@ public class LedgerQueryController implements BlockchainQueryService {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
ContractAccountQuery contractAccountSet = ledger.getContractAccountSet(block);
- int pages[] = QueryUtil.calFromIndexAndCount(fromIndex, count, (int) contractAccountSet.getTotal());
+ int pages[] = QueryUtil.calFromIndexAndCountDescend(fromIndex, count, (int) contractAccountSet.getTotal());
return contractAccountSet.getHeaders(pages[0], pages[1]);
}
diff --git a/source/pom.xml b/source/pom.xml
index 18eb6cda..777775fc 100644
--- a/source/pom.xml
+++ b/source/pom.xml
@@ -11,7 +11,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
pom
jdchain
@@ -35,7 +35,7 @@
- 0.2.0.RELEASE
+ 0.3.0.RELEASE
1.1.0.RELEASE
1.1.0.RELEASE
2.4
diff --git a/source/runtime/pom.xml b/source/runtime/pom.xml
index 29b27d8f..ec80c4b7 100644
--- a/source/runtime/pom.xml
+++ b/source/runtime/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
runtime
pom
diff --git a/source/runtime/runtime-context/pom.xml b/source/runtime/runtime-context/pom.xml
index 0a797e45..ade4b9c4 100644
--- a/source/runtime/runtime-context/pom.xml
+++ b/source/runtime/runtime-context/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
runtime
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
runtime-context
diff --git a/source/runtime/runtime-context/src/main/java/com/jd/blockchain/runtime/RuntimeContext.java b/source/runtime/runtime-context/src/main/java/com/jd/blockchain/runtime/RuntimeContext.java
index ce45fabb..e16097c2 100644
--- a/source/runtime/runtime-context/src/main/java/com/jd/blockchain/runtime/RuntimeContext.java
+++ b/source/runtime/runtime-context/src/main/java/com/jd/blockchain/runtime/RuntimeContext.java
@@ -240,7 +240,7 @@ public abstract class RuntimeContext {
private static void initBlacks() {
try {
- InputStream inputStream = ContractURLClassLoader.class.getResourceAsStream(File.separator + BLACK_CONFIG);
+ InputStream inputStream = ContractURLClassLoader.class.getResourceAsStream("/"+ BLACK_CONFIG);
String text = FileUtils.readText(inputStream);
String[] textArray = text.split("\n");
for (String setting : textArray) {
diff --git a/source/runtime/runtime-modular-booter/pom.xml b/source/runtime/runtime-modular-booter/pom.xml
index 4af67d71..e39129c4 100644
--- a/source/runtime/runtime-modular-booter/pom.xml
+++ b/source/runtime/runtime-modular-booter/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
runtime
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
runtime-modular-booter
\ No newline at end of file
diff --git a/source/runtime/runtime-modular/pom.xml b/source/runtime/runtime-modular/pom.xml
index 0a0e6c40..0bbb87d4 100644
--- a/source/runtime/runtime-modular/pom.xml
+++ b/source/runtime/runtime-modular/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
runtime
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
runtime-modular
diff --git a/source/sdk/pom.xml b/source/sdk/pom.xml
index 6d2937bd..56757bbe 100644
--- a/source/sdk/pom.xml
+++ b/source/sdk/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
sdk
pom
diff --git a/source/sdk/sdk-base/pom.xml b/source/sdk/sdk-base/pom.xml
index ee97814c..7c49f607 100644
--- a/source/sdk/sdk-base/pom.xml
+++ b/source/sdk/sdk-base/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
sdk
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
sdk-base
diff --git a/source/sdk/sdk-client/pom.xml b/source/sdk/sdk-client/pom.xml
index 6573d587..c8f7b0cd 100644
--- a/source/sdk/sdk-client/pom.xml
+++ b/source/sdk/sdk-client/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
sdk
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
sdk-client
diff --git a/source/sdk/sdk-samples/pom.xml b/source/sdk/sdk-samples/pom.xml
index 2a7f0820..ba4e9909 100644
--- a/source/sdk/sdk-samples/pom.xml
+++ b/source/sdk/sdk-samples/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
sdk
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
sdk-samples
diff --git a/source/storage/pom.xml b/source/storage/pom.xml
index e587c626..7bd095b7 100644
--- a/source/storage/pom.xml
+++ b/source/storage/pom.xml
@@ -3,7 +3,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
storage
pom
diff --git a/source/storage/storage-composite/pom.xml b/source/storage/storage-composite/pom.xml
index 5726d675..499c1c0b 100644
--- a/source/storage/storage-composite/pom.xml
+++ b/source/storage/storage-composite/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
storage
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
storage-composite
diff --git a/source/storage/storage-redis/pom.xml b/source/storage/storage-redis/pom.xml
index 4c340fc7..29613bbb 100644
--- a/source/storage/storage-redis/pom.xml
+++ b/source/storage/storage-redis/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
storage
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
storage-redis
diff --git a/source/storage/storage-rocksdb/pom.xml b/source/storage/storage-rocksdb/pom.xml
index 35f7fe09..4af83bb2 100644
--- a/source/storage/storage-rocksdb/pom.xml
+++ b/source/storage/storage-rocksdb/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
storage
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
storage-rocksdb
diff --git a/source/storage/storage-service/pom.xml b/source/storage/storage-service/pom.xml
index 221963d9..f21649fb 100644
--- a/source/storage/storage-service/pom.xml
+++ b/source/storage/storage-service/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
storage
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
storage-service
diff --git a/source/test/pom.xml b/source/test/pom.xml
index 6db75dd3..dac1a969 100644
--- a/source/test/pom.xml
+++ b/source/test/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
test
pom
diff --git a/source/test/test-consensus-client/pom.xml b/source/test/test-consensus-client/pom.xml
index 9a5f553e..73394904 100644
--- a/source/test/test-consensus-client/pom.xml
+++ b/source/test/test-consensus-client/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
test
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
test-consensus-client
diff --git a/source/test/test-consensus-node/pom.xml b/source/test/test-consensus-node/pom.xml
index 80f03f22..ecc6532f 100644
--- a/source/test/test-consensus-node/pom.xml
+++ b/source/test/test-consensus-node/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
test
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
test-consensus-node
@@ -38,7 +38,7 @@
com.jd.blockchain
consensus-bftsmart
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
org.springframework.boot
diff --git a/source/test/test-integration/pom.xml b/source/test/test-integration/pom.xml
index 19e30cf9..fcd52e7e 100644
--- a/source/test/test-integration/pom.xml
+++ b/source/test/test-integration/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
test
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
test-integration
diff --git a/source/test/test-ledger/pom.xml b/source/test/test-ledger/pom.xml
index e419527b..884c2eb8 100644
--- a/source/test/test-ledger/pom.xml
+++ b/source/test/test-ledger/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
test
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
test-ledger
diff --git a/source/tools/pom.xml b/source/tools/pom.xml
index a7bbe8ed..75a03f8b 100644
--- a/source/tools/pom.xml
+++ b/source/tools/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
tools
pom
diff --git a/source/tools/tools-initializer-booter/pom.xml b/source/tools/tools-initializer-booter/pom.xml
index e56f8891..cb1603fa 100644
--- a/source/tools/tools-initializer-booter/pom.xml
+++ b/source/tools/tools-initializer-booter/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
tools
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
tools-initializer-booter
diff --git a/source/tools/tools-initializer/pom.xml b/source/tools/tools-initializer/pom.xml
index 26bd939e..4a627f71 100644
--- a/source/tools/tools-initializer/pom.xml
+++ b/source/tools/tools-initializer/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
tools
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
tools-initializer
diff --git a/source/tools/tools-keygen-booter/pom.xml b/source/tools/tools-keygen-booter/pom.xml
index 4dc4196d..3a859eec 100644
--- a/source/tools/tools-keygen-booter/pom.xml
+++ b/source/tools/tools-keygen-booter/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
tools
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
tools-keygen-booter
diff --git a/source/tools/tools-keygen/pom.xml b/source/tools/tools-keygen/pom.xml
index f6a78fad..f18d5d50 100644
--- a/source/tools/tools-keygen/pom.xml
+++ b/source/tools/tools-keygen/pom.xml
@@ -5,7 +5,7 @@
com.jd.blockchain
tools
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
tools-keygen
diff --git a/source/utils/pom.xml b/source/utils/pom.xml
index e7acf3f6..cda7fe58 100644
--- a/source/utils/pom.xml
+++ b/source/utils/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
jdchain-root
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
utils
pom
diff --git a/source/utils/utils-common/pom.xml b/source/utils/utils-common/pom.xml
index a9ff2bb2..6109546c 100644
--- a/source/utils/utils-common/pom.xml
+++ b/source/utils/utils-common/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
utils
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
utils-common
diff --git a/source/utils/utils-common/src/main/java/com/jd/blockchain/utils/QueryUtil.java b/source/utils/utils-common/src/main/java/com/jd/blockchain/utils/QueryUtil.java
index ea858ff2..16021427 100644
--- a/source/utils/utils-common/src/main/java/com/jd/blockchain/utils/QueryUtil.java
+++ b/source/utils/utils-common/src/main/java/com/jd/blockchain/utils/QueryUtil.java
@@ -47,4 +47,21 @@ public class QueryUtil {
rtn[1] = count;
return rtn;
}
+
+ /**
+ * cal the data by descend;
+ * @param fromIndex
+ * @param count
+ * @param maxNum
+ * @return
+ */
+ public static int[] calFromIndexAndCountDescend(int fromIndex, int count, int maxNum){
+ int rtn[] = new int[2];
+ int results[] = calFromIndexAndCount(fromIndex,count,maxNum);
+
+ //now use descend; first show the latest record;
+ rtn[0] = maxNum - results[0] - results[1];
+ rtn[1] = results[1];
+ return rtn;
+ }
}
diff --git a/source/utils/utils-http/pom.xml b/source/utils/utils-http/pom.xml
index 21999a52..36a8e328 100644
--- a/source/utils/utils-http/pom.xml
+++ b/source/utils/utils-http/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
utils
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
diff --git a/source/utils/utils-serialize/pom.xml b/source/utils/utils-serialize/pom.xml
index 0d7f61f9..75d17956 100644
--- a/source/utils/utils-serialize/pom.xml
+++ b/source/utils/utils-serialize/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
utils
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
utils-serialize
diff --git a/source/utils/utils-test/pom.xml b/source/utils/utils-test/pom.xml
index 4e309f52..2541556f 100644
--- a/source/utils/utils-test/pom.xml
+++ b/source/utils/utils-test/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
utils
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
utils-test
diff --git a/source/utils/utils-web-server/pom.xml b/source/utils/utils-web-server/pom.xml
index 16d563af..b06fcbf6 100644
--- a/source/utils/utils-web-server/pom.xml
+++ b/source/utils/utils-web-server/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
utils
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
utils-web-server
diff --git a/source/utils/utils-web/pom.xml b/source/utils/utils-web/pom.xml
index db5d2758..4c8dccf3 100644
--- a/source/utils/utils-web/pom.xml
+++ b/source/utils/utils-web/pom.xml
@@ -4,7 +4,7 @@
com.jd.blockchain
utils
- 1.1.0.RELEASE
+ 1.1.1.RELEASE
utils-web