forked from TrueCloudLab/neoneo-go
rpcclient: fix WS-client unsubscription process
Do not block subscribers until the unsubscription request to RPC server is completed. Otherwise, another notification may be received from the RPC server which will block the unsubscription process. At the same time, fix event-based waiter. We must not block the receiver channel during unsubscription because there's a chance that subsequent event will be sent by the server. We need to read this event in order not to block the WSClient's readloop.
This commit is contained in:
parent
ddaba9e74d
commit
6dbae7edc4
9 changed files with 225 additions and 86 deletions
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/neotest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nns"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/nspcc-dev/neo-go/pkg/wallet"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -273,6 +274,11 @@ func Init(t *testing.T, rootpath string, e *neotest.Executor) {
|
|||
storageCfg := filepath.Join(testDataPrefix, "storage", "storage_contract.yml")
|
||||
_, _, _ = deployContractFromPriv0(t, storagePath, "Storage", storageCfg, StorageContractID)
|
||||
|
||||
// Block #23: add FAULTed transaction to check WSClient waitloops.
|
||||
faultedInvoker := e.NewInvoker(cHash, acc0)
|
||||
faultedH := faultedInvoker.InvokeScriptCheckFAULT(t, []byte{byte(opcode.ABORT)}, []neotest.Signer{acc0}, "at instruction 0 (ABORT): ABORT")
|
||||
t.Logf("FAULTed transaction:\n\thash LE: %s\n\tblock index: %d", faultedH.StringLE(), e.Chain.BlockHeight())
|
||||
|
||||
// Compile contract to test `invokescript` RPC call
|
||||
invokePath := filepath.Join(testDataPrefix, "invoke", "invokescript_contract.go")
|
||||
invokeCfg := filepath.Join(testDataPrefix, "invoke", "invoke.yml")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue