mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 21:01:21 +00:00
move perms to vm.Account
This commit is contained in:
@ -10,15 +10,14 @@ import (
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
dbm "github.com/tendermint/tendermint/db"
|
||||
"github.com/tendermint/tendermint/merkle"
|
||||
ptypes "github.com/tendermint/tendermint/permission/types"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
type GenesisAccount struct {
|
||||
Address []byte `json:"address"`
|
||||
Amount int64 `json:"amount"`
|
||||
Address []byte `json:"address"`
|
||||
Amount uint64 `json:"amount"`
|
||||
Permissions *account.Permissions `json:"global_permissions"` // pointer so optional
|
||||
Address []byte `json:"address"`
|
||||
Amount uint64 `json:"amount"`
|
||||
Permissions *ptypes.Permissions `json:"global_permissions"` // pointer so optional
|
||||
}
|
||||
|
||||
type GenesisValidator struct {
|
||||
@ -29,7 +28,7 @@ type GenesisValidator struct {
|
||||
|
||||
type GenesisParams struct {
|
||||
// Default permissions for newly created accounts
|
||||
GlobalPermissions *account.Permissions `json:"global_permissions"`
|
||||
GlobalPermissions *ptypes.Permissions `json:"global_permissions"`
|
||||
|
||||
// TODO: other params we may want to tweak?
|
||||
}
|
||||
@ -74,9 +73,10 @@ func MakeGenesisState(db dbm.DB, genDoc *GenesisDoc) *State {
|
||||
// Make accounts state tree
|
||||
accounts := merkle.NewIAVLTree(binary.BasicCodec, account.AccountCodec, defaultAccountsCacheCapacity, db)
|
||||
for _, genAcc := range genDoc.Accounts {
|
||||
perm := account.DefaultPermissions
|
||||
perm_ := account.DefaultPermissions
|
||||
perm := &perm_
|
||||
if genAcc.Permissions != nil {
|
||||
perm = *(genAcc.Permissions)
|
||||
perm = genAcc.Permissions
|
||||
}
|
||||
acc := &account.Account{
|
||||
Address: genAcc.Address,
|
||||
@ -90,12 +90,13 @@ func MakeGenesisState(db dbm.DB, genDoc *GenesisDoc) *State {
|
||||
|
||||
// global permissions are saved as the 0 address
|
||||
// so they are included in the accounts tree
|
||||
globalPerms := account.DefaultPermissions
|
||||
globalPerms_ := account.DefaultPermissions
|
||||
globalPerms := &globalPerms_
|
||||
if genDoc.Params != nil && genDoc.Params.GlobalPermissions != nil {
|
||||
globalPerms = *(genDoc.Params.GlobalPermissions)
|
||||
globalPerms = genDoc.Params.GlobalPermissions
|
||||
}
|
||||
permsAcc := &account.Account{
|
||||
Address: account.GlobalPermissionsAddress,
|
||||
Address: ptypes.GlobalPermissionsAddress,
|
||||
PubKey: nil,
|
||||
Sequence: 0,
|
||||
Balance: 1337,
|
||||
|
Reference in New Issue
Block a user