Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
JDChain
Explorer
提交
f73a2280
E
Explorer
项目概览
JDChain
/
Explorer
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Explorer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f73a2280
编写于
6月 21, 2019
作者:
S
shaozhuguang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete the public key part involved in the bftsmart file !
上级
859a60d3
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
366 addition
and
315 deletion
+366
-315
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartCommitBlockConfig.java
...ckchain/consensus/bftsmart/BftsmartCommitBlockConfig.java
+35
-35
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartCommitBlockSettings.java
...chain/consensus/bftsmart/BftsmartCommitBlockSettings.java
+17
-17
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusConfig.java
...lockchain/consensus/bftsmart/BftsmartConsensusConfig.java
+14
-12
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettings.java
...ckchain/consensus/bftsmart/BftsmartConsensusSettings.java
+2
-2
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettingsBuilder.java
.../consensus/bftsmart/BftsmartConsensusSettingsBuilder.java
+60
-46
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartConsensusManageService.java
...nsus/bftsmart/service/BftsmartConsensusManageService.java
+10
-8
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java
...kchain/consensus/bftsmart/service/BftsmartNodeServer.java
+1
-1
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartServerSettingConfig.java
...nsensus/bftsmart/service/BftsmartServerSettingConfig.java
+0
-3
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartServerSettings.java
...in/consensus/bftsmart/service/BftsmartServerSettings.java
+0
-1
source/consensus/consensus-bftsmart/src/test/java/test/com/jd/blockchain/consensus/bftsmart/ProxyClientTest.java
...com/jd/blockchain/consensus/bftsmart/ProxyClientTest.java
+6
-5
source/consensus/consensus-framework/pom.xml
source/consensus/consensus-framework/pom.xml
+5
-0
source/consensus/consensus-framework/src/main/java/com/jd/blockchain/consensus/ConsensusSettingsBuilder.java
...com/jd/blockchain/consensus/ConsensusSettingsBuilder.java
+5
-5
source/consensus/consensus-mq/src/main/java/com/jd/blockchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java
...kchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java
+2
-1
source/deployment/deployment-peer/src/main/resources/config/init/bftsmart.config
...yment-peer/src/main/resources/config/init/bftsmart.config
+0
-15
source/deployment/deployment-peer/src/main/resources/config/init/ledger.init
...eployment-peer/src/main/resources/config/init/ledger.init
+15
-38
source/deployment/deployment-peer/src/main/resources/config/init/local.conf
...deployment-peer/src/main/resources/config/init/local.conf
+1
-2
source/deployment/deployment-peer/src/main/resources/config/init/mq/ledger-init.conf
...t-peer/src/main/resources/config/init/mq/ledger-init.conf
+0
-66
source/deployment/deployment-peer/src/main/resources/config/init/mq/ledger.init
...oyment-peer/src/main/resources/config/init/mq/ledger.init
+74
-0
source/deployment/deployment-peer/src/main/resources/config/init/mq/local.conf
...loyment-peer/src/main/resources/config/init/mq/local.conf
+7
-16
source/deployment/deployment-peer/src/main/resources/scripts/ledger-init.sh
...deployment-peer/src/main/resources/scripts/ledger-init.sh
+1
-1
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/IntegrationTest.java
...in/java/test/com/jd/blockchain/intgr/IntegrationTest.java
+4
-1
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/consensus/ConsensusTest.java
...test/com/jd/blockchain/intgr/consensus/ConsensusTest.java
+3
-1
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/GlobalPerformanceTest.java
...t/com/jd/blockchain/intgr/perf/GlobalPerformanceTest.java
+3
-1
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/LedgerInitializeWebTest.java
...com/jd/blockchain/intgr/perf/LedgerInitializeWebTest.java
+6
-2
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/LedgerPerformanceTest.java
...t/com/jd/blockchain/intgr/perf/LedgerPerformanceTest.java
+3
-1
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/Utils.java
...rc/main/java/test/com/jd/blockchain/intgr/perf/Utils.java
+52
-0
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBaseTest.java
...ava/test/com/jd/blockchain/intgr/IntegrationBaseTest.java
+4
-1
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest2.java
...t/java/test/com/jd/blockchain/intgr/IntegrationTest2.java
+4
-1
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTestDataAccount.java
...t/com/jd/blockchain/intgr/IntegrationTestDataAccount.java
+4
-1
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/initializer/LedgerInitializeWeb4Nodes.java
...ockchain/intgr/initializer/LedgerInitializeWeb4Nodes.java
+4
-1
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/initializer/LedgerInitializeWeb4SingleStepsTest.java
...ntgr/initializer/LedgerInitializeWeb4SingleStepsTest.java
+4
-1
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/ledger/LedgerBlockGeneratingTest.java
...jd/blockchain/intgr/ledger/LedgerBlockGeneratingTest.java
+4
-1
source/test/test-integration/src/test/resources/bftsmart.config
.../test/test-integration/src/test/resources/bftsmart.config
+1
-24
source/test/test-integration/src/test/resources/ledger.init
source/test/test-integration/src/test/resources/ledger.init
+0
-1
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java
...jd/blockchain/tools/initializer/LedgerInitProperties.java
+9
-1
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/web/LedgerInitializeWebController.java
.../tools/initializer/web/LedgerInitializeWebController.java
+6
-3
未找到文件。
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartCommitBlockConfig.java
浏览文件 @
f73a2280
package
com.jd.blockchain.consensus.bftsmart
;
public
class
BftsmartCommitBlockConfig
implements
BftsmartCommitBlockSettings
{
private
int
txSizePerBlock
;
private
long
maxDelayMilliSecondsPerBlock
;
public
BftsmartCommitBlockConfig
()
{
}
public
BftsmartCommitBlockConfig
(
int
txSizePerBlock
,
long
maxDelayMilliSecondsPerBlock
)
{
this
.
txSizePerBlock
=
txSizePerBlock
;
this
.
maxDelayMilliSecondsPerBlock
=
maxDelayMilliSecondsPerBlock
;
}
@Override
public
int
getTxSizePerBlock
()
{
return
txSizePerBlock
;
}
public
void
setTxSizePerBlock
(
int
txSizePerBlock
)
{
this
.
txSizePerBlock
=
txSizePerBlock
;
}
@Override
public
long
getMaxDelayMilliSecondsPerBlock
()
{
return
maxDelayMilliSecondsPerBlock
;
}
public
void
setMaxDelayMilliSecondsPerBlock
(
long
maxDelayMilliSecondsPerBlock
)
{
this
.
maxDelayMilliSecondsPerBlock
=
maxDelayMilliSecondsPerBlock
;
}
}
//
package com.jd.blockchain.consensus.bftsmart;
//
//
public class BftsmartCommitBlockConfig implements BftsmartCommitBlockSettings {
//
//
private int txSizePerBlock;
//
//
private long maxDelayMilliSecondsPerBlock;
//
//
//
public BftsmartCommitBlockConfig() {
//
//
}
//
//
public BftsmartCommitBlockConfig(int txSizePerBlock, long maxDelayMilliSecondsPerBlock) {
//
this.txSizePerBlock = txSizePerBlock;
//
this.maxDelayMilliSecondsPerBlock = maxDelayMilliSecondsPerBlock;
//
}
//
@Override
//
public int getTxSizePerBlock() {
//
return txSizePerBlock;
//
}
//
//
public void setTxSizePerBlock(int txSizePerBlock) {
//
this.txSizePerBlock = txSizePerBlock;
//
}
//
//
@Override
//
public long getMaxDelayMilliSecondsPerBlock() {
//
return maxDelayMilliSecondsPerBlock;
//
}
//
//
public void setMaxDelayMilliSecondsPerBlock(long maxDelayMilliSecondsPerBlock) {
//
this.maxDelayMilliSecondsPerBlock = maxDelayMilliSecondsPerBlock;
//
}
//
}
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartCommitBlockSettings.java
浏览文件 @
f73a2280
package
com.jd.blockchain.consensus.bftsmart
;
import
com.jd.blockchain.binaryproto.DataContract
;
import
com.jd.blockchain.binaryproto.DataField
;
import
com.jd.blockchain.binaryproto.PrimitiveType
;
import
com.jd.blockchain.consts.DataCodes
;
@DataContract
(
code
=
DataCodes
.
CONSENSUS_BFTSMART_BLOCK_SETTINGS
)
public
interface
BftsmartCommitBlockSettings
{
@DataField
(
order
=
0
,
primitiveType
=
PrimitiveType
.
INT32
)
int
getTxSizePerBlock
();
@DataField
(
order
=
1
,
primitiveType
=
PrimitiveType
.
INT64
)
long
getMaxDelayMilliSecondsPerBlock
();
}
//
package com.jd.blockchain.consensus.bftsmart;
//
//
import com.jd.blockchain.binaryproto.DataContract;
//
import com.jd.blockchain.binaryproto.DataField;
//
import com.jd.blockchain.binaryproto.PrimitiveType;
//
import com.jd.blockchain.consts.DataCodes;
//
//
//
@DataContract(code = DataCodes.CONSENSUS_BFTSMART_BLOCK_SETTINGS)
//
public interface BftsmartCommitBlockSettings {
//
//
@DataField(order = 0, primitiveType = PrimitiveType.INT32)
//
int getTxSizePerBlock();
//
//
@DataField(order = 1, primitiveType = PrimitiveType.INT64)
//
long getMaxDelayMilliSecondsPerBlock();
//
}
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusConfig.java
浏览文件 @
f73a2280
...
...
@@ -9,7 +9,7 @@ public class BftsmartConsensusConfig implements BftsmartConsensusSettings {
private
BftsmartNodeSettings
[]
nodes
;
private
BftsmartCommitBlockSettings
commitBlockSettings
;
//
private BftsmartCommitBlockSettings commitBlockSettings;
static
{
DataContractRegistry
.
register
(
BftsmartConsensusSettings
.
class
);
...
...
@@ -24,9 +24,11 @@ public class BftsmartConsensusConfig implements BftsmartConsensusSettings {
* @param bftsmartSystemConfigs
* bftsmart系统配置;
*/
public
BftsmartConsensusConfig
(
BftsmartNodeSettings
[]
nodes
,
BftsmartCommitBlockSettings
commitBlockSettings
,
Property
[]
bftsmartSystemConfigs
)
{
public
BftsmartConsensusConfig
(
BftsmartNodeSettings
[]
nodes
,
// BftsmartCommitBlockSettings commitBlockSettings,
Property
[]
bftsmartSystemConfigs
)
{
this
.
nodes
=
nodes
;
this
.
commitBlockSettings
=
commitBlockSettings
;
//
this.commitBlockSettings = commitBlockSettings;
this
.
bftsmartSystemConfig
=
bftsmartSystemConfigs
;
}
...
...
@@ -40,13 +42,13 @@ public class BftsmartConsensusConfig implements BftsmartConsensusSettings {
return
bftsmartSystemConfig
;
}
@Override
public
BftsmartCommitBlockSettings
getCommitBlockSettings
()
{
return
commitBlockSettings
;
}
public
void
setCommitBlockSettings
(
BftsmartCommitBlockSettings
commitBlockSettings
)
{
this
.
commitBlockSettings
=
commitBlockSettings
;
}
//
@Override
//
public BftsmartCommitBlockSettings getCommitBlockSettings() {
//
return commitBlockSettings;
//
}
//
//
//
public void setCommitBlockSettings(BftsmartCommitBlockSettings commitBlockSettings) {
//
this.commitBlockSettings = commitBlockSettings;
//
}
}
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettings.java
浏览文件 @
f73a2280
...
...
@@ -14,7 +14,7 @@ public interface BftsmartConsensusSettings extends ConsensusSettings {
@DataField
(
order
=
1
,
primitiveType
=
PrimitiveType
.
BYTES
,
list
=
true
)
Property
[]
getSystemConfigs
();
@DataField
(
order
=
2
,
refContract
=
true
)
BftsmartCommitBlockSettings
getCommitBlockSettings
();
//
@DataField(order = 2, refContract = true)
//
BftsmartCommitBlockSettings getCommitBlockSettings();
}
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/BftsmartConsensusSettingsBuilder.java
浏览文件 @
f73a2280
...
...
@@ -4,6 +4,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.util.Properties
;
import
com.jd.blockchain.ledger.ParticipantNode
;
import
com.jd.blockchain.tools.keygen.KeyGenCommand
;
import
com.jd.blockchain.utils.PropertiesUtils
;
import
com.jd.blockchain.utils.codec.Base58Utils
;
...
...
@@ -24,6 +25,8 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
private
static
final
String
CONFIG_TEMPLATE_FILE
=
"bftsmart.config"
;
private
static
final
String
CONFIG_LEDGER_INIT
=
"ledger.init"
;
/**
* 参数键:节点数量;
*/
...
...
@@ -61,6 +64,8 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
*/
public
static
final
String
CONSENSUS_SECURE_PATTERN
=
"system.server.%s.network.secure"
;
private
static
Properties
CONFIG_TEMPLATE
;
static
{
ClassPathResource
configResource
=
new
ClassPathResource
(
CONFIG_TEMPLATE_FILE
);
...
...
@@ -74,31 +79,31 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
}
//解析得到结块的相关配置信息
public
BftsmartCommitBlockConfig
createBlockConfig
(
Properties
resolvingProps
)
{
BftsmartCommitBlockConfig
blockConfig
=
new
BftsmartCommitBlockConfig
();
String
txSizeString
=
PropertiesUtils
.
getRequiredProperty
(
resolvingProps
,
BFTSMART_BLOCK_TXSIZE_KEY
);
resolvingProps
.
remove
(
BFTSMART_BLOCK_TXSIZE_KEY
);
if
(
txSizeString
==
null
||
txSizeString
.
length
()
==
0
)
{
blockConfig
.
setTxSizePerBlock
(
DEFAULT_TXSIZE
);
}
else
{
blockConfig
.
setTxSizePerBlock
(
Integer
.
parseInt
(
txSizeString
));
}
String
maxDelayString
=
PropertiesUtils
.
getRequiredProperty
(
resolvingProps
,
BFTSMART_BLOCK_MAXDELAY_KEY
);
resolvingProps
.
remove
(
BFTSMART_BLOCK_MAXDELAY_KEY
);
if
(
maxDelayString
==
null
||
maxDelayString
.
length
()
==
0
)
{
blockConfig
.
setMaxDelayMilliSecondsPerBlock
(
DEFAULT_MAXDELAY
);
}
else
{
blockConfig
.
setMaxDelayMilliSecondsPerBlock
(
Long
.
parseLong
(
maxDelayString
));
}
return
blockConfig
;
}
//
public BftsmartCommitBlockConfig createBlockConfig(Properties resolvingProps) {
//
BftsmartCommitBlockConfig blockConfig = new BftsmartCommitBlockConfig();
//
//
String txSizeString = PropertiesUtils.getRequiredProperty(resolvingProps, BFTSMART_BLOCK_TXSIZE_KEY);
//
resolvingProps.remove(BFTSMART_BLOCK_TXSIZE_KEY);
//
//
if (txSizeString == null || txSizeString.length() == 0) {
//
blockConfig.setTxSizePerBlock(DEFAULT_TXSIZE);
//
}
//
else {
//
blockConfig.setTxSizePerBlock(Integer.parseInt(txSizeString));
//
}
//
//
String maxDelayString = PropertiesUtils.getRequiredProperty(resolvingProps, BFTSMART_BLOCK_MAXDELAY_KEY);
//
resolvingProps.remove(BFTSMART_BLOCK_MAXDELAY_KEY);
//
//
if (maxDelayString == null || maxDelayString.length() == 0) {
//
blockConfig.setMaxDelayMilliSecondsPerBlock(DEFAULT_MAXDELAY);
//
}
//
else {
//
blockConfig.setMaxDelayMilliSecondsPerBlock(Long.parseLong(maxDelayString));
//
}
//
//
return blockConfig;
//
}
@Override
public
Properties
createPropertiesTemplate
()
{
...
...
@@ -106,7 +111,7 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
}
@Override
public
BftsmartConsensusSettings
createSettings
(
Properties
props
)
{
public
BftsmartConsensusSettings
createSettings
(
Properties
props
,
ParticipantNode
[]
participantNodes
)
{
Properties
resolvingProps
=
PropertiesUtils
.
cloneFrom
(
props
);
int
serversNum
=
PropertiesUtils
.
getInt
(
resolvingProps
,
SERVER_NUM_KEY
);
if
(
serversNum
<
0
)
{
...
...
@@ -115,18 +120,26 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
if
(
serversNum
<
4
)
{
throw
new
IllegalArgumentException
(
String
.
format
(
"Property[%s] is less than 4!"
,
SERVER_NUM_KEY
));
}
if
(
participantNodes
==
null
)
{
throw
new
IllegalArgumentException
(
"ParticipantNodes is Empty !!!"
);
}
if
(
serversNum
!=
participantNodes
.
length
)
{
throw
new
IllegalArgumentException
(
String
.
format
(
"Property[%s] which is [%s] unequal "
+
"ParticipantNodes's length which is [%s] !"
,
SERVER_NUM_KEY
,
serversNum
,
participantNodes
.
length
));
}
BftsmartCommitBlockConfig
blockConfig
=
createBlockConfig
(
resolvingProps
);
//
BftsmartCommitBlockConfig blockConfig = createBlockConfig(resolvingProps);
BftsmartNodeSettings
[]
nodesSettings
=
new
BftsmartNodeSettings
[
serversNum
];
for
(
int
i
=
0
;
i
<
serversNum
;
i
++)
{
int
id
=
i
;
String
keyOfPubkey
=
keyOfNode
(
PUBKEY_PATTERN
,
id
);
String
base58PubKey
=
PropertiesUtils
.
getRequiredProperty
(
resolvingProps
,
keyOfPubkey
);
//
String keyOfPubkey = keyOfNode(PUBKEY_PATTERN, id);
//
String base58PubKey = PropertiesUtils.getRequiredProperty(resolvingProps, keyOfPubkey);
// PubKey pubKey = new PubKey(Base58Utils.decode(base58PubKey));
PubKey
pubKey
=
KeyGenCommand
.
decodePubKey
(
base58PubKey
);
resolvingProps
.
remove
(
keyOfPubkey
);
// PubKey pubKey = KeyGenCommand.decodePubKey(base58PubKey);
PubKey
pubKey
=
participantNodes
[
i
].
getPubKey
();
// resolvingProps.remove(keyOfPubkey);
String
keyOfHost
=
keyOfNode
(
CONSENSUS_HOST_PATTERN
,
id
);
String
networkAddressHost
=
PropertiesUtils
.
getRequiredProperty
(
resolvingProps
,
keyOfHost
);
...
...
@@ -145,7 +158,8 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
nodesSettings
[
i
]
=
nodeConfig
;
}
BftsmartConsensusConfig
config
=
new
BftsmartConsensusConfig
(
nodesSettings
,
blockConfig
,
BftsmartConsensusConfig
config
=
new
BftsmartConsensusConfig
(
nodesSettings
,
// blockConfig,
PropertiesUtils
.
getOrderedValues
(
resolvingProps
));
return
config
;
}
...
...
@@ -160,8 +174,8 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
if
(
serversNum
>
0
)
{
for
(
int
i
=
0
;
i
<
serversNum
;
i
++)
{
int
id
=
i
;
String
keyOfPubkey
=
keyOfNode
(
PUBKEY_PATTERN
,
id
);
props
.
remove
(
keyOfPubkey
);
//
String keyOfPubkey = keyOfNode(PUBKEY_PATTERN, id);
//
props.remove(keyOfPubkey);
String
keyOfHost
=
keyOfNode
(
CONSENSUS_HOST_PATTERN
,
id
);
props
.
remove
(
keyOfHost
);
...
...
@@ -180,22 +194,22 @@ public class BftsmartConsensusSettingsBuilder implements ConsensusSettingsBuilde
props
.
setProperty
(
SERVER_NUM_KEY
,
serversNum
+
""
);
//获得结块相关的属性信息
BftsmartCommitBlockSettings
blockSettings
=
bftsmartSettings
.
getCommitBlockSettings
();
if
(
blockSettings
==
null
)
{
props
.
setProperty
(
BFTSMART_BLOCK_TXSIZE_KEY
,
DEFAULT_TXSIZE
+
""
);
props
.
setProperty
(
BFTSMART_BLOCK_MAXDELAY_KEY
,
DEFAULT_MAXDELAY
+
""
);
}
else
{
int
txSize
=
blockSettings
.
getTxSizePerBlock
();
long
maxDelay
=
blockSettings
.
getMaxDelayMilliSecondsPerBlock
();
props
.
setProperty
(
BFTSMART_BLOCK_TXSIZE_KEY
,
txSize
+
""
);
props
.
setProperty
(
BFTSMART_BLOCK_MAXDELAY_KEY
,
maxDelay
+
""
);
}
//
BftsmartCommitBlockSettings blockSettings = bftsmartSettings.getCommitBlockSettings();
//
if (blockSettings == null) {
//
props.setProperty(BFTSMART_BLOCK_TXSIZE_KEY, DEFAULT_TXSIZE + "");
//
props.setProperty(BFTSMART_BLOCK_MAXDELAY_KEY, DEFAULT_MAXDELAY + "");
//
} else {
//
int txSize = blockSettings.getTxSizePerBlock();
//
long maxDelay = blockSettings.getMaxDelayMilliSecondsPerBlock();
//
props.setProperty(BFTSMART_BLOCK_TXSIZE_KEY, txSize + "");
//
props.setProperty(BFTSMART_BLOCK_MAXDELAY_KEY, maxDelay + "");
//
}
for
(
int
i
=
0
;
i
<
serversNum
;
i
++)
{
BftsmartNodeSettings
ns
=
nodesSettings
[
i
];
int
id
=
i
;
String
keyOfPubkey
=
keyOfNode
(
PUBKEY_PATTERN
,
id
);
props
.
setProperty
(
keyOfPubkey
,
ns
.
getPubKey
().
toBase58
());
//
String keyOfPubkey = keyOfNode(PUBKEY_PATTERN, id);
//
props.setProperty(keyOfPubkey, ns.getPubKey().toBase58());
String
keyOfHost
=
keyOfNode
(
CONSENSUS_HOST_PATTERN
,
id
);
props
.
setProperty
(
keyOfHost
,
ns
.
getNetworkAddress
()
==
null
?
""
:
ns
.
getNetworkAddress
().
getHost
());
...
...
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartConsensusManageService.java
浏览文件 @
f73a2280
...
...
@@ -34,26 +34,28 @@ public class BftsmartConsensusManageService implements ConsensusManageService {
@Override
public
BftsmartClientIncomingSettings
authClientIncoming
(
ClientIdentification
authId
)
{
if
(
verify
(
authId
))
{
BftsmartClientIncoming
Settings
clientIncomingSettings
=
new
BftsmartClientIncomingConfig
();
BftsmartClientIncoming
Config
clientIncomingSettings
=
new
BftsmartClientIncomingConfig
();
((
BftsmartClientIncomingConfig
)
clientIncomingSettings
)
clientIncomingSettings
.
setTopology
(
BinarySerializeUtils
.
serialize
(
nodeServer
.
getTopology
()));
((
BftsmartClientIncomingConfig
)
clientIncomingSettings
)
clientIncomingSettings
.
setTomConfig
(
BinarySerializeUtils
.
serialize
(
nodeServer
.
getTomConfig
()));
((
BftsmartClientIncomingConfig
)
clientIncomingSettings
)
clientIncomingSettings
.
setConsensusSettings
(
nodeServer
.
getConsensusSetting
());
((
BftsmartClientIncomingConfig
)
clientIncomingSettings
).
setPubKey
(
authId
.
getPubKey
());
clientIncomingSettings
.
setPubKey
(
authId
.
getPubKey
());
// compute gateway id
authLock
.
lock
();
try
{
authLock
.
lock
();
((
BftsmartClientIncomingConfig
)
clientIncomingSettings
).
setClientId
(
clientId
++);
clientIncomingSettings
.
setClientId
(
clientId
++);
clientId
+=
CLIENT_SIZE_PER_GATEWAY
;
}
finally
{
authLock
.
unlock
();
}
return
clientIncomingSettings
;
}
return
null
;
...
...
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java
浏览文件 @
f73a2280
...
...
@@ -107,7 +107,7 @@ public class BftsmartNodeServer extends DefaultRecoverable implements NodeServer
setting
=
((
BftsmartServerSettings
)
serverSettings
).
getConsensusSettings
();
List
<
HostsConfig
.
Config
>
configList
=
new
ArrayList
<
HostsConfig
.
Config
>();
List
<
HostsConfig
.
Config
>
configList
=
new
ArrayList
<>();
NodeSettings
[]
nodeSettingsArray
=
setting
.
getNodes
();
for
(
NodeSettings
nodeSettings
:
nodeSettingsArray
)
{
...
...
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartServerSettingConfig.java
浏览文件 @
f73a2280
package
com.jd.blockchain.consensus.bftsmart.service
;
import
com.jd.blockchain.consensus.NodeSettings
;
import
com.jd.blockchain.consensus.bftsmart.BftsmartCommitBlockSettings
;
import
com.jd.blockchain.consensus.bftsmart.BftsmartConsensusSettings
;
import
com.jd.blockchain.consensus.bftsmart.BftsmartNodeSettings
;
import
com.jd.blockchain.consensus.service.ServerSettings
;
public
class
BftsmartServerSettingConfig
implements
BftsmartServerSettings
{
private
NodeSettings
replicaSettings
;
...
...
source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartServerSettings.java
浏览文件 @
f73a2280
package
com.jd.blockchain.consensus.bftsmart.service
;
import
com.jd.blockchain.consensus.bftsmart.BftsmartCommitBlockSettings
;
import
com.jd.blockchain.consensus.bftsmart.BftsmartConsensusSettings
;
import
com.jd.blockchain.consensus.service.ServerSettings
;
...
...
source/consensus/consensus-bftsmart/src/test/java/test/com/jd/blockchain/consensus/bftsmart/
p
roxyClientTest.java
→
source/consensus/consensus-bftsmart/src/test/java/test/com/jd/blockchain/consensus/bftsmart/
P
roxyClientTest.java
浏览文件 @
f73a2280
...
...
@@ -26,7 +26,7 @@ import java.util.concurrent.CountDownLatch;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
public
class
p
roxyClientTest
{
public
class
P
roxyClientTest
{
int
number
=
1500000
;
...
...
@@ -69,13 +69,14 @@ public class proxyClientTest {
nodesSettings
[
i
]
=
(
BftsmartNodeSettings
)
node
;
}
BftsmartConsensusConfig
consensusConfig
=
new
BftsmartConsensusConfig
(
nodesSettings
,
null
,
BftsmartConsensusConfig
consensusConfig
=
new
BftsmartConsensusConfig
(
nodesSettings
,
// null,
PropertiesUtils
.
getOrderedValues
(
bftsmartConf
));
for
(
int
j
=
0
;
j
<
nodeNum
;
j
++)
{
ServerSettings
serverSettings
=
new
BftsmartServerSettingConfig
();
((
BftsmartServerSettingConfig
)
serverSettings
)
.
setReplicaSettings
(
nodesSettings
[
j
]);
((
BftsmartServerSettingConfig
)
serverSettings
)
.
setConsensusSettings
(
consensusConfig
);
BftsmartServerSettingConfig
serverSettings
=
new
BftsmartServerSettingConfig
();
serverSettings
.
setReplicaSettings
(
nodesSettings
[
j
]);
serverSettings
.
setConsensusSettings
(
consensusConfig
);
BftsmartNodeServer
server
=
new
BftsmartNodeServer
(
serverSettings
,
null
,
null
);
nodeServers
[
j
]
=
server
;
nodeStartPools
.
execute
(()
->
{
...
...
source/consensus/consensus-framework/pom.xml
浏览文件 @
f73a2280
...
...
@@ -25,5 +25,10 @@
<artifactId>
utils-common
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.jd.blockchain
</groupId>
<artifactId>
ledger-model
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
source/consensus/consensus-framework/src/main/java/com/jd/blockchain/consensus/ConsensusSettingsBuilder.java
浏览文件 @
f73a2280
package
com.jd.blockchain.consensus
;
import
com.jd.blockchain.ledger.ParticipantNode
;
import
java.util.Properties
;
public
interface
ConsensusSettingsBuilder
{
...
...
@@ -9,13 +11,11 @@ public interface ConsensusSettingsBuilder {
*
* @param props
* 属性表;
* @param keyPrefix
* 属性的key 的前缀;<br>
* 在解析过程中,以具体协议实现的标准参数的key 加入此前缀后从属性表中检索参数值;<br>
* 如果指定为 null 或者空白,则忽略此参数;
* @param participantNodes
* 参与方列表;<br>
* @return
*/
ConsensusSettings
createSettings
(
Properties
props
);
ConsensusSettings
createSettings
(
Properties
props
,
ParticipantNode
[]
participantNodes
);
Properties
createPropertiesTemplate
();
...
...
source/consensus/consensus-mq/src/main/java/com/jd/blockchain/consensus/mq/MsgQueueConsensusSettingsBuilder.java
浏览文件 @
f73a2280
...
...
@@ -21,6 +21,7 @@ import com.jd.blockchain.consensus.mq.settings.MsgQueueNetworkSettings;
import
com.jd.blockchain.consensus.mq.settings.MsgQueueNodeSettings
;
import
com.jd.blockchain.crypto.AddressEncoding
;
import
com.jd.blockchain.crypto.PubKey
;
import
com.jd.blockchain.ledger.ParticipantNode
;
import
com.jd.blockchain.tools.keygen.KeyGenCommand
;
import
com.jd.blockchain.utils.Bytes
;
import
com.jd.blockchain.utils.PropertiesUtils
;
...
...
@@ -97,7 +98,7 @@ public class MsgQueueConsensusSettingsBuilder implements ConsensusSettingsBuilde
}
@Override
public
MsgQueueConsensusSettings
createSettings
(
Properties
props
)
{
public
MsgQueueConsensusSettings
createSettings
(
Properties
props
,
ParticipantNode
[]
participantNodes
)
{
MsgQueueNetworkConfig
networkConfig
=
new
MsgQueueNetworkConfig
();
Properties
resolvingProps
=
PropertiesUtils
.
cloneFrom
(
props
);
...
...
source/deployment/deployment-peer/src/main/resources/config/init/bftsmart.config
浏览文件 @
f73a2280
...
...
@@ -13,22 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
############################################
###### Consensus Commit Block Parameters: transaction count ######
############################################
system
.
block
.
txsize
=
15
############################################
###### Consensus Commit Block Parameters: delay time ######
############################################
system
.
block
.
maxdelay
=
500
############################################
###### #Consensus Participant0 ######
############################################
system
.
server
.
0
.
pubkey
=
system
.
server
.
0
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
0
.
network
.
port
=
16000
system
.
server
.
0
.
network
.
secure
=
false
...
...
@@ -37,7 +25,6 @@ system.server.0.network.secure=false
###### #Consensus Participant1 ######
############################################
system
.
server
.
1
.
pubkey
=
system
.
server
.
1
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
1
.
network
.
port
=
16010
system
.
server
.
1
.
network
.
secure
=
false
...
...
@@ -46,7 +33,6 @@ system.server.1.network.secure=false
###### #Consensus Participant2 ######
############################################
system
.
server
.
2
.
pubkey
=
system
.
server
.
2
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
2
.
network
.
port
=
16020
system
.
server
.
2
.
network
.
secure
=
false
...
...
@@ -55,7 +41,6 @@ system.server.2.network.secure=false
###### #Consensus Participant3 ######
############################################
system
.
server
.
3
.
pubkey
=
system
.
server
.
3
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
3
.
network
.
port
=
16030
system
.
server
.
3
.
network
.
secure
=
false
...
...
source/deployment/deployment-peer/src/main/resources/config/init/ledger.init
浏览文件 @
f73a2280
#账本的种子;一段16进制字符,最长可以包含64个字符;可以用字符“-”分隔,以便更容易读取;
ledger.seed=932dfe23-fe23232f-283f32fa-dd32aa76-8322ca2f-56236cda-7136b322-cb323ffe
#账本的描述名称;此属性不参与共识,仅仅在当前参与方的本地节点用于描述用途;
ledger.name=
#声明的账本创建时间;格式为 “yyyy-MM-dd HH:mm:ss.SSSZ”,表示”年-月-日 时:分:秒:毫秒时区“;例如:“2019-08-01 14:26:58.069+0800”,其中,+0800 表示时区是东8区
created-time=2019-08-01 14:26:58.069+0800
#共识服务提供者;必须;
consensus.service-provider=com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider
...
...
@@ -21,36 +22,24 @@ com.jd.blockchain.crypto.service.sm.SMCryptoService
cons_parti.count=4
#第0个参与方的名称;
cons_parti.0.name=
jd.com
cons_parti.0.name=
#第0个参与方的公钥文件路径;
cons_parti.0.pubkey-path=
keys/jd-com.pub
cons_parti.0.pubkey-path=
#第0个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.0.pubkey=3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9
#第0个参与方的共识服务的主机地址;
cons_parti.0.consensus.host=127.0.0.1
#第0个参与方的共识服务的端口;
cons_parti.0.consensus.port=8900
#第0个参与方的共识服务是否开启安全连接;
cons_parti.0.consensus.secure=true
cons_parti.0.pubkey=
#第0个参与方的账本初始服务的主机;
cons_parti.0.initializer.host=127.0.0.1
#第0个参与方的账本初始服务的端口;
cons_parti.0.initializer.port=8800
#第0个参与方的账本初始服务是否开启安全连接;
cons_parti.0.initializer.secure=
tru
e
cons_parti.0.initializer.secure=
fals
e
#第1个参与方的名称;
cons_parti.1.name=
at.com
cons_parti.1.name=
#第1个参与方的公钥文件路径;
cons_parti.1.pubkey-path=
keys/at-com.pub
cons_parti.1.pubkey-path=
#第1个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.1.pubkey=3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX
#第1个参与方的共识服务的主机地址;
cons_parti.1.consensus.host=127.0.0.1
#第1个参与方的共识服务的端口;
cons_parti.1.consensus.port=8910
#第1个参与方的共识服务是否开启安全连接;
cons_parti.1.consensus.secure=false
cons_parti.1.pubkey=
#第1个参与方的账本初始服务的主机;
cons_parti.1.initializer.host=127.0.0.1
#第1个参与方的账本初始服务的端口;
...
...
@@ -59,36 +48,24 @@ cons_parti.1.initializer.port=8810
cons_parti.1.initializer.secure=false
#第2个参与方的名称;
cons_parti.2.name=
bt.com
cons_parti.2.name=
#第2个参与方的公钥文件路径;
cons_parti.2.pubkey-path=
classpath:keys/parti2.pub
cons_parti.2.pubkey-path=
#第2个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.2.pubkey=
#第2个参与方的共识服务的主机地址;
cons_parti.2.consensus.host=127.0.0.1
#第2个参与方的共识服务的端口;
cons_parti.2.consensus.port=8920
#第2个参与方的共识服务是否开启安全连接;
cons_parti.2.consensus.secure=false
#第2个参与方的账本初始服务的主机;
cons_parti.2.initializer.host=127.0.0.1
#第2个参与方的账本初始服务的端口;
cons_parti.2.initializer.port=8820
#第2个参与方的账本初始服务是否开启安全连接;
cons_parti.2.initializer.secure=
tru
e
cons_parti.2.initializer.secure=
fals
e
#第3个参与方的名称;
cons_parti.3.name=
xt.com
cons_parti.3.name=
#第3个参与方的公钥文件路径;
cons_parti.3.pubkey-path=
keys/xt-com.pub
cons_parti.3.pubkey-path=
#第3个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.3.pubkey=3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk
#第3个参与方的共识服务的主机地址;
cons_parti.3.consensus.host=127.0.0.1
#第3个参与方的共识服务的端口;
cons_parti.3.consensus.port=8930
#第3个参与方的共识服务是否开启安全连接;
cons_parti.3.consensus.secure=false
cons_parti.3.pubkey=
#第3个参与方的账本初始服务的主机;
cons_parti.3.initializer.host=127.0.0.1
#第3个参与方的账本初始服务的端口;
...
...
source/deployment/deployment-peer/src/main/resources/config/init/local.conf
浏览文件 @
f73a2280
...
...
@@ -20,5 +20,4 @@ ledger.binding.out=../
ledger
.
db
.
uri
=
#账本数据库的连接口令
ledger
.
db
.
pwd
=
ledger
.
db
.
pwd
=
\ No newline at end of file
source/deployment/deployment-peer/src/main/resources/config/init/mq/ledger-init.conf
已删除
100644 → 0
浏览文件 @
859a60d3
#账本的种子;一段16进制字符,最长可以包含64个字符;可以用字符“-”分隔,以便更容易读取;
ledger
.
seed
=
932
dfe23
-
fe23232f
-
283
f32fa
-
dd32aa76
-
8322
ca2f
-
56236
cda
-
7136
b322
-
cb323ffe
#账本的描述名称;此属性不参与共识,仅仅在当前参与方的本地节点用于描述用途;
#ledger.name=
#参与方的个数,后续以 cons_parti.id 分别标识每一个参与方的配置;
cons_parti
.
count
=
4
#第0个参与方的名称
cons_parti
.
0
.
name
=
xx
-
0
.
com
#第0个参与方的公钥文件路径
cons_parti
.
0
.
pubkey
-
path
=
#第0个参与方的公钥内容(由keygen工具生成),此参数优先于 pubkey-path 参数
cons_parti
.
0
.
pubkey
=
endPsK36koyFr1D245Sa9j83vt6pZUdFBJoJRB3xAsWM6cwhRbna
#第0个参与方的账本初始服务的主机
cons_parti
.
0
.
initializer
.
host
=
127
.
0
.
0
.
1
#第0个参与方的账本初始服务的端口
cons_parti
.
0
.
initializer
.
port
=
17000
#第0个参与方的账本初始服务是否开启安全连接
cons_parti
.
0
.
initializer
.
secure
=
false
#第1个参与方的名称
cons_parti
.
1
.
name
=
xx
-
1
.
com
#第1个参与方的公钥文件路径
cons_parti
.
1
.
pubkey
-
path
=
#第1个参与方的公钥内容(由keygen工具生成),此参数优先于 pubkey-path 参数
cons_parti
.
1
.
pubkey
=
endPsK36sC5JdPCDPDAXUwZtS3sxEmqEhFcC4whayAsTTh8Z6eoZ
#第1个参与方的账本初始服务的主机
cons_parti
.
1
.
initializer
.
host
=
127
.
0
.
0
.
1
#第1个参与方的账本初始服务的端口
cons_parti
.
1
.
initializer
.
port
=
17010
#第1个参与方的账本初始服务是否开启安全连接
cons_parti
.
1
.
initializer
.
secure
=
false
#第2个参与方的名称
cons_parti
.
2
.
name
=
xx
-
2
.
com
#第2个参与方的公钥文件路径
cons_parti
.
2
.
pubkey
-
path
=
#第2个参与方的公钥内容(由keygen工具生成),此参数优先于 pubkey-path 参数
cons_parti
.
2
.
pubkey
=
endPsK36jEG281HMHeh6oSqzqLkT95DTnCM6REDURjdb2c67uR3R
#第2个参与方的账本初始服务的主机
cons_parti
.
2
.
initializer
.
host
=
127
.
0
.
0
.
1
#第2个参与方的账本初始服务的端口
cons_parti
.
2
.
initializer
.
port
=
17020
#第2个参与方的账本初始服务是否开启安全连接
cons_parti
.
2
.
initializer
.
secure
=
false
#第3个参与方的名称
cons_parti
.
3
.
name
=
xx
-
3
.
com
#第3个参与方的公钥文件路径
cons_parti
.
3
.
pubkey
-
path
=
#第3个参与方的公钥内容(由keygen工具生成),此参数优先于 pubkey-path 参数
cons_parti
.
3
.
pubkey
=
endPsK36nse1dck4uF19zPvAMijCV336Y3zWdgb4rQG8QoRj5ktR
#第3个参与方的账本初始服务的主机
cons_parti
.
3
.
initializer
.
host
=
127
.
0
.
0
.
1
#第3个参与方的账本初始服务的端口
cons_parti
.
3
.
initializer
.
port
=
17030
#第3个参与方的账本初始服务是否开启安全连接
cons_parti
.
3
.
initializer
.
secure
=
false
source/deployment/deployment-peer/src/main/resources/config/init/mq/ledger.init
0 → 100644
浏览文件 @
f73a2280
#账本的种子;一段16进制字符,最长可以包含64个字符;可以用字符“-”分隔,以便更容易读取;
ledger.seed=932dfe23-fe23232f-283f32fa-dd32aa76-8322ca2f-56236cda-7136b322-cb323ffe
#账本的描述名称;此属性不参与共识,仅仅在当前参与方的本地节点用于描述用途;
ledger.name=
#声明的账本创建时间;格式为 “yyyy-MM-dd HH:mm:ss.SSSZ”,表示”年-月-日 时:分:秒:毫秒时区“;例如:“2019-08-01 14:26:58.069+0800”,其中,+0800 表示时区是东8区
created-time=2019-08-01 14:26:58.069+0800
#共识服务提供者;必须;
consensus.service-provider=com.jd.blockchain.consensus.mq.MsgQueueConsensusProvider
#共识服务的参数配置;必须;
consensus.conf=classpath:mq.config
#密码服务提供者列表,以英文逗点“,”分隔;必须;
crypto.service-providers=com.jd.blockchain.crypto.service.classic.ClassicCryptoService, \
com.jd.blockchain.crypto.service.sm.SMCryptoService
#参与方的个数,后续以 cons_parti.id 分别标识每一个参与方的配置;
cons_parti.count=4
#第0个参与方的名称;
cons_parti.0.name=jd.com
#第0个参与方的公钥文件路径;
cons_parti.0.pubkey-path=keys/jd-com.pub
#第0个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.0.pubkey=3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9
#第0个参与方的账本初始服务的主机;
cons_parti.0.initializer.host=127.0.0.1
#第0个参与方的账本初始服务的端口;
cons_parti.0.initializer.port=8800
#第0个参与方的账本初始服务是否开启安全连接;
cons_parti.0.initializer.secure=false
#第1个参与方的名称;
cons_parti.1.name=at.com
#第1个参与方的公钥文件路径;
cons_parti.1.pubkey-path=keys/at-com.pub
#第1个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.1.pubkey=3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX
#第1个参与方的账本初始服务的主机;
cons_parti.1.initializer.host=127.0.0.1
#第1个参与方的账本初始服务的端口;
cons_parti.1.initializer.port=8810
#第1个参与方的账本初始服务是否开启安全连接;
cons_parti.1.initializer.secure=false
#第2个参与方的名称;
cons_parti.2.name=bt.com
#第2个参与方的公钥文件路径;
cons_parti.2.pubkey-path=classpath:keys/parti2.pub
#第2个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.2.pubkey=
#第2个参与方的账本初始服务的主机;
cons_parti.2.initializer.host=127.0.0.1
#第2个参与方的账本初始服务的端口;
cons_parti.2.initializer.port=8820
#第2个参与方的账本初始服务是否开启安全连接;
cons_parti.2.initializer.secure=false
#第3个参与方的名称;
cons_parti.3.name=xt.com
#第3个参与方的公钥文件路径;
cons_parti.3.pubkey-path=keys/xt-com.pub
#第3个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.3.pubkey=3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk
#第3个参与方的账本初始服务的主机;
cons_parti.3.initializer.host=127.0.0.1
#第3个参与方的账本初始服务的端口;
cons_parti.3.initializer.port=8830
#第3个参与方的账本初始服务是否开启安全连接;
cons_parti.3.initializer.secure=false
source/deployment/deployment-peer/src/main/resources/config/init/mq/local.conf
浏览文件 @
f73a2280
...
...
@@ -2,31 +2,22 @@
local
.
parti
.
id
=
0
#当前参与方的公钥
local
.
parti
.
pubkey
=
endPsK36koyFr1D245Sa9j83vt6pZUdFBJoJRB3xAsWM6cwhRbna
local
.
parti
.
pubkey
=
#当前参与方的私钥(密文编码)
local
.
parti
.
privkey
=
177
gjsj5PHeCpbAtJE7qnbmhuZMHAEKuMsd45zHkv8F8AWBvTBbff8yRKdCyT3kwrmAjSnY
local
.
parti
.
privkey
=
#当前参与方的私钥解密密钥(原始口令的一次哈希,Base58格式),如果不设置,则启动过程中需要从控制台输入
local
.
parti
.
pwd
=
DYu3G8aGTMBW1WrTw76zxQJQU4DHLw9MLyy7peG4LKkY
local
.
parti
.
pwd
=
#账本初始化完成后生成的"账本绑定配置文件"的输出目录
#推荐使用绝对路径,相对路径以当前文件(local.conf)所在目录为基准
ledger
.
binding
.
out
=../
#账本数据库的连接字符
#rocksdb数据库连接格式:rocksdb://{path}
#redis数据库连接格式:redis://{ip}:{prot}/{db}
ledger
.
db
.
uri
=
rocksdb
:///
export
/
App08
/
peer
/
rocks
.
db
/
rocksdb0
.
db
#rocksdb数据库连接格式:rocksdb://{path}
,例如:rocksdb:///export/App08/peer/rocks.db/rocksdb0.db
#redis数据库连接格式:redis://{ip}:{prot}/{db}
,例如:redis://127.0.0.1:6379/0
ledger
.
db
.
uri
=
#账本数据库的连接口令
ledger
.
db
.
pwd
=
#共识配置文件路径
#推荐使用绝对路径,相对路径以当前文件(local.conf)所在目录为基准
consensus
.
conf
=
mq
.
config
#共识Providers配置
#BftSmart共识Provider:com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider
#简单消息共识Provider:com.jd.blockchain.consensus.mq.MsgQueueConsensusProvider
consensus
.
service
-
provider
=
com
.
jd
.
blockchain
.
consensus
.
bftsmart
.
BftsmartConsensusProvider
ledger
.
db
.
pwd
=
\ No newline at end of file
source/deployment/deployment-peer/src/main/resources/scripts/ledger-init.sh
浏览文件 @
f73a2280
...
...
@@ -5,5 +5,5 @@ boot_file=$(ls ../libs | grep tools-initializer-booter-)
if
[
!
-n
"
$boot_file
"
]
;
then
echo
"tools-initializer-booter is null"
else
java
-jar
$HOME
/libs/
$boot_file
-l
$HOME
/config/init/local.conf
-i
$HOME
/config/init/ledger
-init.conf
$*
java
-jar
$HOME
/libs/
$boot_file
-l
$HOME
/config/init/local.conf
-i
$HOME
/config/init/ledger
.init
$*
fi
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/IntegrationTest.java
浏览文件 @
f73a2280
...
...
@@ -52,6 +52,7 @@ import com.jd.blockchain.utils.net.NetworkAddress;
import
test.com.jd.blockchain.intgr.IntegratedContext.Node
;
import
test.com.jd.blockchain.intgr.perf.LedgerInitializeWebTest
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
public
class
IntegrationTest
{
// 合约测试使用的初始化数据;
...
...
@@ -435,7 +436,9 @@ public class IntegrationTest {
LedgerInitProperties
initSetting
=
loadInitSetting_integration
();
Properties
props
=
LedgerInitializeWebTest
.
loadConsensusSetting
();
ConsensusProvider
csProvider
=
getConsensusProvider
();
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/consensus/ConsensusTest.java
浏览文件 @
f73a2280
...
...
@@ -188,7 +188,9 @@ public class ConsensusTest {
LedgerInitProperties
initSetting
=
loadInitSetting_integration
();
Properties
props
=
Utils
.
loadConsensusSetting
();
ConsensusProvider
csProvider
=
getConsensusProvider
();
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/GlobalPerformanceTest.java
浏览文件 @
f73a2280
...
...
@@ -186,7 +186,9 @@ public class GlobalPerformanceTest {
LedgerInitProperties
initSetting
=
loadInitSetting_integration
();
Properties
props
=
Utils
.
loadConsensusSetting
();
ConsensusProvider
csProvider
=
getConsensusProvider
();
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/LedgerInitializeWebTest.java
浏览文件 @
f73a2280
...
...
@@ -75,7 +75,9 @@ public class LedgerInitializeWebTest {
Properties
props
=
loadConsensusSetting
();
// ConsensusProperties csProps = new ConsensusProperties(props);
ConsensusProvider
csProvider
=
getConsensusProvider
();
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
@@ -240,7 +242,9 @@ public class LedgerInitializeWebTest {
Properties
props
=
loadConsensusSetting
();
// ConsensusProperties csProps = new ConsensusProperties(props);
ConsensusProvider
csProvider
=
getConsensusProvider
();
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/LedgerPerformanceTest.java
浏览文件 @
f73a2280
...
...
@@ -495,7 +495,9 @@ public class LedgerPerformanceTest {
LedgerInitProperties
initSetting
=
loadInitSetting
();
Properties
props
=
loadConsensusSetting
(
config
);
ConsensusProvider
csProvider
=
getConsensusProvider
(
provider
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
DBSetting
dbsetting0
;
DBSetting
dbsetting1
;
...
...
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/Utils.java
浏览文件 @
f73a2280
...
...
@@ -9,6 +9,8 @@ import java.util.concurrent.ConcurrentHashMap;
import
com.jd.blockchain.crypto.*
;
import
com.jd.blockchain.crypto.service.classic.ClassicCryptoService
;
import
com.jd.blockchain.crypto.service.sm.SMCryptoService
;
import
com.jd.blockchain.ledger.ParticipantNode
;
import
com.jd.blockchain.tools.keygen.KeyGenCommand
;
import
org.springframework.core.io.ClassPathResource
;
import
com.jd.blockchain.consensus.ConsensusProvider
;
...
...
@@ -72,6 +74,14 @@ public class Utils {
}
}
public
static
ParticipantNode
[]
loadParticipantNodes
()
{
ParticipantNode
[]
participantNodes
=
new
ParticipantNode
[
PUB_KEYS
.
length
];
for
(
int
i
=
0
;
i
<
PUB_KEYS
.
length
;
i
++)
{
participantNodes
[
i
]
=
new
PartNode
(
i
,
KeyGenCommand
.
decodePubKey
(
PUB_KEYS
[
i
]));
}
return
participantNodes
;
}
public
static
class
NodeContext
{
private
LedgerManager
ledgerManager
=
new
LedgerManager
();
...
...
@@ -215,4 +225,46 @@ public class Utils {
}
private
static
class
PartNode
implements
ParticipantNode
{
private
int
id
;
private
String
address
;
private
String
name
;
private
PubKey
pubKey
;
public
PartNode
(
int
id
,
PubKey
pubKey
)
{
this
(
id
,
id
+
""
,
pubKey
);
}
public
PartNode
(
int
id
,
String
name
,
PubKey
pubKey
)
{
this
.
id
=
id
;
this
.
name
=
name
;
this
.
pubKey
=
pubKey
;
this
.
address
=
pubKey
.
toBase58
();
}
@Override
public
int
getId
()
{
return
id
;
}
@Override
public
String
getAddress
()
{
return
address
;
}
@Override
public
String
getName
()
{
return
name
;
}
@Override
public
PubKey
getPubKey
()
{
return
pubKey
;
}
}
}
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBaseTest.java
浏览文件 @
f73a2280
...
...
@@ -29,6 +29,7 @@ import com.jd.blockchain.utils.net.NetworkAddress;
import
test.com.jd.blockchain.intgr.IntegratedContext.Node
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsTest
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsTest.NodeWebContext
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
public
class
IntegrationBaseTest
{
...
...
@@ -122,7 +123,9 @@ public class IntegrationBaseTest {
LedgerInitProperties
initSetting
=
loadInitSetting_integration
();
Properties
props
=
LedgerInitializeWeb4SingleStepsTest
.
loadConsensusSetting
(
configPath
);
ConsensusProvider
csProvider
=
LedgerInitConsensusConfig
.
getConsensusProvider
(
providerName
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTest2.java
浏览文件 @
f73a2280
...
...
@@ -42,6 +42,7 @@ import test.com.jd.blockchain.intgr.IntegratedContext.Node;
import
test.com.jd.blockchain.intgr.contract.AssetContract
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsTest
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsTest.NodeWebContext
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
/**
* 测试合约,提交后不立即进行验证,因为此时可能还没有完成正式结块;
...
...
@@ -160,7 +161,9 @@ public class IntegrationTest2 {
LedgerInitProperties
initSetting
=
loadInitSetting_integration
();
Properties
props
=
LedgerInitializeWeb4SingleStepsTest
.
loadConsensusSetting
(
config
.
getConfigPath
());
ConsensusProvider
csProvider
=
LedgerInitConsensusConfig
.
getConsensusProvider
(
config
.
getProvider
());
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationTestDataAccount.java
浏览文件 @
f73a2280
...
...
@@ -46,6 +46,7 @@ import com.jd.blockchain.utils.net.NetworkAddress;
import
test.com.jd.blockchain.intgr.IntegratedContext.Node
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsTest
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeWeb4SingleStepsTest.NodeWebContext
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
public
class
IntegrationTestDataAccount
{
...
...
@@ -257,7 +258,9 @@ public class IntegrationTestDataAccount {
LedgerInitProperties
initSetting
=
loadInitSetting_integration
();
Properties
props
=
LedgerInitializeWeb4SingleStepsTest
.
loadConsensusSetting
(
config
.
getConfigPath
());
ConsensusProvider
csProvider
=
LedgerInitConsensusConfig
.
getConsensusProvider
(
config
.
getProvider
());
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/initializer/LedgerInitializeWeb4Nodes.java
浏览文件 @
f73a2280
...
...
@@ -27,6 +27,7 @@ import org.springframework.core.io.ClassPathResource;
import
test.com.jd.blockchain.intgr.IntegrationBase
;
import
test.com.jd.blockchain.intgr.LedgerInitConsensusConfig
;
import
test.com.jd.blockchain.intgr.PresetAnswerPrompter
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -70,7 +71,9 @@ public class LedgerInitializeWeb4Nodes {
LedgerInitProperties
initSetting
=
loadInitSetting_2
();
Properties
props
=
loadConsensusSetting
(
config
.
getConfigPath
());
ConsensusProvider
csProvider
=
LedgerInitConsensusConfig
.
getConsensusProvider
(
config
.
getProvider
());
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/initializer/LedgerInitializeWeb4SingleStepsTest.java
浏览文件 @
f73a2280
...
...
@@ -50,6 +50,7 @@ import com.jd.blockchain.utils.net.NetworkAddress;
import
test.com.jd.blockchain.intgr.LedgerInitConsensusConfig
;
import
test.com.jd.blockchain.intgr.PresetAnswerPrompter
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
public
class
LedgerInitializeWeb4SingleStepsTest
{
...
...
@@ -77,7 +78,9 @@ public class LedgerInitializeWeb4SingleStepsTest {
// 加载共识配置;
Properties
props
=
loadConsensusSetting
(
consensusConfig
.
getConfigPath
());
ConsensusProvider
csProvider
=
LedgerInitConsensusConfig
.
getConsensusProvider
(
consensusConfig
.
getProvider
());
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
// 启动服务器;
NetworkAddress
initAddr0
=
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
();
...
...
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/ledger/LedgerBlockGeneratingTest.java
浏览文件 @
f73a2280
...
...
@@ -45,6 +45,7 @@ import com.jd.blockchain.utils.net.NetworkAddress;
import
test.com.jd.blockchain.intgr.PresetAnswerPrompter
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeTest
;
import
test.com.jd.blockchain.intgr.initializer.LedgerInitializeTest.NodeContext
;
import
test.com.jd.blockchain.intgr.perf.Utils
;
public
class
LedgerBlockGeneratingTest
{
...
...
@@ -128,7 +129,9 @@ public class LedgerBlockGeneratingTest {
LedgerInitProperties
initSetting
=
loadInitSetting
();
Properties
props
=
loadConsensusSetting
();
ConsensusProvider
csProvider
=
getConsensusProvider
();
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
().
createSettings
(
props
);
ConsensusSettings
csProps
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
props
,
Utils
.
loadParticipantNodes
());
NodeContext
node0
=
new
NodeContext
(
initSetting
.
getConsensusParticipant
(
0
).
getInitializerAddress
(),
serviceRegisterMap
);
...
...
source/test/test-integration/src/test/resources/bftsmart.config
浏览文件 @
f73a2280
...
...
@@ -14,58 +14,36 @@
# limitations under the License.
############################################
###### Consensus Commit Block Parameters: transaction count ######
############################################
system
.
block
.
txsize
=
15
############################################
###### Consensus Commit Block Parameters: delay time ######
############################################
system
.
block
.
maxdelay
=
500
############################################
###### Consensus Participant0 ######
############################################
system
.
server
.
0
.
pubkey
=
3
snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9
system
.
server
.
0
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
0
.
network
.
port
=
8910
system
.
server
.
0
.
network
.
secure
=
false
############################################
###### #Consensus Participant1 ######
############################################
system
.
server
.
1
.
pubkey
=
3
snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX
system
.
server
.
1
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
1
.
network
.
port
=
8920
system
.
server
.
1
.
network
.
secure
=
false
############################################
###### #Consensus Participant2 ######
############################################
system
.
server
.
2
.
pubkey
=
3
snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x
system
.
server
.
2
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
2
.
network
.
port
=
8930
system
.
server
.
2
.
network
.
secure
=
false
############################################
###### Consensus Participant3 ######
############################################
system
.
server
.
3
.
pubkey
=
3
snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk
system
.
server
.
3
.
network
.
host
=
127
.
0
.
0
.
1
system
.
server
.
3
.
network
.
port
=
8940
system
.
server
.
3
.
network
.
secure
=
false
############################################
...
...
@@ -174,5 +152,4 @@ system.ttp.id = 7002
system
.
bft
=
true
#Custom View Storage;
#view.storage.handler=bftsmart.reconfiguration.views.DefaultViewStorage
#
view
.
storage
.
handler
=
bftsmart
.
reconfiguration
.
views
.
DefaultViewStorage
\ No newline at end of file
source/test/test-integration/src/test/resources/ledger.init
浏览文件 @
f73a2280
...
...
@@ -5,7 +5,6 @@ ledger.seed=932dfe23-fe23232f-283f32fa-dd32aa76-8322ca2f-56236cda-7136b322-cb323
#账本的描述名称;此属性不参与共识,仅仅在当前参与方的本地节点用于描述用途;
ledger.name=
#共识服务提供者;必须;
consensus.service-provider=com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider
...
...
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java
浏览文件 @
f73a2280
...
...
@@ -95,6 +95,14 @@ public class LedgerInitProperties {
return
consensusParticipants
;
}
public
ParticipantNode
[]
getConsensusParticipantNodes
()
{
if
(
consensusParticipants
.
isEmpty
())
{
return
null
;
}
ParticipantNode
[]
participantNodes
=
new
ParticipantNode
[
consensusParticipants
.
size
()];
return
consensusParticipants
.
toArray
(
participantNodes
);
}
public
String
[]
getCryptoProviders
()
{
return
cryptoProviders
.
clone
();
}
...
...
@@ -106,7 +114,7 @@ public class LedgerInitProperties {
/**
* 返回参与者;
*
* @param
address
从 1 开始; 小于等于 {@link #getConsensusParticipantCount()};
* @param
id
从 1 开始; 小于等于 {@link #getConsensusParticipantCount()};
* @return
*/
public
ConsensusParticipantConfig
getConsensusParticipant
(
int
id
)
{
...
...
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/web/LedgerInitializeWebController.java
浏览文件 @
f73a2280
...
...
@@ -181,8 +181,9 @@ public class LedgerInitializeWebController implements LedgerInitProcess, LedgerI
Properties
csProps
=
ledgerInitProps
.
getConsensusConfig
();
ConsensusProvider
csProvider
=
ConsensusProviders
.
getProvider
(
ledgerInitProps
.
getConsensusProvider
());
ConsensusSettings
csSettings
=
csProvider
.
getSettingsFactory
().
getConsensusSettingsBuilder
()
.
createSettings
(
csProps
);
ConsensusSettings
csSettings
=
csProvider
.
getSettingsFactory
()
.
getConsensusSettingsBuilder
()
.
createSettings
(
csProps
,
ledgerInitProps
.
getConsensusParticipantNodes
());
setConsensusProvider
(
csProvider
);
prompter
.
info
(
"Init settings and sign permision..."
);
...
...
@@ -335,7 +336,9 @@ public class LedgerInitializeWebController implements LedgerInitProcess, LedgerI
initSetting
.
setCryptoSetting
(
cryptoSetting
);
List
<
ConsensusParticipantConfig
>
partiList
=
ledgerProps
.
getConsensusParticipants
();
ConsensusParticipantConfig
[]
parties
=
partiList
.
toArray
(
new
ConsensusParticipantConfig
[
partiList
.
size
()]);
ConsensusParticipantConfig
[]
parties
=
new
ConsensusParticipantConfig
[
partiList
.
size
()];
parties
=
partiList
.
toArray
(
parties
);
// ConsensusParticipantConfig[] parties = partiList.toArray(new ConsensusParticipantConfig[partiList.size()]);
ConsensusParticipantConfig
[]
orderedParties
=
sortAndVerify
(
parties
);
initSetting
.
setConsensusParticipants
(
orderedParties
);
initSetting
.
setCreatedTime
(
ledgerProps
.
getCreatedTime
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录