Skip to content

Commit

Permalink
FAB-14865 - Fix log message
Browse files Browse the repository at this point in the history
This CR fixes a log message such that it prints the
height in readable form as opposed to in hex.

Not closing this Jira for now - as we can use this to
fix the similar issue elsewhere as well

Change-Id: Id4b79cc280605a23bc00589497b4f0120a72d99a
Signed-off-by: manish <manish.sethi@gmail.com>
  • Loading branch information
manish-sethi committed Mar 28, 2019
1 parent 97047a6 commit 6e9b2e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (h *queryHelper) getPrivateData(ns, coll, key string) ([]byte, error) {
}
if !version.AreSame(hashVersion, ver) {
return nil, &txmgr.ErrPvtdataNotAvailable{Msg: fmt.Sprintf(
"private data matching public hash version is not available. Public hash version = %#v, Private data version = %#v",
"private data matching public hash version is not available. Public hash version = %s, Private data version = %s",
hashVersion, ver)}
}
if h.rwsetBuilder != nil {
Expand Down
11 changes: 10 additions & 1 deletion core/ledger/kvledger/txmgmt/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ limitations under the License.

package version

import "github.com/hyperledger/fabric/common/ledger/util"
import (
"fmt"

"github.com/hyperledger/fabric/common/ledger/util"
)

// Height represents the height of a transaction in blockchain
type Height struct {
Expand Down Expand Up @@ -63,6 +67,11 @@ func (h *Height) Compare(h1 *Height) int {
return -1
}

// String returns string for printing
func (h *Height) String() string {
return fmt.Sprintf("{BlockNum: %d, TxNum: %d}", h.BlockNum, h.TxNum)
}

// AreSame returns true if both the heights are either nil or equal
func AreSame(h1 *Height, h2 *Height) bool {
if h1 == nil {
Expand Down

0 comments on commit 6e9b2e8

Please sign in to comment.