forked from TrueCloudLab/frostfs-node
[#770] ir/container: Support notary Put
Implement `NotaryContractProcessor` by IR container processor. Add support for notary `put` container operation. Do not parse `put` non-notary notifications in notary enabled environment. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
9921358f09
commit
13f1273e82
3 changed files with 60 additions and 9 deletions
|
@ -3,6 +3,7 @@ package container
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/network/payload"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
|
@ -14,6 +15,10 @@ type Put struct {
|
|||
signature []byte
|
||||
publicKey []byte
|
||||
token []byte
|
||||
|
||||
// For notary notifications only.
|
||||
// Contains raw transactions of notary request.
|
||||
notaryRequest *payload.P2PNotaryRequest
|
||||
}
|
||||
|
||||
const expectedItemNumPut = 4
|
||||
|
@ -36,6 +41,12 @@ func (p Put) SessionToken() []byte {
|
|||
return p.token
|
||||
}
|
||||
|
||||
// NotaryRequest returns raw notary request if notification
|
||||
// was received via notary service. Otherwise, returns nil.
|
||||
func (p Put) NotaryRequest() *payload.P2PNotaryRequest {
|
||||
return p.notaryRequest
|
||||
}
|
||||
|
||||
// ParsePut from notification into container event structure.
|
||||
func ParsePut(params []stackitem.Item) (event.Event, error) {
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue