Skip to content

Commit

Permalink
Cosmetic: Improving err printout for 'util network-merge verify-confi…
Browse files Browse the repository at this point in the history
…g' (#415)
  • Loading branch information
pbukva authored Oct 25, 2024
1 parent b46801a commit e7d7b96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/upgrade_network_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,18 @@ func (c *ProdDevContract) GetContracts(contracts []string) []string {
func verifyAddress(address string, expectedPrefix *string) error {
prefix, decodedAddrData, err := bech32.DecodeAndConvert(address)
if err != nil {
return err
return fmt.Errorf("decoding of the '%s' address failed: %w", address, err)
}
if expectedPrefix != nil && prefix != *expectedPrefix {
return fmt.Errorf("expected address prefix %s, got %s", *expectedPrefix, prefix)
return fmt.Errorf("expected address prefix '%s', got '%s'", *expectedPrefix, prefix)
}

reconstructedAddr, err := bech32.ConvertAndEncode(prefix, decodedAddrData)
if err != nil {
return err
return fmt.Errorf("encoding raw addr repr. of the '%s' orig. address failed: %w", address, err)
}
if address != reconstructedAddr {
return fmt.Errorf("Invalid address '%s'", address)
return fmt.Errorf("invalid address '%s'", address)
}

return nil
Expand Down

0 comments on commit e7d7b96

Please sign in to comment.