Add v3 actors support for account
This commit is contained in:
parent
ba3b32cfe7
commit
3961e3daf8
@ -13,6 +13,7 @@ import (
|
|||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -32,6 +33,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
return load0(store, act.Head)
|
return load0(store, act.Head)
|
||||||
case builtin2.AccountActorCodeID:
|
case builtin2.AccountActorCodeID:
|
||||||
return load2(store, act.Head)
|
return load2(store, act.Head)
|
||||||
|
case builtin3.AccountActorCodeID:
|
||||||
|
return load3(store, act.Head)
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
30
chain/actors/builtin/account/v3.go
Normal file
30
chain/actors/builtin/account/v3.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ State = (*state3)(nil)
|
||||||
|
|
||||||
|
func load3(store adt.Store, root cid.Cid) (State, error) {
|
||||||
|
out := state3{store: store}
|
||||||
|
err := store.Get(store.Context(), root, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type state3 struct {
|
||||||
|
account3.State
|
||||||
|
store adt.Store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *state3) PubkeyAddress() (address.Address, error) {
|
||||||
|
return s.Address, nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user