CreateAccount permission through SendTx and CALL (to unknown accounts)

This commit is contained in:
Ethan Buchman
2015-07-07 14:07:56 -07:00
committed by Jae Kwon
parent d78a39ade3
commit f75b6aff74
4 changed files with 206 additions and 6 deletions
+4 -1
View File
@@ -701,7 +701,7 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value int64, gas
case CREATE: // 0xF0
if vm.perms && !vm.HasPermission(callee, ptypes.CreateContract) {
return nil, ErrPermission{"create"}
return nil, ErrPermission{"create_contract"}
}
contractValue := stack.Pop64()
offset, size := stack.Pop64(), stack.Pop64()
@@ -780,6 +780,9 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value int64, gas
if acc == nil {
// if we have not seen the account before, create it
// so we can send funds
if vm.perms && !vm.HasPermission(caller, ptypes.CreateAccount) {
return nil, ErrPermission{"create_account"}
}
acc = &Account{
Address: addr,
}