Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Configure function to the ordering service
Browse files Browse the repository at this point in the history
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
adecaro authored and alexandrosfilios committed Dec 25, 2024
1 parent e669c49 commit 835f0e4
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions platform/fabric/core/generic/committer/committer.go
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ type CommitTx struct {
type TransactionHandler = func(ctx context.Context, block *common.BlockMetadata, tx CommitTx) (*FinalityEvent, error)

type OrderingService interface {
SetConfigOrderers(o channelconfig.Orderer, orderers []*grpc.ConnectionConfig) error
Configure(consensusType string, orderers []*grpc.ConnectionConfig) error
}

type Committer struct {
@@ -904,7 +904,7 @@ func (c *Committer) applyBundle(bundle *channelconfig.Bundle) error {
}
if len(newOrderers) != 0 {
c.logger.Debugf("[Channel: %s] Updating the list of orderers: (%d) found", c.ChannelConfig.ID(), len(newOrderers))
return c.OrderingService.SetConfigOrderers(ordererConfig, newOrderers)
return c.OrderingService.Configure(ordererConfig.ConsensusType(), newOrderers)
}
c.logger.Infof("[Channel: %s] No orderers found in Channel config", c.ChannelConfig.ID())

6 changes: 2 additions & 4 deletions platform/fabric/core/generic/ordering/ordering.go
Original file line number Diff line number Diff line change
@@ -14,11 +14,9 @@ import (
"github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging"
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/metrics"
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/flogging"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
common2 "github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/pkg/errors"
"go.uber.org/zap/zapcore"
context2 "golang.org/x/net/context"
@@ -138,8 +136,8 @@ func (o *Service) SetConsensusType(consensusType ConsensusType) error {
return nil
}

func (f *Service) SetConfigOrderers(o channelconfig.Orderer, orderers []*grpc.ConnectionConfig) error {
if err := f.SetConsensusType(o.ConsensusType()); err != nil {
func (f *Service) Configure(consensusType string, orderers []*grpc.ConnectionConfig) error {
if err := f.SetConsensusType(consensusType); err != nil {
return errors.WithMessagef(err, "failed to set consensus type from channel config")
}
if err := f.ConfigService.SetConfigOrderers(orderers); err != nil {

0 comments on commit 835f0e4

Please sign in to comment.