Skip to content

Commit db3a694

Browse files
committed
Fix typo in code and rename method
1.Change 'detaultStateImpl' to 'defaultStateImpl' in state.go. 2.Rename method IsDelete() to IsDeleted() in state_delta.go. Change-Id: I8afc4aa4542ca9fed1f904db4ae5e79d8d0f4599 Signed-off-by: grapebaba <[email protected]>
1 parent 47c3f6c commit db3a694

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

core/ledger/statemgmt/raw/state_impl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (impl *StateImpl) AddChangesForPersistence(writeBatch *gorocksdb.WriteBatch
7373
updates := delta.GetUpdates(updatedChaincodeID)
7474
for updatedKey, value := range updates {
7575
compositeKey := statemgmt.ConstructCompositeKey(updatedChaincodeID, updatedKey)
76-
if value.IsDelete() {
76+
if value.IsDeleted() {
7777
writeBatch.DeleteCF(openchainDB.StateCF, compositeKey)
7878
} else {
7979
writeBatch.PutCF(openchainDB.StateCF, compositeKey, value.GetValue())

core/ledger/statemgmt/state/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func loadConfig() {
4242
stateImplName, stateImplConfigs, deltaHistorySize)
4343

4444
if len(stateImplName) == 0 {
45-
stateImplName = detaultStateImpl
45+
stateImplName = defaultStateImpl
4646
stateImplConfigs = nil
4747
} else if stateImplName != "buckettree" && stateImplName != "trie" && stateImplName != "raw" {
4848
panic(fmt.Errorf("Error during initialization of state implementation. State data structure '%s' is not valid.", stateImplName))

core/ledger/statemgmt/state/state.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
var logger = logging.MustGetLogger("state")
3333

34-
const detaultStateImpl = "buckettree"
34+
const defaultStateImpl = "buckettree"
3535

3636
var stateImpl statemgmt.HashableState
3737

core/ledger/statemgmt/state_delta.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (stateDelta *StateDelta) ApplyChanges(anotherStateDelta *StateDelta) {
9696
previousValue = valueHolder.PreviousValue
9797
}
9898

99-
if valueHolder.IsDelete() {
99+
if valueHolder.IsDeleted() {
100100
stateDelta.Delete(chaincodeID, key, previousValue)
101101
} else {
102102
stateDelta.Set(chaincodeID, key, valueHolder.Value, previousValue)
@@ -158,7 +158,7 @@ func (stateDelta *StateDelta) ComputeCryptoHash() []byte {
158158
for _, key := range sortedKeys {
159159
buffer.WriteString(key)
160160
updatedValue := chaincodeStateDelta.get(key)
161-
if !updatedValue.IsDelete() {
161+
if !updatedValue.IsDeleted() {
162162
buffer.Write(updatedValue.Value)
163163
}
164164
}
@@ -225,8 +225,8 @@ type UpdatedValue struct {
225225
PreviousValue []byte
226226
}
227227

228-
// IsDelete checks whether the key was deleted
229-
func (updatedValue *UpdatedValue) IsDelete() bool {
228+
// IsDeleted checks whether the key was deleted
229+
func (updatedValue *UpdatedValue) IsDeleted() bool {
230230
return updatedValue.Value == nil
231231
}
232232

core/ledger/statemgmt/state_delta_iterator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func retrieveRelevantKeys(updates map[string]*UpdatedValue, startKey string, end
3636
return relevantKeys
3737
}
3838
for k, v := range updates {
39-
if k >= startKey && (endKey == "" || k <= endKey) && !v.IsDelete() {
39+
if k >= startKey && (endKey == "" || k <= endKey) && !v.IsDeleted() {
4040
relevantKeys = append(relevantKeys, k)
4141
}
4242
}

core/ledger/statemgmt/trie/trie_delta.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func newTrieDelta(stateDelta *statemgmt.StateDelta) *trieDelta {
3737
for _, chaincodeID := range chaincodes {
3838
updates := stateDelta.GetUpdates(chaincodeID)
3939
for key, updatedvalue := range updates {
40-
if updatedvalue.IsDelete() {
40+
if updatedvalue.IsDeleted() {
4141
trieDelta.delete(chaincodeID, key)
4242
} else {
4343
if stateDelta.RollBackwards {

0 commit comments

Comments
 (0)