mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 03:41:45 +00:00
ae3515e819
Add StringCompressed to get a string representation of the key in compressed form. Close #3263 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
24 lines
707 B
Go
24 lines
707 B
Go
package context
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
|
)
|
|
|
|
// Item represents a transaction context item.
|
|
type Item struct {
|
|
Script []byte `json:"script"`
|
|
Parameters []smartcontract.Parameter `json:"parameters"`
|
|
Signatures map[string][]byte `json:"signatures"`
|
|
}
|
|
|
|
// GetSignature returns a signature for the pub if present.
|
|
func (it *Item) GetSignature(pub *keys.PublicKey) []byte {
|
|
return it.Signatures[pub.StringCompressed()]
|
|
}
|
|
|
|
// AddSignature adds a signature for the pub.
|
|
func (it *Item) AddSignature(pub *keys.PublicKey, sig []byte) {
|
|
pubHex := pub.StringCompressed()
|
|
it.Signatures[pubHex] = sig
|
|
}
|