Skip to content
Snippets Groups Projects
Unverified Commit eff73852 authored by Silas Davis's avatar Silas Davis
Browse files

Removed logging from HasPermission, ugly to pass log in for each of these, and...

Removed logging from HasPermission, ugly to pass log in for each of these, and besides we should be only representing known permissions through the type system
parent 6738cc89
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,6 @@ import ( ...@@ -27,7 +27,6 @@ import (
ptypes "github.com/monax/burrow/permission/types" ptypes "github.com/monax/burrow/permission/types"
"github.com/monax/burrow/txs" "github.com/monax/burrow/txs"
. "github.com/monax/burrow/word256" . "github.com/monax/burrow/word256"
"github.com/monax/cli/log"
"github.com/tendermint/go-events" "github.com/tendermint/go-events"
) )
...@@ -107,12 +106,12 @@ func (vm *VM) SetFireable(evc events.Fireable) { ...@@ -107,12 +106,12 @@ func (vm *VM) SetFireable(evc events.Fireable) {
// (unlike in state/execution, where we guarantee HasPermission is called // (unlike in state/execution, where we guarantee HasPermission is called
// on known permissions and panics else) // on known permissions and panics else)
// If the perm is not defined in the acc nor set by default in GlobalPermissions, // If the perm is not defined in the acc nor set by default in GlobalPermissions,
// prints a log warning and returns false. // this function returns false.
func HasPermission(appState AppState, acc *Account, perm ptypes.PermFlag) bool { func HasPermission(appState AppState, acc *Account, perm ptypes.PermFlag) bool {
v, err := acc.Permissions.Base.Get(perm) v, err := acc.Permissions.Base.Get(perm)
if _, ok := err.(ptypes.ErrValueNotSet); ok { if _, ok := err.(ptypes.ErrValueNotSet); ok {
if appState == nil { if appState == nil {
log.Warn(fmt.Sprintf("\n\n***** Unknown permission %b! ********\n\n", perm)) // In this case the permission is unknown
return false return false
} }
return HasPermission(nil, appState.GetAccount(ptypes.GlobalPermissionsAddress256), perm) return HasPermission(nil, appState.GetAccount(ptypes.GlobalPermissionsAddress256), perm)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment