set predictable address when creating account actors
This commit is contained in:
parent
335d0bec3e
commit
0b6d1ad20b
@ -89,7 +89,7 @@ func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, add
|
|||||||
func makeAccountActor(ver actorstypes.Version, addr address.Address) (*types.Actor, aerrors.ActorError) {
|
func makeAccountActor(ver actorstypes.Version, addr address.Address) (*types.Actor, aerrors.ActorError) {
|
||||||
switch addr.Protocol() {
|
switch addr.Protocol() {
|
||||||
case address.BLS, address.SECP256K1:
|
case address.BLS, address.SECP256K1:
|
||||||
return newAccountActor(ver), nil
|
return newAccountActor(ver, addr), nil
|
||||||
case address.ID:
|
case address.ID:
|
||||||
return nil, aerrors.Newf(exitcode.SysErrInvalidReceiver, "no actor with given ID: %s", addr)
|
return nil, aerrors.Newf(exitcode.SysErrInvalidReceiver, "no actor with given ID: %s", addr)
|
||||||
case address.Actor:
|
case address.Actor:
|
||||||
@ -99,7 +99,7 @@ func makeAccountActor(ver actorstypes.Version, addr address.Address) (*types.Act
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAccountActor(ver actorstypes.Version) *types.Actor {
|
func newAccountActor(ver actorstypes.Version, addr address.Address) *types.Actor {
|
||||||
// TODO: ActorsUpgrade use a global actor registry?
|
// TODO: ActorsUpgrade use a global actor registry?
|
||||||
var code cid.Cid
|
var code cid.Cid
|
||||||
switch ver {
|
switch ver {
|
||||||
@ -124,6 +124,7 @@ func newAccountActor(ver actorstypes.Version) *types.Actor {
|
|||||||
Code: code,
|
Code: code,
|
||||||
Balance: types.NewInt(0),
|
Balance: types.NewInt(0),
|
||||||
Head: EmptyObjectCid,
|
Head: EmptyObjectCid,
|
||||||
|
Address: &addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
return nact
|
return nact
|
||||||
|
Loading…
Reference in New Issue
Block a user