This commit is contained in:
Łukasz Magiera 2020-08-13 13:44:43 +02:00
parent 069c39fc12
commit 3b23ab952b
5 changed files with 13 additions and 19 deletions

View File

@ -41,7 +41,7 @@ func DiffAdtArray(preArr, curArr *adt.Array, out AdtArrayDiff) error {
}
// no modification
if !bytes.Equal(prevVal.Raw,curVal.Raw) {
if !bytes.Equal(prevVal.Raw, curVal.Raw) {
if err := out.Modify(uint64(i), prevVal, curVal); err != nil {
return err
}
@ -95,13 +95,12 @@ func DiffAdtMap(preMap, curMap *adt.Map, out AdtMapDiff) error {
}
// no modification
if !bytes.Equal(prevVal.Raw,curVal.Raw) {
if !bytes.Equal(prevVal.Raw, curVal.Raw) {
if err := out.Modify(key, prevVal, curVal); err != nil {
return err
}
}
return curMap.Delete(k)
}); err != nil {
return err

View File

@ -71,7 +71,6 @@ func TestDiffAdtArray(t *testing.T) {
assert.EqualValues(t, []byte{1}, changes.Removed[1].val)
}
func TestDiffAdtMap(t *testing.T) {
ctxstoreA := newContextStore()
ctxstoreB := newContextStore()
@ -135,7 +134,6 @@ type TestDiffMap struct {
var _ AdtMapDiff = &TestDiffMap{}
func (t *TestDiffMap) AsKey(key string) (adt.Keyer, error) {
k, err := adt.ParseUIntKey(key)
if err != nil {

View File

@ -661,10 +661,8 @@ type AddressChange struct {
type DiffInitActorStateFunc func(ctx context.Context, oldState *init_.State, newState *init_.State) (changed bool, user UserData, err error)
func (i *InitActorAddressChanges) AsKey(key string) (adt.Keyer, error) {
addr , err := address.NewFromBytes([]byte(key))
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return nil, err
}
@ -786,4 +784,3 @@ func (sp *StatePredicates) OnAddressMapChange() DiffInitActorStateFunc {
return true, addressChanges, nil
}
}