diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/ContractAccount.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/ContractAccount.java index c4a94ee6..23354356 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/ContractAccount.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/ContractAccount.java @@ -2,9 +2,8 @@ package com.jd.blockchain.ledger.core; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.crypto.PubKey; -import com.jd.blockchain.ledger.AccountHeader; -import com.jd.blockchain.ledger.BytesValue; import com.jd.blockchain.ledger.BytesData; +import com.jd.blockchain.ledger.BytesValue; import com.jd.blockchain.ledger.ContractInfo; import com.jd.blockchain.utils.Bytes; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/DataAccount.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/DataAccount.java index 792ca704..328ac05c 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/DataAccount.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/DataAccount.java @@ -1,12 +1,11 @@ package com.jd.blockchain.ledger.core; import com.jd.blockchain.binaryproto.BinaryProtocol; -import com.jd.blockchain.binaryproto.PrimitiveType; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.crypto.PubKey; import com.jd.blockchain.ledger.AccountHeader; -import com.jd.blockchain.ledger.BytesValue; import com.jd.blockchain.ledger.BytesData; +import com.jd.blockchain.ledger.BytesValue; import com.jd.blockchain.ledger.KVDataEntry; import com.jd.blockchain.ledger.KVDataObject; import com.jd.blockchain.utils.Bytes; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerAdminAccount.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerAdminDataset.java similarity index 94% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerAdminAccount.java rename to source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerAdminDataset.java index 0bb3b75a..07d91d34 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerAdminAccount.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerAdminDataset.java @@ -15,20 +15,22 @@ import com.jd.blockchain.ledger.LedgerMetadata; import com.jd.blockchain.ledger.LedgerMetadata_V2; import com.jd.blockchain.ledger.LedgerSettings; import com.jd.blockchain.ledger.ParticipantNode; +import com.jd.blockchain.ledger.RolePrivilegeSettings; +import com.jd.blockchain.ledger.UserRoleSettings; import com.jd.blockchain.storage.service.ExPolicyKVStorage; import com.jd.blockchain.storage.service.ExPolicyKVStorage.ExPolicy; import com.jd.blockchain.storage.service.VersioningKVStorage; import com.jd.blockchain.utils.Bytes; import com.jd.blockchain.utils.Transactional; -public class LedgerAdminAccount implements Transactional, LedgerAdminInfo { +public class LedgerAdminDataset implements Transactional, LedgerAdminInfo { static { DataContractRegistry.register(LedgerMetadata.class); DataContractRegistry.register(LedgerMetadata_V2.class); } - private static Logger LOGGER = LoggerFactory.getLogger(LedgerAdminAccount.class); + private static Logger LOGGER = LoggerFactory.getLogger(LedgerAdminDataset.class); public static final String LEDGER_META_PREFIX = "MTA" + LedgerConsts.KEY_SEPERATOR; public static final String LEDGER_PARTICIPANT_PREFIX = "PAR" + LedgerConsts.KEY_SEPERATOR; @@ -89,10 +91,12 @@ public class LedgerAdminAccount implements Transactional, LedgerAdminInfo { return readonly; } + @Override public RolePrivilegeSettings getRolePrivileges() { return rolePrivileges; } + @Override public UserRoleSettings getUserRoles() { return userRoles; } @@ -110,7 +114,7 @@ public class LedgerAdminAccount implements Transactional, LedgerAdminInfo { * @param exPolicyStorage * @param versioningStorage */ - public LedgerAdminAccount(LedgerInitSetting initSetting, String keyPrefix, ExPolicyKVStorage exPolicyStorage, + public LedgerAdminDataset(LedgerInitSetting initSetting, String keyPrefix, ExPolicyKVStorage exPolicyStorage, VersioningKVStorage versioningStorage) { this.metaPrefix = Bytes.fromString(keyPrefix + LEDGER_META_PREFIX); this.settingPrefix = Bytes.fromString(keyPrefix + LEDGER_SETTING_PREFIX); @@ -152,7 +156,7 @@ public class LedgerAdminAccount implements Transactional, LedgerAdminInfo { this.readonly = false; } - public LedgerAdminAccount(HashDigest adminAccountHash, String keyPrefix, ExPolicyKVStorage kvStorage, + public LedgerAdminDataset(HashDigest adminAccountHash, String keyPrefix, ExPolicyKVStorage kvStorage, VersioningKVStorage versioningKVStorage, boolean readonly) { this.metaPrefix = Bytes.fromString(keyPrefix + LEDGER_META_PREFIX); this.settingPrefix = Bytes.fromString(keyPrefix + LEDGER_SETTING_PREFIX); diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerDataSet.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerDataSet.java index 40f63da6..0736101b 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerDataSet.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerDataSet.java @@ -1,5 +1,7 @@ package com.jd.blockchain.ledger.core; +import com.jd.blockchain.ledger.LedgerAdminInfo; + /** * {@link LedgerDataSet} 表示账本在某一个区块上的数据集合; * @@ -10,7 +12,7 @@ public interface LedgerDataSet{ boolean isReadonly(); - LedgerAdminAccount getAdminAccount(); + LedgerAdminInfo getAdminAccount(); UserAccountSet getUserAccountSet(); diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerInitProposalData.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerInitProposalData.java index 6b6c79aa..4fa95cb7 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerInitProposalData.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerInitProposalData.java @@ -11,6 +11,7 @@ public class LedgerInitProposalData implements LedgerInitProposal { /** * a private contructor for deserialize; */ + @SuppressWarnings("unused") private LedgerInitProposalData() { } diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerRepository.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerRepository.java index c548e531..137d15a2 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerRepository.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerRepository.java @@ -60,7 +60,7 @@ public interface LedgerRepository extends Closeable { TransactionSet getTransactionSet(LedgerBlock block); - LedgerAdminAccount getAdminAccount(LedgerBlock block); + LedgerAdminInfo getAdminAccount(LedgerBlock block); UserAccountSet getUserAccountSet(LedgerBlock block); @@ -76,7 +76,7 @@ public interface LedgerRepository extends Closeable { return getTransactionSet(getLatestBlock()); } - default LedgerAdminAccount getAdminAccount() { + default LedgerAdminInfo getAdminAccount() { return getAdminAccount(getLatestBlock()); } diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerSecurityManager.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerSecurityManager.java index c9cbf359..aa0692a2 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerSecurityManager.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerSecurityManager.java @@ -2,6 +2,9 @@ package com.jd.blockchain.ledger.core; import java.util.Set; +import com.jd.blockchain.ledger.LedgerPrivilege; +import com.jd.blockchain.ledger.RolePrivileges; + /** * * {@link LedgerSecurityManager} implements the functions of security diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeDataset.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeDataset.java index f012e8db..56c98bf4 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeDataset.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeDataset.java @@ -4,6 +4,13 @@ import com.jd.blockchain.binaryproto.BinaryProtocol; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.ledger.CryptoSetting; import com.jd.blockchain.ledger.LedgerException; +import com.jd.blockchain.ledger.LedgerPermission; +import com.jd.blockchain.ledger.LedgerPrivilege; +import com.jd.blockchain.ledger.PrivilegeSet; +import com.jd.blockchain.ledger.RolePrivilegeSettings; +import com.jd.blockchain.ledger.RolePrivileges; +import com.jd.blockchain.ledger.TransactionPermission; +import com.jd.blockchain.ledger.TransactionPrivilege; import com.jd.blockchain.storage.service.ExPolicyKVStorage; import com.jd.blockchain.storage.service.VersioningKVEntry; import com.jd.blockchain.storage.service.VersioningKVStorage; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/SettingContext.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/SettingContext.java index 516b2acf..f464db7f 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/SettingContext.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/SettingContext.java @@ -1,51 +1,51 @@ -package com.jd.blockchain.ledger.core; - -public class SettingContext { - - private static final TxSettingContext txSettings = new TxSettingContext(); - - private static final QueryingSettingContext queryingSettings = new QueryingSettingContext(); - - public static TxSettingContext txSettings() { - return txSettings; - } - - public static QueryingSettingContext queryingSettings() { - return queryingSettings; - } - - /** - * 与交易处理相关的设置; - * @author huanghaiquan - * - */ - public static class TxSettingContext { - - public boolean verifyLedger() { - return true; - } - - public boolean verifySignature() { - return true; - } - - } - - /** - * 与账本查询相关的设置; - * @author huanghaiquan - * - */ - public static class QueryingSettingContext { - - /** - * 查询区块等具有 hash 标识符的对象时是否重新校验哈希; - * @return - */ - public boolean verifyHash() { - return false; - } - - } - -} +//package com.jd.blockchain.ledger.core; +// +//public class SettingContext { +// +// private static final TxSettingContext txSettings = new TxSettingContext(); +// +// private static final QueryingSettingContext queryingSettings = new QueryingSettingContext(); +// +// public static TxSettingContext txSettings() { +// return txSettings; +// } +// +// public static QueryingSettingContext queryingSettings() { +// return queryingSettings; +// } +// +// /** +// * 与交易处理相关的设置; +// * @author huanghaiquan +// * +// */ +// public static class TxSettingContext { +// +// public boolean verifyLedger() { +// return true; +// } +// +// public boolean verifySignature() { +// return true; +// } +// +// } +// +// /** +// * 与账本查询相关的设置; +// * @author huanghaiquan +// * +// */ +// public static class QueryingSettingContext { +// +// /** +// * 查询区块等具有 hash 标识符的对象时是否重新校验哈希; +// * @return +// */ +// public boolean verifyHash() { +// return false; +// } +// +// } +// +//} diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleDataset.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleDataset.java index ec7345c6..0c6d72d1 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleDataset.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleDataset.java @@ -5,6 +5,10 @@ import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.ledger.AuthorizationException; import com.jd.blockchain.ledger.CryptoSetting; import com.jd.blockchain.ledger.LedgerException; +import com.jd.blockchain.ledger.RoleSet; +import com.jd.blockchain.ledger.RolesPolicy; +import com.jd.blockchain.ledger.UserRoleSettings; +import com.jd.blockchain.ledger.UserRoles; import com.jd.blockchain.storage.service.ExPolicyKVStorage; import com.jd.blockchain.storage.service.VersioningKVEntry; import com.jd.blockchain.storage.service.VersioningKVStorage; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerDataSetImpl.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerDataSetImpl.java index 4ec9d657..cfcaa50d 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerDataSetImpl.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerDataSetImpl.java @@ -1,11 +1,12 @@ package com.jd.blockchain.ledger.core.impl; +import com.jd.blockchain.ledger.LedgerAdminInfo; import com.jd.blockchain.ledger.core.*; import com.jd.blockchain.utils.Transactional; public class LedgerDataSetImpl implements LedgerDataSet, Transactional { - private LedgerAdminAccount adminAccount; + private LedgerAdminDataset adminAccount; private UserAccountSet userAccountSet; @@ -24,7 +25,7 @@ public class LedgerDataSetImpl implements LedgerDataSet, Transactional { * @param contractAccountSet * @param readonly */ - public LedgerDataSetImpl(LedgerAdminAccount adminAccount, + public LedgerDataSetImpl(LedgerAdminDataset adminAccount, UserAccountSet userAccountSet, DataAccountSet dataAccountSet, ContractAccountSet contractAccountSet, boolean readonly) { this.adminAccount = adminAccount; @@ -36,7 +37,7 @@ public class LedgerDataSetImpl implements LedgerDataSet, Transactional { } @Override - public LedgerAdminAccount getAdminAccount() { + public LedgerAdminInfo getAdminAccount() { return adminAccount; } diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerRepositoryImpl.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerRepositoryImpl.java index 4dff3f06..8a14f014 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerRepositoryImpl.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/LedgerRepositoryImpl.java @@ -4,11 +4,18 @@ import com.jd.blockchain.binaryproto.BinaryProtocol; import com.jd.blockchain.crypto.Crypto; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.crypto.HashFunction; -import com.jd.blockchain.ledger.*; +import com.jd.blockchain.ledger.BlockBody; +import com.jd.blockchain.ledger.CryptoSetting; +import com.jd.blockchain.ledger.LedgerAdminInfo; +import com.jd.blockchain.ledger.LedgerBlock; +import com.jd.blockchain.ledger.LedgerDataSnapshot; +import com.jd.blockchain.ledger.LedgerInitSetting; +import com.jd.blockchain.ledger.LedgerSettings; +import com.jd.blockchain.ledger.TransactionRequest; import com.jd.blockchain.ledger.core.AccountAccessPolicy; import com.jd.blockchain.ledger.core.ContractAccountSet; import com.jd.blockchain.ledger.core.DataAccountSet; -import com.jd.blockchain.ledger.core.LedgerAdminAccount; +import com.jd.blockchain.ledger.core.LedgerAdminDataset; import com.jd.blockchain.ledger.core.LedgerConsts; import com.jd.blockchain.ledger.core.LedgerDataSet; import com.jd.blockchain.ledger.core.LedgerEditor; @@ -50,6 +57,11 @@ public class LedgerRepositoryImpl implements LedgerRepository { private static final Bytes TRANSACTION_SET_PREFIX = Bytes.fromString("TXS" + LedgerConsts.KEY_SEPERATOR); private static final AccountAccessPolicy DEFAULT_ACCESS_POLICY = new OpeningAccessPolicy(); + + /** + * 经过上一轮共识确认的账本管理配置; + */ + private LedgerAdminInfo approvedAdminInfo; private HashDigest ledgerHash; @@ -66,7 +78,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { private volatile LedgerEditor nextBlockEditor; private volatile boolean closed = false; - + public LedgerRepositoryImpl(HashDigest ledgerHash, String keyPrefix, ExPolicyKVStorage exPolicyStorage, VersioningKVStorage versioningStorage) { this.keyPrefix = keyPrefix; @@ -260,7 +272,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { LedgerState state = getLatestState(); transactionSet = state.transactionSet; if (transactionSet == null) { - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminInfo adminAccount = getAdminAccount(block); transactionSet = loadTransactionSet(block.getTransactionSetHash(), adminAccount.getSettings().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); @@ -268,7 +280,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { } return transactionSet; } - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminInfo adminAccount = getAdminAccount(block); // All of existing block is readonly; return loadTransactionSet(block.getTransactionSetHash(), adminAccount.getSettings().getCryptoSetting(), keyPrefix, exPolicyStorage, @@ -276,22 +288,22 @@ public class LedgerRepositoryImpl implements LedgerRepository { } @Override - public LedgerAdminAccount getAdminAccount(LedgerBlock block) { + public LedgerAdminDataset getAdminAccount(LedgerBlock block) { long height = getLatestBlockHeight(); - LedgerAdminAccount adminAccount = null; + LedgerAdminDataset adminAccount = null; if (height == block.getHeight()) { // 缓存读; LedgerState state = getLatestState(); adminAccount = state.adminAccount; if (adminAccount == null) { - adminAccount = new LedgerAdminAccount(block.getAdminAccountHash(), keyPrefix, exPolicyStorage, + adminAccount = new LedgerAdminDataset(block.getAdminAccountHash(), keyPrefix, exPolicyStorage, versioningStorage, true); state.adminAccount = adminAccount; } return adminAccount; } - return new LedgerAdminAccount(block.getAdminAccountHash(), keyPrefix, exPolicyStorage, versioningStorage, true); + return new LedgerAdminDataset(block.getAdminAccountHash(), keyPrefix, exPolicyStorage, versioningStorage, true); } @Override @@ -303,7 +315,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { LedgerState state = getLatestState(); userAccountSet = state.userAccountSet; if (userAccountSet == null) { - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); userAccountSet = loadUserAccountSet(block.getUserAccountSetHash(), adminAccount.getPreviousSetting().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); @@ -311,7 +323,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { } return userAccountSet; } - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); return loadUserAccountSet(block.getUserAccountSetHash(), adminAccount.getPreviousSetting().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); } @@ -325,7 +337,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { LedgerState state = getLatestState(); dataAccountSet = state.dataAccountSet; if (dataAccountSet == null) { - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); dataAccountSet = loadDataAccountSet(block.getDataAccountSetHash(), adminAccount.getPreviousSetting().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); @@ -334,7 +346,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { return dataAccountSet; } - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); return loadDataAccountSet(block.getDataAccountSetHash(), adminAccount.getPreviousSetting().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); } @@ -348,7 +360,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { LedgerState state = getLatestState(); contractAccountSet = state.contractAccountSet; if (contractAccountSet == null) { - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); contractAccountSet = loadContractAccountSet(block.getContractAccountSetHash(), adminAccount.getPreviousSetting().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); @@ -357,7 +369,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { return contractAccountSet; } - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); return loadContractAccountSet(block.getContractAccountSetHash(), adminAccount.getPreviousSetting().getCryptoSetting(), keyPrefix, exPolicyStorage, versioningStorage, true); @@ -383,7 +395,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { } private LedgerDataSet innerDataSet(LedgerBlock block) { - LedgerAdminAccount adminAccount = getAdminAccount(block); + LedgerAdminDataset adminAccount = getAdminAccount(block); UserAccountSet userAccountSet = getUserAccountSet(block); DataAccountSet dataAccountSet = getDataAccountSet(block); ContractAccountSet contractAccountSet = getContractAccountSet(block); @@ -439,7 +451,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { static LedgerDataSetImpl newDataSet(LedgerInitSetting initSetting, String keyPrefix, ExPolicyKVStorage ledgerExStorage, VersioningKVStorage ledgerVerStorage) { - LedgerAdminAccount adminAccount = new LedgerAdminAccount(initSetting, keyPrefix, ledgerExStorage, + LedgerAdminDataset adminAccount = new LedgerAdminDataset(initSetting, keyPrefix, ledgerExStorage, ledgerVerStorage); String usersetKeyPrefix = keyPrefix + USER_SET_PREFIX; @@ -493,7 +505,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { static LedgerDataSetImpl loadDataSet(LedgerDataSnapshot dataSnapshot, String keyPrefix, ExPolicyKVStorage ledgerExStorage, VersioningKVStorage ledgerVerStorage, boolean readonly) { - LedgerAdminAccount adminAccount = new LedgerAdminAccount(dataSnapshot.getAdminAccountHash(), keyPrefix, + LedgerAdminDataset adminAccount = new LedgerAdminDataset(dataSnapshot.getAdminAccountHash(), keyPrefix, ledgerExStorage, ledgerVerStorage, readonly); CryptoSetting cryptoSetting = adminAccount.getPreviousSetting().getCryptoSetting(); @@ -627,7 +639,7 @@ public class LedgerRepositoryImpl implements LedgerRepository { private final LedgerBlock block; - private volatile LedgerAdminAccount adminAccount; + private volatile LedgerAdminDataset adminAccount; private volatile UserAccountSet userAccountSet; diff --git a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerAdminAccountTest.java b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerAdminAccountTest.java index d7d820c4..9979809d 100644 --- a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerAdminAccountTest.java +++ b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerAdminAccountTest.java @@ -21,19 +21,20 @@ import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; import com.jd.blockchain.crypto.service.sm.SMCryptoService; import com.jd.blockchain.ledger.BlockchainKeyGenerator; import com.jd.blockchain.ledger.BlockchainKeypair; +import com.jd.blockchain.ledger.LedgerAdminInfo; import com.jd.blockchain.ledger.LedgerMetadata_V2; +import com.jd.blockchain.ledger.LedgerPermission; import com.jd.blockchain.ledger.LedgerSettings; import com.jd.blockchain.ledger.ParticipantNode; +import com.jd.blockchain.ledger.RolePrivilegeSettings; +import com.jd.blockchain.ledger.RolePrivileges; +import com.jd.blockchain.ledger.RolesPolicy; +import com.jd.blockchain.ledger.TransactionPermission; +import com.jd.blockchain.ledger.UserRoleSettings; +import com.jd.blockchain.ledger.UserRoles; import com.jd.blockchain.ledger.core.CryptoConfig; -import com.jd.blockchain.ledger.core.LedgerAdminAccount; +import com.jd.blockchain.ledger.core.LedgerAdminDataset; import com.jd.blockchain.ledger.core.LedgerConfiguration; -import com.jd.blockchain.ledger.core.LedgerPermission; -import com.jd.blockchain.ledger.core.RolePrivilegeSettings; -import com.jd.blockchain.ledger.core.RolePrivileges; -import com.jd.blockchain.ledger.core.RolesPolicy; -import com.jd.blockchain.ledger.core.TransactionPermission; -import com.jd.blockchain.ledger.core.UserRoleSettings; -import com.jd.blockchain.ledger.core.UserRoles; import com.jd.blockchain.storage.service.utils.MemoryKVStorage; import com.jd.blockchain.transaction.ConsensusParticipantData; import com.jd.blockchain.transaction.LedgerInitSettingData; @@ -87,7 +88,7 @@ public class LedgerAdminAccountTest { MemoryKVStorage testStorage = new MemoryKVStorage(); // Create intance with init setting; - LedgerAdminAccount ledgerAdminAccount = new LedgerAdminAccount(initSetting, keyPrefix, testStorage, + LedgerAdminDataset ledgerAdminAccount = new LedgerAdminDataset(initSetting, keyPrefix, testStorage, testStorage); ledgerAdminAccount.getRolePrivileges().addRolePrivilege("DEFAULT", @@ -126,7 +127,7 @@ public class LedgerAdminAccountTest { // Reload account from storage with readonly mode, and check the integrity of // data; HashDigest adminAccHash = ledgerAdminAccount.getHash(); - LedgerAdminAccount reloadAdminAccount1 = new LedgerAdminAccount(adminAccHash, keyPrefix, testStorage, + LedgerAdminDataset reloadAdminAccount1 = new LedgerAdminDataset(adminAccHash, keyPrefix, testStorage, testStorage, true); LedgerMetadata_V2 meta2 = reloadAdminAccount1.getMetadata(); @@ -148,7 +149,7 @@ public class LedgerAdminAccountTest { // -------------- // 重新加载,并进行修改; - LedgerAdminAccount reloadAdminAccount2 = new LedgerAdminAccount(adminAccHash, keyPrefix, testStorage, testStorage, false); + LedgerAdminDataset reloadAdminAccount2 = new LedgerAdminDataset(adminAccHash, keyPrefix, testStorage, testStorage, false); LedgerConfiguration newSetting = new LedgerConfiguration(reloadAdminAccount2.getPreviousSetting()); byte[] newCsSettingBytes = new byte[64]; rand.nextBytes(newCsSettingBytes); @@ -175,7 +176,7 @@ public class LedgerAdminAccountTest { LedgerMetadata_V2 newMeta = reloadAdminAccount2.getMetadata(); // load the last version of account and verify again; - LedgerAdminAccount previousAdminAccount = new LedgerAdminAccount(adminAccHash, keyPrefix, testStorage, + LedgerAdminDataset previousAdminAccount = new LedgerAdminDataset(adminAccHash, keyPrefix, testStorage, testStorage, true); verifyRealoadingSettings(previousAdminAccount, adminAccHash, ledgerAdminAccount.getMetadata(), ledgerAdminAccount.getSettings()); @@ -183,7 +184,7 @@ public class LedgerAdminAccountTest { verifyReadonlyState(previousAdminAccount); // load the hash of new committing; - LedgerAdminAccount newlyAdminAccount = new LedgerAdminAccount(newAccHash, keyPrefix, testStorage, testStorage, + LedgerAdminDataset newlyAdminAccount = new LedgerAdminDataset(newAccHash, keyPrefix, testStorage, testStorage, true); verifyRealoadingSettings(newlyAdminAccount, newAccHash, newMeta, newlyLedgerSettings); verifyRealoadingParities(newlyAdminAccount, parties); @@ -193,7 +194,7 @@ public class LedgerAdminAccountTest { // testStorage.printStoragedKeys(); } - private void verifyRealoadingSettings(LedgerAdminAccount actualAccount, HashDigest expAccRootHash, + private void verifyRealoadingSettings(LedgerAdminDataset actualAccount, HashDigest expAccRootHash, LedgerMetadata_V2 expMeta, LedgerSettings expLedgerSettings) { // 验证基本信息; assertFalse(actualAccount.isUpdated()); @@ -223,7 +224,7 @@ public class LedgerAdminAccountTest { actualLedgerSettings.getCryptoSetting().getHashAlgorithm()); } - private void verifyRealoadingRoleAuthorizations(LedgerAdminAccount actualAccount, + private void verifyRealoadingRoleAuthorizations(LedgerAdminInfo actualAccount, RolePrivilegeSettings expRolePrivilegeSettings, UserRoleSettings expUserRoleSettings) { // 验证基本信息; RolePrivilegeSettings actualRolePrivileges = actualAccount.getRolePrivileges(); @@ -254,7 +255,7 @@ public class LedgerAdminAccountTest { } } - private void verifyRealoadingParities(LedgerAdminAccount actualAccount, ParticipantNode[] expParties) { + private void verifyRealoadingParities(LedgerAdminInfo actualAccount, ParticipantNode[] expParties) { assertEquals(expParties.length, actualAccount.getParticipantCount()); ParticipantNode[] actualPaticipants = actualAccount.getParticipants(); assertEquals(expParties.length, actualPaticipants.length); @@ -273,7 +274,7 @@ public class LedgerAdminAccountTest { * * @param readonlyAccount */ - private void verifyReadonlyState(LedgerAdminAccount readonlyAccount) { + private void verifyReadonlyState(LedgerAdminDataset readonlyAccount) { ConsensusParticipantData newParti = new ConsensusParticipantData(); newParti.setId((int) readonlyAccount.getParticipantCount()); newParti.setHostAddress( diff --git a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerMetaDataTest.java b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerMetaDataTest.java index 22dbef11..2629461a 100644 --- a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerMetaDataTest.java +++ b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/LedgerMetaDataTest.java @@ -26,7 +26,7 @@ import com.jd.blockchain.crypto.service.sm.SMCryptoService; import com.jd.blockchain.ledger.CryptoSetting; import com.jd.blockchain.ledger.ParticipantNode; import com.jd.blockchain.ledger.core.CryptoConfig; -import com.jd.blockchain.ledger.core.LedgerAdminAccount; +import com.jd.blockchain.ledger.core.LedgerAdminDataset; import com.jd.blockchain.ledger.core.LedgerConfiguration; import com.jd.blockchain.ledger.core.ParticipantCertData; import com.jd.blockchain.utils.Bytes; @@ -79,7 +79,7 @@ public class LedgerMetaDataTest { // new Bytes(consensusSettingBytes), cryptoConfig); HashDigest settingsHash = Crypto.getHashFunction("SHA256").hash(consensusSettingBytes); - LedgerAdminAccount.LedgerMetadataInfo ledgerMetadata = new LedgerAdminAccount.LedgerMetadataInfo(); + LedgerAdminDataset.LedgerMetadataInfo ledgerMetadata = new LedgerAdminDataset.LedgerMetadataInfo(); ledgerMetadata.setSeed(seed); ledgerMetadata.setSettingsHash(settingsHash); diff --git a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/RolePrivilegeDatasetTest.java b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/RolePrivilegeDatasetTest.java index 47031e56..3c18ab32 100644 --- a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/RolePrivilegeDatasetTest.java +++ b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/RolePrivilegeDatasetTest.java @@ -11,11 +11,11 @@ import com.jd.blockchain.crypto.CryptoProvider; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; import com.jd.blockchain.crypto.service.sm.SMCryptoService; +import com.jd.blockchain.ledger.LedgerPermission; +import com.jd.blockchain.ledger.RolePrivileges; +import com.jd.blockchain.ledger.TransactionPermission; import com.jd.blockchain.ledger.core.CryptoConfig; -import com.jd.blockchain.ledger.core.LedgerPermission; import com.jd.blockchain.ledger.core.RolePrivilegeDataset; -import com.jd.blockchain.ledger.core.RolePrivileges; -import com.jd.blockchain.ledger.core.TransactionPermission; import com.jd.blockchain.storage.service.utils.MemoryKVStorage; public class RolePrivilegeDatasetTest { diff --git a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/UserRoleDatasetTest.java b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/UserRoleDatasetTest.java index 2dd586d3..d9b89047 100644 --- a/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/UserRoleDatasetTest.java +++ b/source/ledger/ledger-core/src/test/java/test/com/jd/blockchain/ledger/UserRoleDatasetTest.java @@ -13,10 +13,10 @@ import com.jd.blockchain.crypto.service.classic.ClassicCryptoService; import com.jd.blockchain.crypto.service.sm.SMCryptoService; import com.jd.blockchain.ledger.BlockchainKeyGenerator; import com.jd.blockchain.ledger.BlockchainKeypair; +import com.jd.blockchain.ledger.RolesPolicy; +import com.jd.blockchain.ledger.UserRoles; import com.jd.blockchain.ledger.core.CryptoConfig; -import com.jd.blockchain.ledger.core.RolesPolicy; import com.jd.blockchain.ledger.core.UserRoleDataset; -import com.jd.blockchain.ledger.core.UserRoles; import com.jd.blockchain.storage.service.utils.MemoryKVStorage; public class UserRoleDatasetTest { diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/AbstractPrivilege.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/AbstractPrivilege.java similarity index 96% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/AbstractPrivilege.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/AbstractPrivilege.java index 01ba5afd..df65c93c 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/AbstractPrivilege.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/AbstractPrivilege.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import java.util.BitSet; diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerAdminInfo.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerAdminInfo.java index 4e1b5105..ca09e1f5 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerAdminInfo.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerAdminInfo.java @@ -20,4 +20,10 @@ public interface LedgerAdminInfo { @DataField(order = 4, refContract = true, list = true) ParticipantNode[] getParticipants(); + @DataField(order = 5, refContract = true) + UserRoleSettings getUserRoles(); + + @DataField(order = 6, refContract = true) + RolePrivilegeSettings getRolePrivileges(); + } \ No newline at end of file diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerPermission.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerPermission.java similarity index 98% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerPermission.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerPermission.java index 04111ef6..dba568ab 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerPermission.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerPermission.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.EnumContract; import com.jd.blockchain.binaryproto.EnumField; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerPrivilege.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerPrivilege.java similarity index 91% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerPrivilege.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerPrivilege.java index 73cdf9ef..5b5ebf20 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/LedgerPrivilege.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerPrivilege.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; /** * LedgerPrivilege 账本特权是授权给特定角色的权限代码序列; diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerSettings.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerSettings.java index 76e2ad2c..fd77685a 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerSettings.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/LedgerSettings.java @@ -19,6 +19,4 @@ public interface LedgerSettings { @DataField(order=2, refContract=true) CryptoSetting getCryptoSetting(); -// PrivilegeModelSetting getPrivilegesModelSetting(); - } \ No newline at end of file diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/Privilege.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/Privilege.java similarity index 57% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/Privilege.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/Privilege.java index 25f6c9eb..4a77e0b9 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/Privilege.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/Privilege.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; public interface Privilege> { diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/PrivilegeSet.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/PrivilegeSet.java similarity index 93% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/PrivilegeSet.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/PrivilegeSet.java index ca4b2914..bf0d3da7 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/PrivilegeSet.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/PrivilegeSet.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.DataContract; import com.jd.blockchain.binaryproto.DataField; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeSettings.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolePrivilegeSettings.java similarity index 97% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeSettings.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolePrivilegeSettings.java index 47cdca37..159b6a48 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivilegeSettings.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolePrivilegeSettings.java @@ -1,6 +1,4 @@ -package com.jd.blockchain.ledger.core; - -import com.jd.blockchain.ledger.LedgerException; +package com.jd.blockchain.ledger; public interface RolePrivilegeSettings { diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivileges.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolePrivileges.java similarity index 97% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivileges.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolePrivileges.java index e2c4f8a5..76db4d01 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolePrivileges.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolePrivileges.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; /** * 对角色的授权; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RoleSet.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RoleSet.java similarity index 92% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RoleSet.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RoleSet.java index da4f5b6a..a026c23f 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RoleSet.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RoleSet.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.DataContract; import com.jd.blockchain.binaryproto.DataField; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolesPolicy.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolesPolicy.java similarity index 95% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolesPolicy.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolesPolicy.java index 42b72bb8..690d0be5 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/RolesPolicy.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/RolesPolicy.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.EnumContract; import com.jd.blockchain.binaryproto.EnumField; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionPermission.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/TransactionPermission.java similarity index 94% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionPermission.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/TransactionPermission.java index fb513938..b197820e 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionPermission.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/TransactionPermission.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.EnumContract; import com.jd.blockchain.binaryproto.EnumField; diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionPrivilege.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/TransactionPrivilege.java similarity index 88% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionPrivilege.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/TransactionPrivilege.java index 366e39f5..08408326 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/TransactionPrivilege.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/TransactionPrivilege.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; public class TransactionPrivilege extends AbstractPrivilege { diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleSettings.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/UserRoleSettings.java similarity index 93% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleSettings.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/UserRoleSettings.java index 7c35a267..15ef546c 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoleSettings.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/UserRoleSettings.java @@ -1,6 +1,5 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; -import com.jd.blockchain.ledger.LedgerException; import com.jd.blockchain.utils.Bytes; public interface UserRoleSettings { diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoles.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/UserRoles.java similarity index 97% rename from source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoles.java rename to source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/UserRoles.java index 9233953a..42160fe3 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/UserRoles.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/UserRoles.java @@ -1,4 +1,4 @@ -package com.jd.blockchain.ledger.core; +package com.jd.blockchain.ledger; import java.util.Set; import java.util.TreeSet; diff --git a/source/peer/src/main/java/com/jd/blockchain/peer/web/ManagementController.java b/source/peer/src/main/java/com/jd/blockchain/peer/web/ManagementController.java index a740f1ca..a7e07ace 100644 --- a/source/peer/src/main/java/com/jd/blockchain/peer/web/ManagementController.java +++ b/source/peer/src/main/java/com/jd/blockchain/peer/web/ManagementController.java @@ -47,7 +47,6 @@ import com.jd.blockchain.ledger.TransactionContentBody; import com.jd.blockchain.ledger.TransactionRequest; import com.jd.blockchain.ledger.TransactionResponse; import com.jd.blockchain.ledger.UserRegisterOperation; -import com.jd.blockchain.ledger.core.LedgerAdminAccount; import com.jd.blockchain.ledger.core.LedgerManage; import com.jd.blockchain.ledger.core.LedgerRepository; import com.jd.blockchain.peer.ConsensusRealm; @@ -227,7 +226,7 @@ public class ManagementController implements LedgerBindingConfigAware, PeerManag LedgerRepository ledgerRepository = ledgerManager.register(ledgerHash, dbConnNew.getStorageService()); // load provider; - LedgerAdminAccount ledgerAdminAccount = ledgerRepository.getAdminAccount(); + LedgerAdminInfo ledgerAdminAccount = ledgerRepository.getAdminAccount(); String consensusProvider = ledgerAdminAccount.getSettings().getConsensusProvider(); ConsensusProvider provider = ConsensusProviders.getProvider(consensusProvider); // find current node;