6 Star 44 Fork 25

Hyperledger / 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/hyperledger/fabric.git
git@gitee.com:hyperledger/fabric.git
hyperledger
fabric
fabric
v1.4.9

搜索帮助

344bd9b3 5694891 D2dac590 5694891