Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for address being empty in getAccount #1

Merged
merged 3 commits into from
Mar 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions vms/platformvm/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import (

// This file contains methods of VM that deal with getting/putting values from database

var (
errEmptyAccountAddress = errors.New("account has empty address")
)

// TODO: Cache prefixed IDs or use different way of keying into database
const (
currentValidatorsPrefix uint64 = iota
Expand Down Expand Up @@ -102,6 +106,10 @@ func (vm *VM) putPendingValidators(db database.Database, validators *EventHeap,
// get the account with the specified Address
// If account does not exist in database, return new account
func (vm *VM) getAccount(db database.Database, address ids.ShortID) (Account, error) {
if address.IsZero() {
return Account{}, errEmptyAccountAddress
}

longID := address.LongID()

// see if account exists
Expand Down