Commit 0d738341 authored by manish's avatar manish Committed by David Enyeart
Browse files

FAB-14865 - Fix log message



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: default avatarmanish <manish.sethi@gmail.com>
parent be8ae4c1
......@@ -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 {
......
......@@ -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 {
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment