[enterprise] check for whitelist validity before executing setConf
@@ -6,9 +6,10 @@ import (
"encoding/json"
"errors"
"fmt"
- "github.com/aergoio/aergo/consensus"
"strings"
+ "github.com/aergoio/aergo/consensus"
+
"github.com/aergoio/aergo/state"
"github.com/aergoio/aergo/types"
)
@@ -85,6 +86,12 @@ func ValidateEnterpriseTx(tx *types.TxBody, sender *state.V,
return nil, err
}
+ if conf, err := getConf(scs, []byte(context.Args[0])); err == nil && conf != nil {
+ if err := conf.Validate(key, context); err != nil {
+ return nil, err
+ }
+ }
+
case AppendConf, RemoveConf:
if len(ci.Args) != 2 { //args[0] : key, args[1] : a value
return nil, fmt.Errorf("invalid arguments in payload for %s : %s", ci.Name, ci.Args)
