From 6cb2790b08324c14ab60d99d5c320526f42f52bf Mon Sep 17 00:00:00 2001 From: Silas Davis <silas@erisindustries.com> Date: Fri, 13 Jan 2017 12:21:51 +0000 Subject: [PATCH] Add documentation comment on lazily initialisation of account public keys --- manager/eris-mint/state/execution.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manager/eris-mint/state/execution.go b/manager/eris-mint/state/execution.go index ceefbbd8..9d9fd85b 100644 --- a/manager/eris-mint/state/execution.go +++ b/manager/eris-mint/state/execution.go @@ -203,6 +203,12 @@ func getOrMakeOutputs(state AccountGetter, accounts map[string]*acm.Account, out return accounts, nil } +// Since all ethereum accounts implicitly exist we sometimes lazily create an Account object to represent them +// only when needed. Sometimes we need to create an unknown Account knowing only its address (which is expected to +// be a deterministic hash of its associated public key) and not its public key. When we eventually receive a +// transaction acting on behalf of that account we will be given a public key that we can check matches the address. +// If it does then we will associate the public key with the stub account already registered in the system once and +// for all time. func checkInputPubKey(acc *acm.Account, in *txs.TxInput) error { if acc.PubKey == nil { if in.PubKey == nil { -- GitLab