1 Star 0 Fork 0

妥協/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
configtx_util.go 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package peer
import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/protos/common"
)
// computeFullConfig computes the full resource configuration given the current resource bundle and the transaction (that contains the delta)
func computeFullConfig(currentConfigBundle *channelconfig.Bundle, channelConfTx *common.Envelope) (*common.Config, error) {
fullChannelConfigEnv, err := currentConfigBundle.ConfigtxValidator().ProposeConfigUpdate(channelConfTx)
if err != nil {
return nil, err
}
return fullChannelConfigEnv.Config, nil
}
// TODO preferably make the serialize/deserialize deterministic
func serialize(resConfig *common.Config) ([]byte, error) {
return proto.Marshal(resConfig)
}
func deserialize(serializedConf []byte) (*common.Config, error) {
conf := &common.Config{}
if err := proto.Unmarshal(serializedConf, conf); err != nil {
return nil, err
}
return conf, nil
}
// retrievePersistedChannelConfig retrieves the persisted channel config from statedb
func retrievePersistedChannelConfig(ledger ledger.PeerLedger) (*common.Config, error) {
qe, err := ledger.NewQueryExecutor()
if err != nil {
return nil, err
}
defer qe.Done()
return retrievePersistedConf(qe, channelConfigKey)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liurenhao/fabric.git
git@gitee.com:liurenhao/fabric.git
liurenhao
fabric
fabric
v1.4.1-rc1

搜索帮助