Allow invocation of account actor methods
This commit is contained in:
parent
05d43af3fc
commit
72c6552b0b
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -53,16 +54,13 @@ func NewInvoker() *invoker {
|
|||||||
inv.Register(builtin.StorageMinerActorCodeID, miner.Actor{}, miner.State{})
|
inv.Register(builtin.StorageMinerActorCodeID, miner.Actor{}, miner.State{})
|
||||||
inv.Register(builtin.MultisigActorCodeID, multisig.Actor{}, multisig.State{})
|
inv.Register(builtin.MultisigActorCodeID, multisig.Actor{}, multisig.State{})
|
||||||
inv.Register(builtin.PaymentChannelActorCodeID, paych.Actor{}, paych.State{})
|
inv.Register(builtin.PaymentChannelActorCodeID, paych.Actor{}, paych.State{})
|
||||||
|
inv.Register(builtin.AccountActorCodeID, account.Actor{}, account.State{})
|
||||||
|
|
||||||
return inv
|
return inv
|
||||||
}
|
}
|
||||||
|
|
||||||
func (inv *invoker) Invoke(act *types.Actor, rt runtime.Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) {
|
func (inv *invoker) Invoke(act *types.Actor, rt runtime.Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError) {
|
||||||
|
|
||||||
if act.Code == builtin.AccountActorCodeID {
|
|
||||||
return nil, aerrors.Newf(254, "cannot invoke methods on account actors")
|
|
||||||
}
|
|
||||||
|
|
||||||
code, ok := inv.builtInCode[act.Code]
|
code, ok := inv.builtInCode[act.Code]
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Errorf("no code for actor %s (Addr: %s)", act.Code, rt.Message().Receiver())
|
log.Errorf("no code for actor %s (Addr: %s)", act.Code, rt.Message().Receiver())
|
||||||
|
Loading…
Reference in New Issue
Block a user