mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-21 23:29:38 +00:00
waiter: remove compat code for block-based waiting
A part of #3454 for 0.107.0 release. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
aeee733479
commit
aba781c2de
2 changed files with 1 additions and 43 deletions
11
ROADMAP.md
11
ROADMAP.md
|
@ -25,17 +25,6 @@ APIs/commands/configurations will be removed and here is a list of scheduled
|
|||
breaking changes. Consider changing your code/scripts/configurations if you're
|
||||
using anything mentioned here.
|
||||
|
||||
## Block based web-socket waiter transaction awaiting
|
||||
|
||||
Web-socket RPC based `waiter.EventWaiter` uses `header_of_added_block` notifications
|
||||
subscription to manage transaction awaiting. To support old NeoGo RPC servers
|
||||
(older than 0.105.0) that do not have block headers subscription ability,
|
||||
event-based waiter fallbacks to the old way of block monitoring with
|
||||
`block_added` notifications subscription.
|
||||
|
||||
Removal of stale RPC server compatibility code from `waiter.EventWaiter` is
|
||||
scheduled for Jun-Jul 2024 (~0.107.0 release).
|
||||
|
||||
## Dump*Slot() methods of `vm.Context`
|
||||
|
||||
The following new methods have been exposed to give access to VM context slot contents
|
||||
|
|
|
@ -74,7 +74,6 @@ type (
|
|||
RPCPollingBased
|
||||
|
||||
ReceiveHeadersOfAddedBlocks(flt *neorpc.BlockFilter, rcvr chan<- *block.Header) (string, error)
|
||||
ReceiveBlocks(flt *neorpc.BlockFilter, rcvr chan<- *block.Block) (string, error)
|
||||
ReceiveExecutions(flt *neorpc.ExecutionFilter, rcvr chan<- *state.AppExecResult) (string, error)
|
||||
Unsubscribe(id string) error
|
||||
}
|
||||
|
@ -282,7 +281,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
|||
wsWaitErr error
|
||||
waitersActive int
|
||||
hRcvr = make(chan *block.Header, 2)
|
||||
bRcvr = make(chan *block.Block, 2)
|
||||
aerRcvr = make(chan *state.AppExecResult, len(hashes))
|
||||
unsubErrs = make(chan error)
|
||||
exit = make(chan struct{})
|
||||
|
@ -292,13 +290,7 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
|||
since := vub
|
||||
blocksID, err := w.ws.ReceiveHeadersOfAddedBlocks(&neorpc.BlockFilter{Since: &since}, hRcvr)
|
||||
if err != nil {
|
||||
// Falling back to block-based subscription.
|
||||
if errors.Is(err, neorpc.ErrInvalidParams) {
|
||||
blocksID, err = w.ws.ReceiveBlocks(&neorpc.BlockFilter{Since: &since}, bRcvr)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
wsWaitErr = fmt.Errorf("failed to subscribe for new blocks/headers: %w", err)
|
||||
wsWaitErr = fmt.Errorf("failed to subscribe for new headers: %w", err)
|
||||
} else {
|
||||
waitersActive++
|
||||
go func() {
|
||||
|
@ -348,17 +340,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
|||
if !ok {
|
||||
// We're toast, retry with non-ws client.
|
||||
hRcvr = nil
|
||||
bRcvr = nil
|
||||
aerRcvr = nil
|
||||
wsWaitErr = ErrMissedEvent
|
||||
break
|
||||
}
|
||||
waitErr = ErrTxNotAccepted
|
||||
case _, ok := <-bRcvr:
|
||||
if !ok {
|
||||
// We're toast, retry with non-ws client.
|
||||
hRcvr = nil
|
||||
bRcvr = nil
|
||||
aerRcvr = nil
|
||||
wsWaitErr = ErrMissedEvent
|
||||
break
|
||||
|
@ -368,7 +349,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
|||
if !ok {
|
||||
// We're toast, retry with non-ws client.
|
||||
hRcvr = nil
|
||||
bRcvr = nil
|
||||
aerRcvr = nil
|
||||
wsWaitErr = ErrMissedEvent
|
||||
break
|
||||
|
@ -390,19 +370,11 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
|||
case _, ok := <-hRcvr:
|
||||
if !ok { // Missed event means both channels are closed.
|
||||
hRcvr = nil
|
||||
bRcvr = nil
|
||||
aerRcvr = nil
|
||||
}
|
||||
case _, ok := <-bRcvr:
|
||||
if !ok { // Missed event means both channels are closed.
|
||||
hRcvr = nil
|
||||
bRcvr = nil
|
||||
aerRcvr = nil
|
||||
}
|
||||
case _, ok := <-aerRcvr:
|
||||
if !ok { // Missed event means both channels are closed.
|
||||
hRcvr = nil
|
||||
bRcvr = nil
|
||||
aerRcvr = nil
|
||||
}
|
||||
case unsubErr := <-unsubErrs:
|
||||
|
@ -426,9 +398,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
|||
if hRcvr != nil {
|
||||
close(hRcvr)
|
||||
}
|
||||
if bRcvr != nil {
|
||||
close(bRcvr)
|
||||
}
|
||||
if aerRcvr != nil {
|
||||
close(aerRcvr)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue