mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 03:41:45 +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
|
breaking changes. Consider changing your code/scripts/configurations if you're
|
||||||
using anything mentioned here.
|
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`
|
## Dump*Slot() methods of `vm.Context`
|
||||||
|
|
||||||
The following new methods have been exposed to give access to VM context slot contents
|
The following new methods have been exposed to give access to VM context slot contents
|
||||||
|
|
|
@ -74,7 +74,6 @@ type (
|
||||||
RPCPollingBased
|
RPCPollingBased
|
||||||
|
|
||||||
ReceiveHeadersOfAddedBlocks(flt *neorpc.BlockFilter, rcvr chan<- *block.Header) (string, error)
|
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)
|
ReceiveExecutions(flt *neorpc.ExecutionFilter, rcvr chan<- *state.AppExecResult) (string, error)
|
||||||
Unsubscribe(id string) error
|
Unsubscribe(id string) error
|
||||||
}
|
}
|
||||||
|
@ -282,7 +281,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
||||||
wsWaitErr error
|
wsWaitErr error
|
||||||
waitersActive int
|
waitersActive int
|
||||||
hRcvr = make(chan *block.Header, 2)
|
hRcvr = make(chan *block.Header, 2)
|
||||||
bRcvr = make(chan *block.Block, 2)
|
|
||||||
aerRcvr = make(chan *state.AppExecResult, len(hashes))
|
aerRcvr = make(chan *state.AppExecResult, len(hashes))
|
||||||
unsubErrs = make(chan error)
|
unsubErrs = make(chan error)
|
||||||
exit = make(chan struct{})
|
exit = make(chan struct{})
|
||||||
|
@ -292,13 +290,7 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
||||||
since := vub
|
since := vub
|
||||||
blocksID, err := w.ws.ReceiveHeadersOfAddedBlocks(&neorpc.BlockFilter{Since: &since}, hRcvr)
|
blocksID, err := w.ws.ReceiveHeadersOfAddedBlocks(&neorpc.BlockFilter{Since: &since}, hRcvr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Falling back to block-based subscription.
|
wsWaitErr = fmt.Errorf("failed to subscribe for new headers: %w", err)
|
||||||
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)
|
|
||||||
} else {
|
} else {
|
||||||
waitersActive++
|
waitersActive++
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -348,17 +340,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
||||||
if !ok {
|
if !ok {
|
||||||
// We're toast, retry with non-ws client.
|
// We're toast, retry with non-ws client.
|
||||||
hRcvr = nil
|
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
|
aerRcvr = nil
|
||||||
wsWaitErr = ErrMissedEvent
|
wsWaitErr = ErrMissedEvent
|
||||||
break
|
break
|
||||||
|
@ -368,7 +349,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
||||||
if !ok {
|
if !ok {
|
||||||
// We're toast, retry with non-ws client.
|
// We're toast, retry with non-ws client.
|
||||||
hRcvr = nil
|
hRcvr = nil
|
||||||
bRcvr = nil
|
|
||||||
aerRcvr = nil
|
aerRcvr = nil
|
||||||
wsWaitErr = ErrMissedEvent
|
wsWaitErr = ErrMissedEvent
|
||||||
break
|
break
|
||||||
|
@ -390,19 +370,11 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
||||||
case _, ok := <-hRcvr:
|
case _, ok := <-hRcvr:
|
||||||
if !ok { // Missed event means both channels are closed.
|
if !ok { // Missed event means both channels are closed.
|
||||||
hRcvr = nil
|
hRcvr = nil
|
||||||
bRcvr = nil
|
|
||||||
aerRcvr = nil
|
|
||||||
}
|
|
||||||
case _, ok := <-bRcvr:
|
|
||||||
if !ok { // Missed event means both channels are closed.
|
|
||||||
hRcvr = nil
|
|
||||||
bRcvr = nil
|
|
||||||
aerRcvr = nil
|
aerRcvr = nil
|
||||||
}
|
}
|
||||||
case _, ok := <-aerRcvr:
|
case _, ok := <-aerRcvr:
|
||||||
if !ok { // Missed event means both channels are closed.
|
if !ok { // Missed event means both channels are closed.
|
||||||
hRcvr = nil
|
hRcvr = nil
|
||||||
bRcvr = nil
|
|
||||||
aerRcvr = nil
|
aerRcvr = nil
|
||||||
}
|
}
|
||||||
case unsubErr := <-unsubErrs:
|
case unsubErr := <-unsubErrs:
|
||||||
|
@ -426,9 +398,6 @@ func (w *EventBased) WaitAny(ctx context.Context, vub uint32, hashes ...util.Uin
|
||||||
if hRcvr != nil {
|
if hRcvr != nil {
|
||||||
close(hRcvr)
|
close(hRcvr)
|
||||||
}
|
}
|
||||||
if bRcvr != nil {
|
|
||||||
close(bRcvr)
|
|
||||||
}
|
|
||||||
if aerRcvr != nil {
|
if aerRcvr != nil {
|
||||||
close(aerRcvr)
|
close(aerRcvr)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue