25 lines
733 B
Go
Executable File
25 lines
733 B
Go
Executable File
package context
|
|
|
|
import (
|
|
"git.marketally.com/tutus-one/tutus-chain/pkg/crypto/keys"
|
|
"git.marketally.com/tutus-one/tutus-chain/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
|
|
}
|