forked from TrueCloudLab/frostfs-node
[#812] morph/event: Expand reputation put event with notary notification
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
90823a7d05
commit
e2c2e27c60
2 changed files with 87 additions and 0 deletions
|
@ -3,6 +3,7 @@ package reputation
|
|||
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-api-go/pkg/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
|
@ -15,6 +16,10 @@ type Put struct {
|
|||
epoch uint64
|
||||
peerID reputation.PeerID
|
||||
value reputation.GlobalTrust
|
||||
|
||||
// For notary notifications only.
|
||||
// Contains raw transactions of notary request.
|
||||
notaryRequest *payload.P2PNotaryRequest
|
||||
}
|
||||
|
||||
const peerIDLength = 33 // compressed public key
|
||||
|
@ -37,6 +42,12 @@ func (p Put) Value() reputation.GlobalTrust {
|
|||
return p.value
|
||||
}
|
||||
|
||||
// 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 reputation event structure.
|
||||
func ParsePut(prms []stackitem.Item) (event.Event, error) {
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue