gofmt
This commit is contained in:
parent
069c39fc12
commit
3b23ab952b
@ -41,7 +41,7 @@ func DiffAdtArray(preArr, curArr *adt.Array, out AdtArrayDiff) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// no modification
|
// 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 {
|
if err := out.Modify(uint64(i), prevVal, curVal); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -95,13 +95,12 @@ func DiffAdtMap(preMap, curMap *adt.Map, out AdtMapDiff) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// no modification
|
// 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 {
|
if err := out.Modify(key, prevVal, curVal); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return curMap.Delete(k)
|
return curMap.Delete(k)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -71,7 +71,6 @@ func TestDiffAdtArray(t *testing.T) {
|
|||||||
assert.EqualValues(t, []byte{1}, changes.Removed[1].val)
|
assert.EqualValues(t, []byte{1}, changes.Removed[1].val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestDiffAdtMap(t *testing.T) {
|
func TestDiffAdtMap(t *testing.T) {
|
||||||
ctxstoreA := newContextStore()
|
ctxstoreA := newContextStore()
|
||||||
ctxstoreB := newContextStore()
|
ctxstoreB := newContextStore()
|
||||||
@ -128,14 +127,13 @@ func TestDiffAdtMap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TestDiffMap struct {
|
type TestDiffMap struct {
|
||||||
Added []adtMapDiffResult
|
Added []adtMapDiffResult
|
||||||
Modified []TestAdtMapDiffModified
|
Modified []TestAdtMapDiffModified
|
||||||
Removed []adtMapDiffResult
|
Removed []adtMapDiffResult
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ AdtMapDiff = &TestDiffMap{}
|
var _ AdtMapDiff = &TestDiffMap{}
|
||||||
|
|
||||||
|
|
||||||
func (t *TestDiffMap) AsKey(key string) (adt.Keyer, error) {
|
func (t *TestDiffMap) AsKey(key string) (adt.Keyer, error) {
|
||||||
k, err := adt.ParseUIntKey(key)
|
k, err := adt.ParseUIntKey(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -218,7 +216,7 @@ type adtMapDiffResult struct {
|
|||||||
|
|
||||||
type TestAdtMapDiffModified struct {
|
type TestAdtMapDiffModified struct {
|
||||||
From adtMapDiffResult
|
From adtMapDiffResult
|
||||||
To adtMapDiffResult
|
To adtMapDiffResult
|
||||||
}
|
}
|
||||||
|
|
||||||
type adtArrayDiffResult struct {
|
type adtArrayDiffResult struct {
|
||||||
|
@ -649,22 +649,20 @@ type AddressPair struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InitActorAddressChanges struct {
|
type InitActorAddressChanges struct {
|
||||||
Added []AddressPair
|
Added []AddressPair
|
||||||
Modified []AddressChange
|
Modified []AddressChange
|
||||||
Removed []AddressPair
|
Removed []AddressPair
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddressChange struct {
|
type AddressChange struct {
|
||||||
From AddressPair
|
From AddressPair
|
||||||
To AddressPair
|
To AddressPair
|
||||||
}
|
}
|
||||||
|
|
||||||
type DiffInitActorStateFunc func(ctx context.Context, oldState *init_.State, newState *init_.State) (changed bool, user UserData, err error)
|
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) {
|
func (i *InitActorAddressChanges) AsKey(key string) (adt.Keyer, error) {
|
||||||
addr , err := address.NewFromBytes([]byte(key))
|
addr, err := address.NewFromBytes([]byte(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -720,7 +718,7 @@ func (i *InitActorAddressChanges) Modify(key string, from, to *typegen.Deferred)
|
|||||||
ID: fromIDAddr,
|
ID: fromIDAddr,
|
||||||
PK: pkAddr,
|
PK: pkAddr,
|
||||||
},
|
},
|
||||||
To: AddressPair{
|
To: AddressPair{
|
||||||
ID: toIDAddr,
|
ID: toIDAddr,
|
||||||
PK: pkAddr,
|
PK: pkAddr,
|
||||||
},
|
},
|
||||||
@ -786,4 +784,3 @@ func (sp *StatePredicates) OnAddressMapChange() DiffInitActorStateFunc {
|
|||||||
return true, addressChanges, nil
|
return true, addressChanges, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,8 +205,8 @@ var netFindPeer = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var NetReachability = &cli.Command{
|
var NetReachability = &cli.Command{
|
||||||
Name: "reachability",
|
Name: "reachability",
|
||||||
Usage: "Print information about reachability from the internet",
|
Usage: "Print information about reachability from the internet",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api, closer, err := GetAPI(cctx)
|
api, closer, err := GetAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -176,7 +176,7 @@ func (p Processor) storeActorAddresses(ctx context.Context, actors map[cid.Cid]A
|
|||||||
for _, updates := range addressesToUpdate {
|
for _, updates := range addressesToUpdate {
|
||||||
if _, err := updateTx.Exec(
|
if _, err := updateTx.Exec(
|
||||||
fmt.Sprintf("update id_address_map set id=%s, address=%s where id=%s and address=%s", updates.New.ID, updates.New.PK, updates.Old.ID, updates.Old.PK),
|
fmt.Sprintf("update id_address_map set id=%s, address=%s where id=%s and address=%s", updates.New.ID, updates.New.PK, updates.Old.ID, updates.Old.PK),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user