Commit graph

11 commits

Author SHA1 Message Date
Anna Shaleva
8444f3d816 network: refactor notary service's PostBlock
There was a deadlock while trying to finalize transaction during
PostBlock:
	1) (*Notary).PostBlock is called under the blockchain lock
	2) (*Notary).onTransaction is called inside the PostBlock
	3) (*Notary).onTransaction needs to RLock the blockchain to add
completed transaction to the memory pool (and the blockchain is Lock'ed
by this moment)

The problem is fixed by using notifications subsistem, because it's not
required to call (*Notary).PostBlock under the blockchain lock.
2021-02-11 17:11:36 +03:00
Anna Shaleva
b0563ad0d7 services: fix Oracle responces mutex
Solves the following problem:
=== RUN   TestOracleFull
    logger.go:130: 2021-02-04T09:25:16.305Z	INFO	P2PNotaryRequestPayloadPool size is not set or wrong, setting default value	{"P2PNotaryRequestPayloadPoolSize": 1000}
    logger.go:130: 2021-02-04T09:25:16.306Z	INFO	no storage version found! creating genesis block
    logger.go:130: 2021-02-04T09:25:27.687Z	DEBUG	done processing headers	{"headerIndex": 1, "blockHeight": 0, "took": "2.413398ms"}
    logger.go:130: 2021-02-04T09:25:27.696Z	DEBUG	done processing headers	{"headerIndex": 2, "blockHeight": 1, "took": "1.138196ms"}
    logger.go:130: 2021-02-04T09:25:28.680Z	INFO	blockchain persist completed	{"persistedBlocks": 2, "persistedKeys": 173, "headerHeight": 2, "blockHeight": 2, "took": "166.793µs"}
fatal error: sync: Unlock of unlocked RWMutex

goroutine 6157 [running]:
runtime.throw(0x115dfdb, 0x20)
	/usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc000297ca0 sp=0xc000297c70 pc=0x44f432
sync.throw(0x115dfdb, 0x20)
	/usr/local/go/src/runtime/panic.go:1102 +0x35 fp=0xc000297cc0 sp=0xc000297ca0 pc=0x44f3b5
sync.(*RWMutex).Unlock(0xc000135300)
	/usr/local/go/src/sync/rwmutex.go:129 +0xf3 fp=0xc000297d00 sp=0xc000297cc0 pc=0x4a1ac3
github.com/nspcc-dev/neo-go/pkg/services/oracle.(*Oracle).Run(0xc000135180)
	/go/src/github.com/nspcc-dev/neo-go/pkg/services/oracle/oracle.go:189 +0x82b fp=0xc000297fd8 sp=0xc000297d00 pc=0xe13b0b
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000297fe0 sp=0xc000297fd8 pc=0x4834d1
created by github.com/nspcc-dev/neo-go/pkg/core.TestOracleFull
	/go/src/github.com/nspcc-dev/neo-go/pkg/core/oracle_test.go:276 +0x3f1
2021-02-05 11:37:12 +03:00
Anna Shaleva
df26ca1c7f core: add Notary module test 2021-02-02 22:01:32 +03:00
Anna Shaleva
bfbd096fed core: introduce mempool notifications 2021-02-02 22:01:32 +03:00
Anna Shaleva
19fa0daaa6 core, network: add Notary module 2021-02-02 22:01:20 +03:00
Evgeniy Stratonikov
c420014cb5 oracle: implement filters 2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
e4528e59dc oracle: reprocess request on fail 2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
aa852aaaac oracle: submit responses concurrently 2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
25d734cbad oracle: process requests concurrently 2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
43e4d3af88 oracle: integrate module in core and RPC
1. Initialization is performed via `Blockchain` methods.
2. Native Oracle contract updates list of oracle nodes
  and in-fly requests in `PostPersist`.
3. RPC uses Oracle module directly.
2021-01-28 13:00:58 +03:00
Evgenii Stratonikov
7e16bea126 network: implement Oracle module 2021-01-28 12:43:20 +03:00