set predictable address when creating account actors

This commit is contained in:
vyzo 2022-11-09 11:15:16 +02:00
parent 335d0bec3e
commit 0b6d1ad20b

View File

@ -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) {
switch addr.Protocol() {
case address.BLS, address.SECP256K1:
return newAccountActor(ver), nil
return newAccountActor(ver, addr), nil
case address.ID:
return nil, aerrors.Newf(exitcode.SysErrInvalidReceiver, "no actor with given ID: %s", addr)
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?
var code cid.Cid
switch ver {
@ -124,6 +124,7 @@ func newAccountActor(ver actorstypes.Version) *types.Actor {
Code: code,
Balance: types.NewInt(0),
Head: EmptyObjectCid,
Address: &addr,
}
return nact