diff --git a/pkg/innerring/subnet.go b/pkg/innerring/subnet.go index d709ce28bb..40c86452b1 100644 --- a/pkg/innerring/subnet.go +++ b/pkg/innerring/subnet.go @@ -135,8 +135,6 @@ func (s *Server) listenSubnet() { // subnet creation listenEvent(subnetCreateEvName, subnetevents.ParseNotaryPut, s.onlyAlphabetEventHandler(s.catchSubnetCreation)) - // subnet removal - listenEvent(subnetRemoveEvName, subnetevents.ParseNotaryDelete, s.onlyAlphabetEventHandler(s.catchSubnetRemoval)) } func (s *Server) listenSubnetWithoutNotary() { @@ -303,25 +301,15 @@ func (s *Server) handleSubnetRemoval(e event.Event) { return } - notaryMainTx := delEv.NotaryMainTx() + // send new transaction + var prm morphsubnet.DeletePrm - isNotary := notaryMainTx != nil - if isNotary { - // re-sign notary request - err = s.morphClient.NotarySignAndInvokeTX(notaryMainTx) - } else { - // send new transaction - var prm morphsubnet.DeletePrm - - prm.SetID(delEv.ID()) - prm.SetTxHash(delEv.TxHash()) - - _, err = s.subnetHandler.morphClient.Delete(prm) - } + prm.SetID(delEv.ID()) + prm.SetTxHash(delEv.TxHash()) + _, err = s.subnetHandler.morphClient.Delete(prm) if err != nil { s.log.Error("approve subnet removal", - zap.Bool("notary", isNotary), zap.String("error", err.Error()), ) diff --git a/pkg/morph/event/subnet/delete.go b/pkg/morph/event/subnet/delete.go index 4c174abb06..5d2a3def96 100644 --- a/pkg/morph/event/subnet/delete.go +++ b/pkg/morph/event/subnet/delete.go @@ -3,7 +3,6 @@ package subnetevents import ( "fmt" - "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/network/payload" "github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions" "github.com/nspcc-dev/neo-go/pkg/util" @@ -34,18 +33,6 @@ func (x Delete) TxHash() util.Uint256 { return x.txHash } -// NotaryMainTx returns main transaction of the request in the Notary service. -// Returns nil in non-notary environments. -func (x Delete) NotaryMainTx() *transaction.Transaction { - if x.notaryRequest != nil { - return x.notaryRequest.MainTransaction - } - - return nil -} - -const itemNumDelete = 1 - // ParseDelete parses the notification about the removal of a subnet which has been thrown // by the appropriate method of the Subnet contract. // @@ -61,6 +48,8 @@ func ParseDelete(e *subscriptions.NotificationEvent) (event.Event, error) { return nil, fmt.Errorf("parse stack array: %w", err) } + const itemNumDelete = 1 + if ln := len(items); ln != itemNumDelete { return nil, event.WrongNumberOfParameters(itemNumDelete, ln) } @@ -75,35 +64,3 @@ func ParseDelete(e *subscriptions.NotificationEvent) (event.Event, error) { return ev, nil } - -// ParseNotaryDelete parses the notary notification about the removal of a subnet which has been -// thrown by the appropriate method of the Subnet contract. -// -// Resulting event is of Delete type. -func ParseNotaryDelete(e event.NotaryEvent) (event.Event, error) { - var ev Delete - - ev.notaryRequest = e.Raw() - if ev.notaryRequest == nil { - panic(fmt.Sprintf("nil %T in notary environment", ev.notaryRequest)) - } - - var ( - err error - - prms = e.Params() - ) - - if ln := len(prms); ln != itemNumDelete { - return nil, event.WrongNumberOfParameters(itemNumDelete, ln) - } - - ev.id, err = event.BytesFromOpcode(prms[0]) - if err != nil { - return nil, fmt.Errorf("id param: %w", err) - } - - ev.notaryRequest = e.Raw() - - return ev, nil -}