mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-06 19:55:10 +00:00
stackitem: change Bool() to TryBool(), prepare for its failures
This commit is contained in:
parent
790693fc6d
commit
a7670303e8
7 changed files with 65 additions and 45 deletions
|
@ -80,9 +80,14 @@ func (e *Element) BigInt() *big.Int {
|
|||
return val
|
||||
}
|
||||
|
||||
// Bool converts an underlying value of the element to a boolean.
|
||||
// Bool converts an underlying value of the element to a boolean if it's
|
||||
// possible to do so, it will panic otherwise.
|
||||
func (e *Element) Bool() bool {
|
||||
return e.value.Bool()
|
||||
b, err := e.value.TryBool()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// Bytes attempts to get the underlying value of the element as a byte array.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue