Commit b1c0ea88 authored by David Vorick's avatar David Vorick

Merge branch 'unlockhash' into 'master'

Add MustParseAddress helper function

See merge request !3356
parents 13b7735e 304e8b48
Pipeline #39840230 failed with stages
in 116 minutes and 14 seconds
......@@ -1016,3 +1016,17 @@ func (uh *UnlockHash) Scan(s fmt.ScanState, ch rune) error {
}
return uh.LoadString(string(tok))
}
// MustParseAddress parses an address string to an UnlockHash, panicking
// if parsing fails.
//
// MustParseAddress should never be called on untrusted input; it is
// provided only for convenience when working with address strings that are
// known to be valid, such as the addresses in GenesisSiafundAllocation. To
// parse untrusted address strings, use the LoadString method of UnlockHash.
func MustParseAddress(addrStr string) (addr UnlockHash) {
if err := addr.LoadString(addrStr); err != nil {
panic(err)
}
return
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment