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
version: 620dcbbd7d587cf3599dedbf329b64311b0c307a
- name: github.com/tendermint/go-crypto
version: 8ff4ce222d32c2328ff0d2bf121fcd34254c03c1
version: 3e1dba7ab762bb689123eec30c468967f077a6a4
- name: github.com/tendermint/go-data
version: e7fcc6d081ec8518912fcdc103188275f83a3ee5
version: 9fbf0684fefc4fad580992394a0bcf47c1b3d77e
- name: github.com/tendermint/go-db
version: 9643f60bc2578693844aacf380a7c32e4c029fee
- 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))
}
// 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.OK

View File

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

View File

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

View File

@ -64,11 +64,11 @@ func (p *TxS) UnmarshalJSON(data []byte) (err error) {
//-----------------------------------------------------------------------------
type TxInput struct {
Address data.Bytes `json:"address"` // Hash of the PubKey
Coins Coins `json:"coins"` //
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
PubKey crypto.PubKeyS `json:"pub_key"` // Is present iff Sequence == 0
Address data.Bytes `json:"address"` // Hash of the PubKey
Coins Coins `json:"coins"` //
Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput
Signature crypto.Signature `json:"signature"` // Depends on the PubKey type and the whole Tx
PubKey crypto.PubKey `json:"pub_key"` // Is present iff Sequence == 0
}
func (txIn TxInput) ValidateBasic() abci.Result {