diff --git a/app/app.go b/app/app.go index cd21a7130..d7baf056e 100644 --- a/app/app.go +++ b/app/app.go @@ -214,7 +214,7 @@ func sumAmounts(inputs []types.Input, outputs []types.Output, more int) (total u } func allPubKeys(tx types.Tx) (pubKeys []crypto.PubKey) { - pubKeys = make([]crypto.PubKey, len(tx.Inputs)+len(tx.Outputs)) + pubKeys = make([]crypto.PubKey, 0, len(tx.Inputs)+len(tx.Outputs)) for _, input := range tx.Inputs { pubKeys = append(pubKeys, input.PubKey) } @@ -278,13 +278,18 @@ func loadAccounts(eyesCli *eyes.MerkleEyesClient, pubKeys []crypto.PubKey) (accM if err != nil { panic("Error loading account: " + err.Error()) } - var acc types.PubAccount + if len(accBytes) == 0 { + continue + } + var acc types.Account err = wire.ReadBinaryBytes(accBytes, &acc) if err != nil { panic("Error reading account: " + err.Error()) } - acc.PubKey = pubKey // Set volatile field - accMap[keyString] = acc + accMap[keyString] = types.PubAccount{ + Account: acc, + PubKey: pubKey, + } } return } diff --git a/main.go b/main.go index ffd1c50df..fe4ea2660 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,6 @@ package main import ( "flag" - "fmt" "github.com/tendermint/blackstar/app" "github.com/tendermint/blackstar/types" @@ -39,13 +38,13 @@ func main() { Exit("parsing genesis JSON: " + err.Error()) } for _, account := range genesisState.Accounts { - pubKeyBytes := wire.BinaryBytes(account.PubKey) + // pubKeyBytes := wire.BinaryBytes(account.PubKey) + pubKeyString := account.PubKey.KeyString() accBytes := wire.BinaryBytes(account.Account) - err = eyesCli.SetSync(pubKeyBytes, accBytes) + err = eyesCli.SetSync([]byte(pubKeyString), accBytes) if err != nil { Exit("loading genesis accounts: " + err.Error()) } - fmt.Println("Loaded ", account) } // Start the listener diff --git a/tests/tendermint/.main.go.swp b/tests/tendermint/.main.go.swp deleted file mode 100644 index 1ced65066..000000000 Binary files a/tests/tendermint/.main.go.swp and /dev/null differ diff --git a/tests/tendermint/main.go b/tests/tendermint/main.go index 835e42bfa..81d595f07 100644 --- a/tests/tendermint/main.go +++ b/tests/tendermint/main.go @@ -61,18 +61,14 @@ func main() { // Sign request signBytes := wire.BinaryBytes(tx) - fmt.Printf("SIGN: %X\n", signBytes) sig := root.PrivKey.Sign(signBytes) - fmt.Println("VERIFY: ", root.PubKey.VerifyBytes(signBytes, sig)) tx.Inputs[0].Signature = sig //fmt.Println("tx:", tx) // Write request txBytes := wire.BinaryBytes(tx) - fmt.Println("tx:", hex.EncodeToString(txBytes)) request := rpctypes.NewRPCRequest("fakeid", "broadcast_tx_sync", Arr(txBytes)) reqBytes := wire.JSONBytes(request) - fmt.Println("req:", hex.EncodeToString(reqBytes)) //fmt.Print(".") err := ws.WriteMessage(websocket.TextMessage, reqBytes) if err != nil {