说明
本文描述了一个不再使用“系统通道”的网络(以前该通道由排序服务引导,并且由排序服务专门控制)。自Fabric v2.3发布以来,在创建通道的过程方法中,使用系统通道现在被视为遗留方案。
在通道配置(在通道的最新配置区块中找到)中,可以为每个通道定义功能需求。通道配置包含三个位置,每个位置定义了不同类型的功能。
功能类型 | 规范路径 | JSON路径 |
Channel | /Channel/Capabilities | .channel_group.values.Capabilities |
Orderer | /Channel/Orderer/Capabilities | .channel_group.groups.Orderer.values.Capabilities |
Application | /Channel/Application/Capabilities | .channel_group.groups.Application.values. Capabilities |
功能设置
功能设置是通道配置的一部分(要么作为初始配置,要么作为重新配置的一部分)。
有关如何更新通道配置的更多信息,请查看更新通道配置。
初始配置中的功能
在最新下载安装的Fabric(V2.5.4)的目录fabric-samples中的config
子目录下的 configtx.yaml
文件中,有一个 Capabilities
部分,列举了每种功能类型(通道、排序节点和应用程序)的可能功能。
Capabilities:
# Channel capabilities apply to both the orderers and the peers and must be
# supported by both.
# Set the value of the capability to true to require it.
Channel: &ChannelCapabilities
# V2.0 for Channel is a catchall flag for behavior which has been
# determined to be desired for all orderers and peers running at the v2.0.0
# level, but which would be incompatible with orderers and peers from
# prior releases.
# Prior to enabling V2.0 channel capabilities, ensure that all
# orderers and peers on a channel are at v2.0.0 or later.
V2_0: true
# Orderer capabilities apply only to the orderers, and may be safely
# used with prior release peers.
# Set the value of the capability to true to require it.
Orderer: &OrdererCapabilities
# V1.1 for Orderer is a catchall flag for behavior which has been
# determined to be desired for all orderers running at the v1.1.x
# level, but which would be incompatible with orderers from prior releases.
# Prior to enabling V2.0 orderer capabilities, ensure that all
# orderers on a channel are at v2.0.0 or later.
V2_0: true
# Application capabilities apply only to the peer network, and may be safely
# used with prior release orderers.
# Set the value of the capability to true to require it.
Application: &ApplicationCapabilities
# V2.5 for Application enables the new non-backwards compatible
# features of fabric v2.5, namely the ability to purge private data.
# Prior to enabling V2.5 application capabilities, ensure that all
# peers on a channel are at v2.5.0 or later.
V2_5: true
请注意, Capabilities
在根级别(用于通道功能)和 Orderer 级别(用于排序节点功能)各有一个定义部分。上边的示例使用 YAML 引用了在 YAML 文件底部定义的功能。
定义排序服务通道的时候没有 Application 部分,它在创建应用通道的时候会被创建。
这里,Application 部分有一个新元素 Capabilities
,引用了 YAML 最后部分的 ApplicationCapabilities
。
参考
- https://hyperledger-fabric.readthedocs.io/en/latest/capability_requirements.html
- https://hyperledger-fabric.readthedocs.io/en/latest/config_update.html
- https://hyperledger-fabric.readthedocs.io/en/latest/channel_update_tutorial.html