Browse Source

Set Pubkey on vm.Account.

pull/37/head
Jae Kwon 10 years ago
parent
commit
ab8ad30648
2 changed files with 7 additions and 0 deletions
  1. +6
    -0
      state/vm_app_state.go
  2. +1
    -0
      vm/types.go

+ 6
- 0
state/vm_app_state.go View File

@ -20,13 +20,19 @@ func toVMAccount(acc *ac.Account) *vm.Account {
Code: acc.Code, // This is crazy. Code: acc.Code, // This is crazy.
Nonce: uint64(acc.Sequence), Nonce: uint64(acc.Sequence),
StorageRoot: vm.BytesToWord(acc.StorageRoot), StorageRoot: vm.BytesToWord(acc.StorageRoot),
Other: acc.PubKey,
} }
} }
// Converts vm.Account to state.Account struct. // Converts vm.Account to state.Account struct.
func toStateAccount(acc *vm.Account) *ac.Account { func toStateAccount(acc *vm.Account) *ac.Account {
pubKey, ok := acc.Other.(ac.PubKey)
if !ok {
pubKey = ac.PubKeyNil{}
}
return &ac.Account{ return &ac.Account{
Address: acc.Address.Address(), Address: acc.Address.Address(),
PubKey: pubKey,
Balance: acc.Balance, Balance: acc.Balance,
Code: acc.Code, Code: acc.Code,
Sequence: uint(acc.Nonce), Sequence: uint(acc.Nonce),


+ 1
- 0
vm/types.go View File

@ -33,6 +33,7 @@ type Account struct {
Code []byte Code []byte
Nonce uint64 Nonce uint64
StorageRoot Word StorageRoot Word
Other interface{} // For holding all other data.
} }
type Log struct { type Log struct {


Loading…
Cancel
Save