fixed donotmodify bug
This commit is contained in:
parent
d6cd0d4acc
commit
29bdd663c2
@ -37,10 +37,10 @@ func init() {
|
||||
fsAmount.String(FlagAmount, "1steak", "Amount of coins to bond")
|
||||
fsShares.String(FlagSharesAmount, "", "Amount of source-shares to either unbond or redelegate as a positive integer or decimal")
|
||||
fsShares.String(FlagSharesPercent, "", "Percent of source-shares to either unbond or redelegate as a positive integer or decimal >0 and <=1")
|
||||
fsDescription.String(FlagMoniker, "[do-not-modify]", "validator name")
|
||||
fsDescription.String(FlagIdentity, "[do-not-modify]", "optional identity signature (ex. UPort or Keybase)")
|
||||
fsDescription.String(FlagWebsite, "[do-not-modify]", "optional website")
|
||||
fsDescription.String(FlagDetails, "[do-not-modify]", "optional details")
|
||||
fsDescription.String(FlagMoniker, "", "validator name")
|
||||
fsDescription.String(FlagIdentity, "", "optional identity signature (ex. UPort or Keybase)")
|
||||
fsDescription.String(FlagWebsite, "", "optional website")
|
||||
fsDescription.String(FlagDetails, "", "optional details")
|
||||
fsValidator.String(FlagAddressValidator, "", "hex address of the validator")
|
||||
fsDelegator.String(FlagAddressDelegator, "", "hex address of the delegator")
|
||||
fsRedelegation.String(FlagAddressValidatorSrc, "", "hex address of the source validator")
|
||||
|
||||
@ -271,16 +271,16 @@ func NewDescription(moniker, identity, website, details string) Description {
|
||||
// UpdateDescription updates the fields of a given description. An error is
|
||||
// returned if the resulting description contains an invalid length.
|
||||
func (d Description) UpdateDescription(d2 Description) (Description, sdk.Error) {
|
||||
if d.Moniker == doNotModifyDescVal {
|
||||
if d2.Moniker == doNotModifyDescVal {
|
||||
d2.Moniker = d.Moniker
|
||||
}
|
||||
if d.Identity == doNotModifyDescVal {
|
||||
if d2.Identity == doNotModifyDescVal {
|
||||
d2.Identity = d.Identity
|
||||
}
|
||||
if d.Website == doNotModifyDescVal {
|
||||
if d2.Website == doNotModifyDescVal {
|
||||
d2.Website = d.Website
|
||||
}
|
||||
if d.Details == doNotModifyDescVal {
|
||||
if d2.Details == doNotModifyDescVal {
|
||||
d2.Details = d.Details
|
||||
}
|
||||
|
||||
|
||||
@ -25,19 +25,31 @@ func TestValidatorEqual(t *testing.T) {
|
||||
|
||||
func TestUpdateDescription(t *testing.T) {
|
||||
d1 := Description{
|
||||
Website: "https://validator.cosmos",
|
||||
Details: "Test validator",
|
||||
}
|
||||
|
||||
d2 := Description{
|
||||
Moniker: doNotModifyDescVal,
|
||||
Identity: doNotModifyDescVal,
|
||||
Website: doNotModifyDescVal,
|
||||
Details: doNotModifyDescVal,
|
||||
}
|
||||
d2 := Description{
|
||||
Website: "https://validator.cosmos",
|
||||
Details: "Test validator",
|
||||
|
||||
d3 := Description{
|
||||
Moniker: "",
|
||||
Identity: "",
|
||||
Website: "",
|
||||
Details: "",
|
||||
}
|
||||
|
||||
d, err := d1.UpdateDescription(d2)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, d, d1)
|
||||
|
||||
d, err = d1.UpdateDescription(d3)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, d, d3)
|
||||
}
|
||||
|
||||
func TestABCIValidator(t *testing.T) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user