Clean up all XxxS structs to Xxx

This commit is contained in:
Ethan Frey 2017-03-21 21:52:42 +01:00
parent 57356beab6
commit 0665a2e8a6
5 changed files with 19 additions and 18 deletions

4
glide.lock generated
View File

@ -70,9 +70,9 @@ imports:
- name: github.com/tendermint/go-config - name: github.com/tendermint/go-config
version: 620dcbbd7d587cf3599dedbf329b64311b0c307a version: 620dcbbd7d587cf3599dedbf329b64311b0c307a
- name: github.com/tendermint/go-crypto - name: github.com/tendermint/go-crypto
version: 8ff4ce222d32c2328ff0d2bf121fcd34254c03c1 version: 3e1dba7ab762bb689123eec30c468967f077a6a4
- name: github.com/tendermint/go-data - name: github.com/tendermint/go-data
version: e7fcc6d081ec8518912fcdc103188275f83a3ee5 version: 9fbf0684fefc4fad580992394a0bcf47c1b3d77e
- name: github.com/tendermint/go-db - name: github.com/tendermint/go-db
version: 9643f60bc2578693844aacf380a7c32e4c029fee version: 9643f60bc2578693844aacf380a7c32e4c029fee
- name: github.com/tendermint/go-events - name: github.com/tendermint/go-events

View File

@ -244,7 +244,7 @@ func validateInputAdvanced(acc *types.Account, signBytes []byte, in types.TxInpu
return abci.ErrBaseInsufficientFunds.AppendLog(cmn.Fmt("balance is %v, tried to send %v", balance, in.Coins)) return abci.ErrBaseInsufficientFunds.AppendLog(cmn.Fmt("balance is %v, tried to send %v", balance, in.Coins))
} }
// Check signatures // Check signatures
if !acc.PubKey.VerifyBytes(signBytes, in.Signature.Signature) { if !acc.PubKey.VerifyBytes(signBytes, in.Signature) {
return abci.ErrBaseInvalidSignature.AppendLog(cmn.Fmt("SignBytes: %X", signBytes)) return abci.ErrBaseInvalidSignature.AppendLog(cmn.Fmt("SignBytes: %X", signBytes))
} }
return abci.OK return abci.OK

View File

@ -7,7 +7,7 @@ import (
) )
type Account struct { type Account struct {
PubKey crypto.PubKeyS `json:"pub_key"` // May be nil, if not known. PubKey crypto.PubKey `json:"pub_key"` // May be nil, if not known.
Sequence int `json:"sequence"` Sequence int `json:"sequence"`
Balance Coins `json:"coins"` Balance Coins `json:"coins"`
} }
@ -31,7 +31,7 @@ func (acc *Account) String() string {
//---------------------------------------- //----------------------------------------
type PrivAccount struct { type PrivAccount struct {
crypto.PrivKeyS crypto.PrivKey
Account Account
} }

View File

@ -10,11 +10,12 @@ import (
// Creates a PrivAccount from secret. // Creates a PrivAccount from secret.
// The amount is not set. // The amount is not set.
func PrivAccountFromSecret(secret string) PrivAccount { func PrivAccountFromSecret(secret string) PrivAccount {
privKey := crypto.GenPrivKeyEd25519FromSecret([]byte(secret)) privKey := crypto.WrapPrivKey(
crypto.GenPrivKeyEd25519FromSecret([]byte(secret)))
privAccount := PrivAccount{ privAccount := PrivAccount{
PrivKeyS: crypto.WrapPrivKey(privKey), PrivKey: privKey,
Account: Account{ Account: Account{
PubKey: crypto.WrapPubKey(privKey.PubKey()), PubKey: privKey.PubKey(),
}, },
} }
return privAccount return privAccount
@ -30,10 +31,10 @@ func RandAccounts(num int, minAmount int64, maxAmount int64) []PrivAccount {
balance += cmn.RandInt64() % (maxAmount - minAmount) balance += cmn.RandInt64() % (maxAmount - minAmount)
} }
privKey := crypto.GenPrivKeyEd25519() privKey := crypto.WrapPrivKey(crypto.GenPrivKeyEd25519())
pubKey := crypto.WrapPubKey(privKey.PubKey()) pubKey := privKey.PubKey()
privAccs[i] = PrivAccount{ privAccs[i] = PrivAccount{
PrivKeyS: crypto.WrapPrivKey(privKey), PrivKey: privKey,
Account: Account{ Account: Account{
PubKey: pubKey, PubKey: pubKey,
Balance: Coins{Coin{"", balance}}, Balance: Coins{Coin{"", balance}},

View File

@ -67,8 +67,8 @@ type TxInput struct {
Address data.Bytes `json:"address"` // Hash of the PubKey Address data.Bytes `json:"address"` // Hash of the PubKey
Coins Coins `json:"coins"` // Coins Coins `json:"coins"` //
Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput
Signature crypto.SignatureS `json:"signature"` // Depends on the PubKey type and the whole Tx Signature crypto.Signature `json:"signature"` // Depends on the PubKey type and the whole Tx
PubKey crypto.PubKeyS `json:"pub_key"` // Is present iff Sequence == 0 PubKey crypto.PubKey `json:"pub_key"` // Is present iff Sequence == 0
} }
func (txIn TxInput) ValidateBasic() abci.Result { func (txIn TxInput) ValidateBasic() abci.Result {