diff --git a/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettingsBuilder.java b/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettingsBuilder.java index af57f726..9d6637db 100644 --- a/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettingsBuilder.java +++ b/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettingsBuilder.java @@ -185,13 +185,13 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde BftsmartConsensusConfig bftsmartConsensusConfig = new BftsmartConsensusConfig(nodeSettings, systemConfigs); - for(int i = 0 ;i < bftsmartConsensusConfig.getNodes().length; i++) { - System.out.printf("id = %d, host = %s, port = %d\r\n", bftsmartConsensusConfig.getNodes()[i].getId(), bftsmartConsensusConfig.getNodes()[i].getNetworkAddress().getHost(), bftsmartConsensusConfig.getNodes()[i].getNetworkAddress().getPort()); - } - - for(int i = 0 ;i < bftsmartConsensusConfig.getSystemConfigs().length; i++) { - System.out.printf("property name = %s, property value = %s\r\n",bftsmartConsensusConfig.getSystemConfigs()[i].getName(), bftsmartConsensusConfig.getSystemConfigs()[i].getValue()); - } +// for(int i = 0 ;i < bftsmartConsensusConfig.getNodes().length; i++) { +// System.out.printf("id = %d, host = %s, port = %d\r\n", bftsmartConsensusConfig.getNodes()[i].getId(), bftsmartConsensusConfig.getNodes()[i].getNetworkAddress().getHost(), bftsmartConsensusConfig.getNodes()[i].getNetworkAddress().getPort()); +// } +// +// for(int i = 0 ;i < bftsmartConsensusConfig.getSystemConfigs().length; i++) { +// System.out.printf("property name = %s, property value = %s\r\n",bftsmartConsensusConfig.getSystemConfigs()[i].getName(), bftsmartConsensusConfig.getSystemConfigs()[i].getValue()); +// } return new Bytes(ConsensusProviders.getProvider(BFTSMART_PROVIDER).getSettingsFactory().getConsensusSettingsEncoder().encode(bftsmartConsensusConfig)); diff --git a/source/consensus/consensus-mq/src/main/java/com/jd/blockchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java b/source/consensus/consensus-mq/src/main/java/com/jd/blockchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java index 9eba0389..5790bae3 100644 --- a/source/consensus/consensus-mq/src/main/java/com/jd/blockchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java +++ b/source/consensus/consensus-mq/src/main/java/com/jd/blockchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java @@ -184,9 +184,9 @@ public class MsgQueueConsensusSettingsBuilder implements ConsensusSettingsBuilde msgQueueConsensusConfig.setNetworkSettings(consensusSettings.getNetworkSettings()); - for(int i = 0 ;i < msgQueueConsensusConfig.getNodes().length; i++) { - System.out.printf("node addr = %s\r\n", msgQueueConsensusConfig.getNodes()[i].getAddress()); - } +// for(int i = 0 ;i < msgQueueConsensusConfig.getNodes().length; i++) { +// System.out.printf("node addr = %s\r\n", msgQueueConsensusConfig.getNodes()[i].getAddress()); +// } return new Bytes(consensusEncoder.encode(msgQueueConsensusConfig)); diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/handles/ParticipantRegisterOperationHandle.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/handles/ParticipantRegisterOperationHandle.java index e06d813c..255a8eb9 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/handles/ParticipantRegisterOperationHandle.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/impl/handles/ParticipantRegisterOperationHandle.java @@ -16,8 +16,6 @@ public class ParticipantRegisterOperationHandle implements OperationHandle { ParticipantRegisterOperation participantRegOp = (ParticipantRegisterOperation) op; - System.out.println("ParticipantRegisterOperationHandle start\r\n"); - LedgerAdminAccount adminAccount = dataset.getAdminAccount(); ParticipantInfo participantInfo = participantRegOp.getParticipantInfo(); diff --git a/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4Bftsmart.java b/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4Bftsmart.java index 9b7ae2ba..fd93a2c0 100644 --- a/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4Bftsmart.java +++ b/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4Bftsmart.java @@ -30,6 +30,8 @@ public class IntegrationTest4Bftsmart { private static final boolean isRegisterDataAccount = true; + private static final boolean isRegisterParticipant = true; + private static final boolean isWriteKv = true; private static final String DB_TYPE_MEM = "mem"; @@ -140,6 +142,23 @@ public class IntegrationTest4Bftsmart { } } + long participantCount = ledgerRepository.getAdminAccount(ledgerRepository.retrieveLatestBlock()).getParticipantCount(); + + long userCount = ledgerRepository.getUserAccountSet(ledgerRepository.retrieveLatestBlock()).getTotalCount(); + + System.out.printf("before add participant: participantCount = %d, userCount = %d\r\n", (int)participantCount, (int)userCount); + + if (isRegisterParticipant) { + IntegrationBase.KeyPairResponse participantResponse = IntegrationBase.testSDK_RegisterParticipant(adminKey, ledgerHash, blockchainService); + } + + participantCount = ledgerRepository.getAdminAccount(ledgerRepository.retrieveLatestBlock()).getParticipantCount(); + + userCount = ledgerRepository.getUserAccountSet(ledgerRepository.retrieveLatestBlock()).getTotalCount(); + + System.out.printf("after add participant: participantCount = %d, userCount = %d\r\n", (int)participantCount, (int)userCount); + + try { System.out.println("----------------- Init Completed -----------------"); Thread.sleep(Integer.MAX_VALUE); diff --git a/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4MQ.java b/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4MQ.java index 6e8c7f1a..f7315d17 100644 --- a/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4MQ.java +++ b/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest4MQ.java @@ -30,6 +30,8 @@ public class IntegrationTest4MQ { private static final boolean isRegisterDataAccount = true; + private static final boolean isRegisterParticipant = true; + private static final boolean isWriteKv = true; private static final boolean isContract = false; @@ -138,6 +140,22 @@ public class IntegrationTest4MQ { integrationBase.testSDK_Contract(adminKey, ledgerHash, blockchainService,ledgerRepository); } + long participantCount = ledgerRepository.getAdminAccount(ledgerRepository.retrieveLatestBlock()).getParticipantCount(); + + long userCount = ledgerRepository.getUserAccountSet(ledgerRepository.retrieveLatestBlock()).getTotalCount(); + + System.out.printf("before add participant: participantCount = %d, userCount = %d\r\n", (int)participantCount, (int)userCount); + + if (isRegisterParticipant) { + IntegrationBase.KeyPairResponse participantResponse = IntegrationBase.testSDK_RegisterParticipant(adminKey, ledgerHash, blockchainService); + } + + participantCount = ledgerRepository.getAdminAccount(ledgerRepository.retrieveLatestBlock()).getParticipantCount(); + + userCount = ledgerRepository.getUserAccountSet(ledgerRepository.retrieveLatestBlock()).getTotalCount(); + + System.out.printf("after add participant: participantCount = %d, userCount = %d\r\n", (int)participantCount, (int)userCount); + IntegrationBase.testConsistencyAmongNodes(ledgers); if(isOnline){ diff --git a/source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java b/source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java index db75db26..f1d0c93b 100644 --- a/source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java +++ b/source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java @@ -242,7 +242,7 @@ public class LedgerInitProperties { .parseBoolean(PropertiesUtils.getRequiredProperty(props, initializerSecureKey)); NetworkAddress initializerAddress = new NetworkAddress(initializerHost, initializerPort, initializerSecure); parti.setInitializerAddress(initializerAddress); - + parti.setParticipantNodeState(ParticipantNodeState.CONSENSUSED); initProps.addConsensusParticipant(parti); }