Skip to content

Commit 965ce80

Browse files
author
Jason Yellick
committed
FAB-16483 Improve error message
Because channel creation txes and config update txes use the same format, explicitly calling out whether the tx is being processed for an existing channel will help reduce user confusion. Signed-off-by: Jason Yellick <jyellick@us.ibm.com> Change-Id: I0843afdb54802dda181ab41e24328a1560bec268
1 parent 50152af commit 965ce80

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

orderer/common/msgprocessor/standardchannel.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ func (s *StandardChannel) ProcessNormalMsg(env *cb.Envelope) (configSeq uint64,
118118
// return the resulting config message and the configSeq the config was computed from. If the config impetus message
119119
// is invalid, an error is returned.
120120
func (s *StandardChannel) ProcessConfigUpdateMsg(env *cb.Envelope) (config *cb.Envelope, configSeq uint64, err error) {
121-
logger.Debugf("Processing config update message for channel %s", s.support.ChannelID())
121+
logger.Debugf("Processing config update message for exisitng channel %s", s.support.ChannelID())
122122

123123
// Call Sequence first. If seq advances between proposal and acceptance, this is okay, and will cause reprocessing
124124
// however, if Sequence is called last, then a success could be falsely attributed to a newer configSeq
125125
seq := s.support.Sequence()
126126
err = s.filters.Apply(env)
127127
if err != nil {
128-
return nil, 0, err
128+
return nil, 0, errors.WithMessage(err, "config update for existing channel did not pass initial checks")
129129
}
130130

131131
configEnvelope, err := s.support.ProposeConfigUpdate(env)
@@ -145,12 +145,12 @@ func (s *StandardChannel) ProcessConfigUpdateMsg(env *cb.Envelope) (config *cb.E
145145
// check is negligible, as this is the reconfig path and not the normal path.
146146
err = s.filters.Apply(config)
147147
if err != nil {
148-
return nil, 0, err
148+
return nil, 0, errors.WithMessage(err, "config update for existing channel did not pass final checks")
149149
}
150150

151151
err = s.maintenanceFilter.Apply(config)
152152
if err != nil {
153-
return nil, 0, err
153+
return nil, 0, errors.WithMessage(err, "config update for existing channel did not pass maintenance checks")
154154
}
155155

156156
return config, seq, nil

orderer/common/msgprocessor/systemchannel_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/hyperledger/fabric/internal/pkg/identity"
2323
"github.com/hyperledger/fabric/orderer/common/msgprocessor/mocks"
2424
"github.com/hyperledger/fabric/protoutil"
25+
"github.com/pkg/errors"
2526
"github.com/stretchr/testify/assert"
2627
"github.com/stretchr/testify/require"
2728
)
@@ -239,7 +240,7 @@ func TestSystemChannelConfigUpdateMsg(t *testing.T) {
239240
},
240241
}),
241242
})
242-
assert.Equal(t, RejectRule.Apply(nil), err)
243+
assert.Equal(t, RejectRule.Apply(nil), errors.Cause(err))
243244
})
244245
t.Run("Good", func(t *testing.T) {
245246
mscs := &mockSystemChannelSupport{

0 commit comments

Comments
 (0)