From 578e43441e11f64a66bdf8bd9174adebe0b4e387 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen <ben@monax.io> Date: Tue, 21 Feb 2017 23:13:48 +0100 Subject: [PATCH] genesis: remove redundant copy of public key bytes on clone - thx to Silas --- genesis/types.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/genesis/types.go b/genesis/types.go index 5b60154f..40395fb7 100644 --- a/genesis/types.go +++ b/genesis/types.go @@ -130,19 +130,13 @@ func (genesisValidator *GenesisValidator) Clone() (GenesisValidator, error) { return GenesisValidator{}, fmt.Errorf("Invalid GenesisValidator %s with nil public key.", genesisValidator.Name) } - // clone the public key by writing and reading over go-wire serialisation - // TODO! write unit test to see whether this is correct - publicKeyClone, err := crypto.PubKeyFromBytes(genesisValidator.PubKey.Bytes()) - if err != nil { - return GenesisValidator{}, err - } // clone the addresses to unbond to unbondToClone := make([]BasicAccount, len(genesisValidator.UnbondTo)) for i, basicAccount := range genesisValidator.UnbondTo { unbondToClone[i] = basicAccount.Clone() } return GenesisValidator{ - PubKey: publicKeyClone, + PubKey: genesisValidator.PubKey, Amount: genesisValidator.Amount, Name: genesisValidator.Name, UnbondTo: unbondToClone, -- GitLab