Clean up all XxxS structs to Xxx

This commit is contained in:
Ethan Frey
2017-04-27 15:52:53 +02:00
parent 57356beab6
commit 0665a2e8a6
5 changed files with 19 additions and 18 deletions
+4 -4
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
}
+7 -6
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}},
+5 -5
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 {