Remove Pubkey field from BaseAccount#String (#3407)

This commit is contained in:
Alexander Bezobchuk 2019-01-28 14:50:27 -05:00 committed by Jack Zampolin
parent df86585f6b
commit 9e21ca25ce
1 changed files with 33 additions and 14 deletions

View File

@ -83,12 +83,20 @@ type BaseAccount struct {
// String implements fmt.Stringer
func (acc BaseAccount) String() string {
return fmt.Sprintf(`Account %s:
var pubkey string
if acc.PubKey != nil {
pubkey = sdk.MustBech32ifyAccPub(acc.PubKey)
}
return fmt.Sprintf(`Account:
Address: %s
Pubkey: %s
Coins: %s
PubKey: %s
AccountNumber: %d
Sequence: %d`, acc.Address, acc.Coins,
acc.PubKey.Address(), acc.AccountNumber, acc.Sequence)
Sequence: %d`,
acc.Address, pubkey, acc.Coins, acc.AccountNumber, acc.Sequence,
)
}
// Prototype function for BaseAccount
@ -183,8 +191,15 @@ type BaseVestingAccount struct {
// String implements fmt.Stringer
func (bva BaseVestingAccount) String() string {
var pubkey string
if bva.PubKey != nil {
pubkey = sdk.MustBech32ifyAccPub(bva.PubKey)
}
return fmt.Sprintf(`Vesting Account:
Address: %s
Address: %s
Pubkey: %s
Coins: %s
AccountNumber: %d
Sequence: %d
@ -192,10 +207,8 @@ func (bva BaseVestingAccount) String() string {
DelegatedFree: %s
DelegatedVesting: %s
EndTime: %d `,
bva.Address, bva.Coins,
bva.AccountNumber, bva.Sequence,
bva.OriginalVesting, bva.DelegatedFree,
bva.DelegatedVesting, bva.EndTime,
bva.Address, pubkey, bva.Coins, bva.AccountNumber, bva.Sequence,
bva.OriginalVesting, bva.DelegatedFree, bva.DelegatedVesting, bva.EndTime,
)
}
@ -395,8 +408,15 @@ func NewContinuousVestingAccount(
}
func (cva ContinuousVestingAccount) String() string {
var pubkey string
if cva.PubKey != nil {
pubkey = sdk.MustBech32ifyAccPub(cva.PubKey)
}
return fmt.Sprintf(`Continuous Vesting Account:
Address: %s
Address: %s
Pubkey: %s
Coins: %s
AccountNumber: %d
Sequence: %d
@ -405,10 +425,9 @@ func (cva ContinuousVestingAccount) String() string {
DelegatedVesting: %s
StartTime: %d
EndTime: %d `,
cva.Address, cva.Coins,
cva.AccountNumber, cva.Sequence,
cva.OriginalVesting, cva.DelegatedFree,
cva.DelegatedVesting, cva.StartTime, cva.EndTime,
cva.Address, pubkey, cva.Coins, cva.AccountNumber, cva.Sequence,
cva.OriginalVesting, cva.DelegatedFree, cva.DelegatedVesting,
cva.StartTime, cva.EndTime,
)
}