[#971] *: Add notification TX hash to neofs/netmap morph client calls
Add hash of the TX that generated notification to neofs/netmap event structures. Adapt all neofs/netmap wrapper calls to new structures. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
c25f5a86ae
commit
bad739258e
19 changed files with 220 additions and 60 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
netmapclient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
|
||||
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"go.uber.org/zap"
|
||||
|
@ -81,18 +82,22 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
|||
np.log.Info("approving network map candidate",
|
||||
zap.String("key", keyString))
|
||||
|
||||
prm := netmapclient.AddPeerPrm{}
|
||||
prm.SetNodeInfo(nodeInfo)
|
||||
|
||||
if nr := ev.NotaryRequest(); nr != nil {
|
||||
// create new notary request with the original nonce
|
||||
err = np.netmapClient.Morph().NotaryInvoke(
|
||||
np.netmapClient.ContractAddress(),
|
||||
0,
|
||||
nr.MainTransaction.Nonce,
|
||||
nil,
|
||||
netmapEvent.AddPeerNotaryEvent,
|
||||
nodeInfoBinary,
|
||||
)
|
||||
} else {
|
||||
// notification event case
|
||||
err = np.netmapClient.AddPeer(nodeInfo)
|
||||
err = np.netmapClient.AddPeer(prm)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@ -126,7 +131,12 @@ func (np *Processor) processUpdatePeer(ev netmapEvent.UpdatePeer) {
|
|||
if nr := ev.NotaryRequest(); nr != nil {
|
||||
err = np.netmapClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
|
||||
} else {
|
||||
err = np.netmapClient.UpdatePeerState(ev.PublicKey().Bytes(), ev.Status())
|
||||
prm := netmapclient.UpdatePeerPrm{}
|
||||
|
||||
prm.SetState(ev.Status())
|
||||
prm.SetKey(ev.PublicKey().Bytes())
|
||||
|
||||
err = np.netmapClient.UpdatePeerState(prm)
|
||||
}
|
||||
if err != nil {
|
||||
np.log.Error("can't invoke netmap.UpdatePeer", zap.Error(err))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue