Skip to content

Commit

Permalink
[FAB-11955] Enhanced error message for SB validation
Browse files Browse the repository at this point in the history
This change set logs cc:coll:key and full block height in case of SBEP
validation error.

Change-Id: Ie7804c49e0ddfbb3dfcbeda86eaddbb6347528df
Signed-off-by: Alessandro Sorniotti <[email protected]>
Signed-off-by: Matthias Neugschwandtner <[email protected]>
  • Loading branch information
ale-linux committed Sep 11, 2018
1 parent 9c4939f commit bf71b46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/common/validation/statebased/vpmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ import (
// Validation Parameters for a key could not be
// supplied because they are being updated
type ValidationParameterUpdatedError struct {
CC string
Coll string
Key string
Height uint64
Txnum uint64
}

func (f *ValidationParameterUpdatedError) Error() string {
return fmt.Sprintf("validation parameters for key %s have been changed in a transaction in block %d", f.Key, f.Height)
return fmt.Sprintf("validation parameters for key [%s] in namespace [%s:%s] have been changed in transaction %d of block %d", f.Key, f.CC, f.Coll, f.Txnum, f.Height)
}

// KeyLevelValidationParameterManager is used by validation plugins in order
Expand Down
3 changes: 3 additions & 0 deletions core/common/validation/statebased/vpmanagerimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,11 @@ func (c *validationContext) waitForValidationResults(kid *ledgerKeyID, blockNum
for _, dep := range c.dependenciesForTxnum(kid, txnum) {
if valErr := dep.waitForAndRetrieveValidationResult(kid.cc); valErr == nil {
return &ValidationParameterUpdatedError{
CC: kid.cc,
Coll: kid.coll,
Key: kid.key,
Height: blockNum,
Txnum: txnum,
}
}
}
Expand Down

0 comments on commit bf71b46

Please sign in to comment.