mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
Implemented Map Stack Item:
1) Added new file map.go, map_test.go 2) Added Map, Hash Method to Item interface 3) Implemented Hash Method for every stack items (Boolean, Array, Int, ...)
This commit is contained in:
parent
7bf4d691a9
commit
c6cd0e0c21
9 changed files with 393 additions and 1 deletions
|
@ -3,6 +3,7 @@ package stack
|
|||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
)
|
||||
|
@ -69,3 +70,14 @@ func reverse(b []byte) []byte {
|
|||
|
||||
return dest
|
||||
}
|
||||
|
||||
//Value returns the underlying ByteArray's value.
|
||||
func (ba *ByteArray) Value() []byte {
|
||||
return ba.val
|
||||
}
|
||||
|
||||
// Hash overrides the default abstract hash method.
|
||||
func (ba *ByteArray) Hash() (string, error) {
|
||||
data := fmt.Sprintf("%T %v", ba, ba.Value())
|
||||
return KeyGenerator([]byte(data))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue