Skip to content

Commit

Permalink
[FAB-9839] Fix pending comments for purge CRs
Browse files Browse the repository at this point in the history
This CR fixes a couple of minor comments that
were skipped in the original CRs for saving
efforts of rebasing etc.

Change-Id: I0c3f0838ea69fe14baabbcc167c5223c51f72df9
Signed-off-by: manish <manish.sethi@gmail.com>
  • Loading branch information
manish-sethi committed May 2, 2018
1 parent 109db5b commit ded05a8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/ledger/kvledger/txmgmt/privacyenabledstate/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func (p PvtUpdateBatch) ToCompositeKeyMap() map[PvtdataCompositeKey]*statedb.Ver
return m
}

// String returns a print friendly form of HashedCompositeKey
func (hck *HashedCompositeKey) String() string {
return fmt.Sprintf("ns=%s, collection=%s, keyHash=%x", hck.Namespace, hck.CollectionName, hck.KeyHash)
}
2 changes: 2 additions & 0 deletions core/ledger/kvledger/txmgmt/privacyenabledstate/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ func TestCompositeKeyMap(t *testing.T) {
testutil.AssertEquals(t, ok, true)
_, ok = m[PvtdataCompositeKey{"ns2", "coll2", "key2"}]
testutil.AssertEquals(t, ok, true)
_, ok = m[PvtdataCompositeKey{"ns2", "coll1", "key8888"}]
testutil.AssertEquals(t, ok, false)
}

func putPvtUpdates(t *testing.T, updates *UpdateBatch, ns, coll, key string, value []byte, ver *version.Height) {
Expand Down
4 changes: 2 additions & 2 deletions core/ledger/pvtdatapolicy/btlpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/hyperledger/fabric/protos/common"
)

var defaultBLT uint64 = math.MaxUint64
var defaultBTL uint64 = math.MaxUint64

// BTLPolicy BlockToLive policy for the pvt data
type BTLPolicy interface {
Expand Down Expand Up @@ -70,7 +70,7 @@ func (p *LSCCBasedBTLPolicy) GetBTL(namesapce string, collection string) (uint64
if btlConfigured > 0 {
btl = uint64(btlConfigured)
} else {
btl = defaultBLT
btl = defaultBTL
}
p.cache[key] = btl
}
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/pvtdatapolicy/btlpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestBTLPolicy(t *testing.T) {

btl3, err := btlPolicy.GetBTL("ns1", "coll3")
assert.NoError(t, err)
assert.Equal(t, defaultBLT, btl3)
assert.Equal(t, defaultBTL, btl3)

_, err = btlPolicy.GetBTL("ns1", "coll4")
_, ok := err.(privdata.NoSuchCollectionError)
Expand Down

0 comments on commit ded05a8

Please sign in to comment.