diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantRegisterOperationHandle.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantRegisterOperationHandle.java index 434e8c4a..6f783680 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantRegisterOperationHandle.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantRegisterOperationHandle.java @@ -1,11 +1,10 @@ package com.jd.blockchain.ledger.core.handles; -import com.jd.blockchain.consensus.ConsensusProvider; -import com.jd.blockchain.consensus.ConsensusProviders; import com.jd.blockchain.crypto.AddressEncoding; import com.jd.blockchain.crypto.PubKey; import com.jd.blockchain.ledger.*; import com.jd.blockchain.ledger.core.*; +import com.jd.blockchain.transaction.UserRegisterOpTemplate; import com.jd.blockchain.utils.Bytes; @@ -27,22 +26,15 @@ public class ParticipantRegisterOperationHandle extends AbstractLedgerOperationH LedgerAdminDataset adminAccountDataSet = newBlockDataset.getAdminDataset(); - ParticipantInfo participantInfo = participantRegOp.getParticipantInfo(); + ParticipantInfo participantInfo = new ParticipantInfoData(participantRegOp.getParticipantName(), participantRegOp.getParticipantIdentity().getPubKey(), participantRegOp.getNetworkAddress()); ParticipantNode participantNode = new PartNode((int)(adminAccountDataSet.getParticipantCount()), participantInfo.getName(), participantInfo.getPubKey(), ParticipantNodeState.REGISTED); - PubKey pubKey = participantNode.getPubKey(); - - BlockchainIdentityData identityData = new BlockchainIdentityData(pubKey); - -// //reg participant as user -// dataset.getUserAccountSet().register(identityData.getAddress(), pubKey); - //add new participant as consensus node adminAccountDataSet.addParticipant(participantNode); - // Build UserRegisterOperation; - UserRegisterOperation userRegOp = null;// + // Build UserRegisterOperation, reg participant as user + UserRegisterOperation userRegOp = new UserRegisterOpTemplate(participantRegOp.getParticipantIdentity()); handleContext.handle(userRegOp); } diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantStateUpdateOperationHandle.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantStateUpdateOperationHandle.java index 0c4fe9af..8969cfea 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantStateUpdateOperationHandle.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/handles/ParticipantStateUpdateOperationHandle.java @@ -34,14 +34,14 @@ public class ParticipantStateUpdateOperationHandle extends AbstractLedgerOperati ParticipantNode participantNode = null; for(int i = 0; i < participants.length; i++) { - if (stateUpdateOperation.getStateUpdateInfo().getPubKey().equals(participants[i].getPubKey())) { + if (stateUpdateOperation.getParticipantIdentity().getPubKey().equals(participants[i].getPubKey())) { participantNode = new PartNode(participants[i].getId(), participants[i].getName(), participants[i].getPubKey(), ParticipantNodeState.CONSENSUSED); break; } } //update consensus setting - ParticipantInfo participantInfo = new ParticipantInfoData(participantNode.getName(), participantNode.getPubKey(), stateUpdateOperation.getStateUpdateInfo().getNetworkAddress()); + ParticipantInfo participantInfo = new ParticipantInfoData(participantNode.getName(), participantNode.getPubKey(), stateUpdateOperation.getNetworkAddress()); Bytes newConsensusSettings = provider.getSettingsFactory().getConsensusSettingsBuilder().updateSettings(adminAccountDataSet.getSettings().getConsensusSetting(), participantInfo); diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantInfoData.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantInfoData.java index a5a6bc0a..27eaa098 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantInfoData.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantInfoData.java @@ -2,6 +2,7 @@ package com.jd.blockchain.ledger; import com.jd.blockchain.crypto.PubKey; import com.jd.blockchain.utils.net.NetworkAddress; +import org.omg.CORBA.PUBLIC_MEMBER; /** * 即将要注册的参与方的信息 diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantRegisterOperation.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantRegisterOperation.java index 2762e924..a8ccf227 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantRegisterOperation.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantRegisterOperation.java @@ -2,12 +2,19 @@ package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.DataContract; import com.jd.blockchain.binaryproto.DataField; +import com.jd.blockchain.binaryproto.PrimitiveType; import com.jd.blockchain.consts.DataCodes; +import com.jd.blockchain.utils.net.NetworkAddress; @DataContract(code= DataCodes.TX_OP_PARTICIPANT_REG) public interface ParticipantRegisterOperation extends Operation { - @DataField(order=1, refContract = true) - ParticipantInfo getParticipantInfo(); + @DataField(order = 0, primitiveType=PrimitiveType.TEXT) + String getParticipantName(); + @DataField(order = 1, refContract = true) + BlockchainIdentity getParticipantIdentity(); + + @DataField(order = 2, primitiveType = PrimitiveType.BYTES) + NetworkAddress getNetworkAddress(); } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantStateUpdateOperation.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantStateUpdateOperation.java index 1f656609..46cfea0e 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantStateUpdateOperation.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/ledger/ParticipantStateUpdateOperation.java @@ -2,10 +2,20 @@ package com.jd.blockchain.ledger; import com.jd.blockchain.binaryproto.DataContract; import com.jd.blockchain.binaryproto.DataField; +import com.jd.blockchain.binaryproto.PrimitiveType; import com.jd.blockchain.consts.DataCodes; +import com.jd.blockchain.utils.net.NetworkAddress; @DataContract(code= DataCodes.TX_OP_PARTICIPANT_STATE_UPDATE) public interface ParticipantStateUpdateOperation extends Operation { - @DataField(order=1, refContract = true) - ParticipantStateUpdateInfo getStateUpdateInfo(); + + @DataField(order = 0, refContract = true) + BlockchainIdentity getParticipantIdentity(); + + @DataField(order = 1, primitiveType = PrimitiveType.BYTES) + NetworkAddress getNetworkAddress(); + + @DataField(order = 2, refEnum = true) + ParticipantNodeState getState(); + } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/BlockchainOperationFactory.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/BlockchainOperationFactory.java index 317b6e85..c08cc0cb 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/BlockchainOperationFactory.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/BlockchainOperationFactory.java @@ -4,8 +4,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import com.jd.blockchain.crypto.PubKey; import com.jd.blockchain.ledger.*; import com.jd.blockchain.utils.Bytes; +import com.jd.blockchain.utils.net.NetworkAddress; /** * @author huanghaiquan @@ -288,8 +290,8 @@ public class BlockchainOperationFactory implements ClientOperator, LedgerInitOpe private class ParticipantRegisterOperationBuilderFilter implements ParticipantRegisterOperationBuilder { @Override - public ParticipantRegisterOperation register(ParticipantInfo participantInfo) { - ParticipantRegisterOperation op = PARTICIPANT_REG_OP_BUILDER.register(participantInfo); + public ParticipantRegisterOperation register(String participantName, BlockchainIdentity participantIdentity, NetworkAddress networkAddress) { + ParticipantRegisterOperation op = PARTICIPANT_REG_OP_BUILDER.register(participantName, participantIdentity, networkAddress); operationList.add(op); return op; } @@ -297,8 +299,8 @@ public class BlockchainOperationFactory implements ClientOperator, LedgerInitOpe private class ParticipantStateUpdateOperationBuilderFilter implements ParticipantStateUpdateOperationBuilder { @Override - public ParticipantStateUpdateOperation update(ParticipantStateUpdateInfo stateUpdateInfo) { - ParticipantStateUpdateOperation op = PARTICIPANT_STATE_UPDATE_OP_BUILDER.update(stateUpdateInfo); + public ParticipantStateUpdateOperation update(BlockchainIdentity blockchainIdentity, NetworkAddress networkAddress, ParticipantNodeState participantNodeState) { + ParticipantStateUpdateOperation op = PARTICIPANT_STATE_UPDATE_OP_BUILDER.update(blockchainIdentity, networkAddress, participantNodeState); operationList.add(op); return op; } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ClientOperator.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ClientOperator.java index 724e8d8a..cba4569e 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ClientOperator.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ClientOperator.java @@ -7,6 +7,6 @@ package com.jd.blockchain.transaction; * */ public interface ClientOperator - extends SecurityOperator, UserOperator, DataAccountOperator, ContractOperator, EventOperator, ParticipantOperator, ParticipantStateOperator { + extends SecurityOperator, UserOperator, DataAccountOperator, ContractOperator, EventOperator, ParticipantOperator { } \ No newline at end of file diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantOperator.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantOperator.java index 94237cc3..83c1524a 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantOperator.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantOperator.java @@ -8,4 +8,11 @@ public interface ParticipantOperator { * @return */ ParticipantRegisterOperationBuilder participants(); + + /** + * 参与方状态更新操作; + * + * @return + */ + ParticipantStateUpdateOperationBuilder states(); } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOpTemplate.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOpTemplate.java index 3eeaea53..2b5c608d 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOpTemplate.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOpTemplate.java @@ -1,8 +1,11 @@ package com.jd.blockchain.transaction; import com.jd.blockchain.binaryproto.DataContractRegistry; +import com.jd.blockchain.crypto.PubKey; +import com.jd.blockchain.ledger.BlockchainIdentity; import com.jd.blockchain.ledger.ParticipantInfo; import com.jd.blockchain.ledger.ParticipantRegisterOperation; +import com.jd.blockchain.utils.net.NetworkAddress; public class ParticipantRegisterOpTemplate implements ParticipantRegisterOperation { @@ -10,15 +13,29 @@ public class ParticipantRegisterOpTemplate implements ParticipantRegisterOperati DataContractRegistry.register(ParticipantRegisterOperation.class); } - private ParticipantInfo participantInfo; + private String participantName; + private BlockchainIdentity participantPubKey; + private NetworkAddress networkAddress; - public ParticipantRegisterOpTemplate(ParticipantInfo participantInfo) { + public ParticipantRegisterOpTemplate(String participantName, BlockchainIdentity participantPubKey, NetworkAddress networkAddress) { + this.participantName = participantName; + this.participantPubKey = participantPubKey; + this.networkAddress = networkAddress; - this.participantInfo = participantInfo; } @Override - public ParticipantInfo getParticipantInfo() { - return participantInfo; + public String getParticipantName() { + return participantName; + } + + @Override + public BlockchainIdentity getParticipantIdentity() { + return participantPubKey; + } + + @Override + public NetworkAddress getNetworkAddress() { + return networkAddress; } } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilder.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilder.java index 3776b691..26f54c5b 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilder.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilder.java @@ -1,7 +1,10 @@ package com.jd.blockchain.transaction; +import com.jd.blockchain.crypto.PubKey; +import com.jd.blockchain.ledger.BlockchainIdentity; import com.jd.blockchain.ledger.ParticipantInfo; import com.jd.blockchain.ledger.ParticipantRegisterOperation; +import com.jd.blockchain.utils.net.NetworkAddress; public interface ParticipantRegisterOperationBuilder { @@ -14,7 +17,7 @@ public interface ParticipantRegisterOperationBuilder { * * @return */ - ParticipantRegisterOperation register(ParticipantInfo participantInfo); + ParticipantRegisterOperation register(String participantName, BlockchainIdentity participantPubKey, NetworkAddress networkAddress); } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilderImpl.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilderImpl.java index 56339bfa..34b126d1 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilderImpl.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantRegisterOperationBuilderImpl.java @@ -1,11 +1,14 @@ package com.jd.blockchain.transaction; +import com.jd.blockchain.crypto.PubKey; +import com.jd.blockchain.ledger.BlockchainIdentity; import com.jd.blockchain.ledger.ParticipantInfo; import com.jd.blockchain.ledger.ParticipantRegisterOperation; +import com.jd.blockchain.utils.net.NetworkAddress; public class ParticipantRegisterOperationBuilderImpl implements ParticipantRegisterOperationBuilder { @Override - public ParticipantRegisterOperation register(ParticipantInfo participantNode) { - return new ParticipantRegisterOpTemplate(participantNode); + public ParticipantRegisterOperation register(String participantName, BlockchainIdentity participantPubKey, NetworkAddress networkAddress) { + return new ParticipantRegisterOpTemplate(participantName, participantPubKey, networkAddress); } } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOpTemplate.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOpTemplate.java index 9a410a1e..abb3b28d 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOpTemplate.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOpTemplate.java @@ -1,8 +1,10 @@ package com.jd.blockchain.transaction; import com.jd.blockchain.binaryproto.DataContractRegistry; -import com.jd.blockchain.ledger.ParticipantStateUpdateInfo; +import com.jd.blockchain.ledger.BlockchainIdentity; +import com.jd.blockchain.ledger.ParticipantNodeState; import com.jd.blockchain.ledger.ParticipantStateUpdateOperation; +import com.jd.blockchain.utils.net.NetworkAddress; public class ParticipantStateUpdateOpTemplate implements ParticipantStateUpdateOperation { @@ -10,14 +12,30 @@ public class ParticipantStateUpdateOpTemplate implements ParticipantStateUpdateO DataContractRegistry.register(ParticipantStateUpdateOperation.class); } - private ParticipantStateUpdateInfo stateUpdateInfo; + private BlockchainIdentity blockchainIdentity; + private NetworkAddress networkAddress; + private ParticipantNodeState participantNodeState; - public ParticipantStateUpdateOpTemplate(ParticipantStateUpdateInfo stateUpdateInfo) { - this.stateUpdateInfo = stateUpdateInfo; + public ParticipantStateUpdateOpTemplate(BlockchainIdentity blockchainIdentity, NetworkAddress networkAddress, ParticipantNodeState participantNodeState) { + + this.blockchainIdentity = blockchainIdentity; + this.networkAddress = networkAddress; + this.participantNodeState = participantNodeState; + } + + + @Override + public BlockchainIdentity getParticipantIdentity() { + return blockchainIdentity; + } + + @Override + public NetworkAddress getNetworkAddress() { + return networkAddress; } @Override - public ParticipantStateUpdateInfo getStateUpdateInfo() { - return stateUpdateInfo; + public ParticipantNodeState getState() { + return participantNodeState; } } diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilder.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilder.java index afb66bff..d6c69dc3 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilder.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilder.java @@ -1,7 +1,10 @@ package com.jd.blockchain.transaction; +import com.jd.blockchain.ledger.BlockchainIdentity; +import com.jd.blockchain.ledger.ParticipantNodeState; import com.jd.blockchain.ledger.ParticipantStateUpdateInfo; import com.jd.blockchain.ledger.ParticipantStateUpdateOperation; +import com.jd.blockchain.utils.net.NetworkAddress; public interface ParticipantStateUpdateOperationBuilder { @@ -14,5 +17,5 @@ public interface ParticipantStateUpdateOperationBuilder { * * @return */ - ParticipantStateUpdateOperation update(ParticipantStateUpdateInfo stateUpdateInfo); + ParticipantStateUpdateOperation update(BlockchainIdentity blockchainIdentity, NetworkAddress networkAddress, ParticipantNodeState participantNodeState); } \ No newline at end of file diff --git a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilderImpl.java b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilderImpl.java index 7c579fd7..9c84e181 100644 --- a/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilderImpl.java +++ b/source/ledger/ledger-model/src/main/java/com/jd/blockchain/transaction/ParticipantStateUpdateOperationBuilderImpl.java @@ -1,12 +1,15 @@ package com.jd.blockchain.transaction; +import com.jd.blockchain.ledger.BlockchainIdentity; +import com.jd.blockchain.ledger.ParticipantNodeState; import com.jd.blockchain.ledger.ParticipantStateUpdateInfo; import com.jd.blockchain.ledger.ParticipantStateUpdateOperation; +import com.jd.blockchain.utils.net.NetworkAddress; public class ParticipantStateUpdateOperationBuilderImpl implements ParticipantStateUpdateOperationBuilder { @Override - public ParticipantStateUpdateOperation update(ParticipantStateUpdateInfo stateUpdateInfo) { - return new ParticipantStateUpdateOpTemplate(stateUpdateInfo); + public ParticipantStateUpdateOperation update(BlockchainIdentity blockchainIdentity, NetworkAddress networkAddress, ParticipantNodeState participantNodeState) { + return new ParticipantStateUpdateOpTemplate(blockchainIdentity, networkAddress, participantNodeState); } } diff --git a/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_Regist_Test_.java b/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_Regist_Test_.java index f0bd032e..77157f0d 100644 --- a/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_Regist_Test_.java +++ b/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_Regist_Test_.java @@ -82,10 +82,8 @@ public class SDK_GateWay_Participant_Regist_Test_ { NetworkAddress networkAddress = new NetworkAddress("127.0.0.1", 20000); - ParticipantInfo participantInfo = new ParticipantInfoData("Peer4", user.getPubKey(), networkAddress); - // 注册参与方 - txTemp.participants().register(participantInfo); + txTemp.participants().register("Peer4", user.getIdentity(), networkAddress); // TX 准备就绪; PreparedTransaction prepTx = txTemp.prepare(); diff --git a/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_State_Update_Test_.java b/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_State_Update_Test_.java index ab2468be..9a51657a 100644 --- a/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_State_Update_Test_.java +++ b/source/sdk/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_Participant_State_Update_Test_.java @@ -77,10 +77,11 @@ public class SDK_GateWay_Participant_State_Update_Test_ { System.out.println("Address = "+AddressEncoding.generateAddress(pubKey)); + BlockchainKeypair user = new BlockchainKeypair(pubKey, privKey); + NetworkAddress networkAddress = new NetworkAddress("127.0.0.1", 20000); - ParticipantStateUpdateInfo stateUpdateInfo = new ParticipantStateUpdateInfoData(pubKey, ParticipantNodeState.CONSENSUSED, networkAddress); - txTemp.states().update(stateUpdateInfo); + txTemp.states().update(user.getIdentity(),networkAddress, ParticipantNodeState.CONSENSUSED); // TX 准备就绪; PreparedTransaction prepTx = txTemp.prepare(); diff --git a/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBase.java b/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBase.java index f8a7cfed..04c67892 100644 --- a/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBase.java +++ b/source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBase.java @@ -175,9 +175,7 @@ public class IntegrationBase { // 定义交易; TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); - ParticipantInfoData participantInfoData = new ParticipantInfoData("peer4", participant.getPubKey(), new NetworkAddress("127.0.0.1", 20000)); - - txTpl.participants().register(participantInfoData); + txTpl.participants().register("peer4", new BlockchainIdentityData(participant.getPubKey()), new NetworkAddress("127.0.0.1", 20000)); // 签名; PreparedTransaction ptx = txTpl.prepare(); @@ -203,9 +201,7 @@ public class IntegrationBase { ParticipantInfoData participantInfoData = new ParticipantInfoData("peer4", participantKeyPair.getPubKey(), new NetworkAddress("127.0.0.1", 20000)); - ParticipantStateUpdateInfo stateUpdateInfo = new ParticipantStateUpdateInfoData(participantKeyPair.getPubKey(), ParticipantNodeState.CONSENSUSED, participantInfoData.getNetworkAddress()); - - txTpl.states().update(stateUpdateInfo); + txTpl.states().update(new BlockchainIdentityData(participantInfoData.getPubKey()), participantInfoData.getNetworkAddress(), ParticipantNodeState.CONSENSUSED); // 签名; PreparedTransaction ptx = txTpl.prepare();