Commit graph

3 commits

Author SHA1 Message Date
Roman Khimov
0ad6e295ea core: make GetHeaderHash accept uint32
It should've always been this way because block indexes are uint32.
2022-11-25 14:30:51 +03:00
Anna Shaleva
499adccbcb cli: fix race in TestQueryTx
Problem - failing TestQueryTx test:
```
=== RUN   TestQueryTx/verbose/FAULT
=== CONT  TestQueryTx
    logger.go:130: 2022-10-26T10:47:51.414Z	DEBUG	processing rpc request	{"method": "getversion", "params": "[]"}
    logger.go:130: 2022-10-26T10:47:51.415Z	DEBUG	processing rpc request	{"method": "getnativecontracts", "params": "[]"}
    logger.go:130: 2022-10-26T10:47:51.612Z	DEBUG	processing rpc request	{"method": "getversion", "params": "[]"}
    logger.go:130: 2022-10-26T10:47:51.615Z	DEBUG	processing rpc request	{"method": "invokefunction", "params": "[11fdb7bc30a306a60dac874711a2b37b7da402c4 randomMethod  ]"}
    logger.go:130: 2022-10-26T10:47:51.617Z	DEBUG	processing rpc request	{"method": "getblockcount", "params": "[]"}
    logger.go:130: 2022-10-26T10:47:51.617Z	INFO	persisted to disk	{"blocks": 2, "keys": 154, "headerHeight": 2, "blockHeight": 2, "took": "260.704µs"}
    logger.go:130: 2022-10-26T10:47:51.618Z	DEBUG	processing rpc request	{"method": "calculatenetworkfee", "params": "[AIpp7dreAw8AAAAAAAAAAAAAAAAABQAAAAHYzFqQTVJvyabKtVugLJpv54nJVgAAK8IfDAxyYW5kb21NZXRob2QMFMQCpH17s6IRR4esDaYGozC8t/0RQWJ9W1IBACoRDCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcIRQZ7Q3Do=]"}
    logger.go:130: 2022-10-26T10:47:51.712Z	DEBUG	processing rpc request	{"method": "sendrawtransaction", "params": "[AIpp7dreAw8AAAAAABQbEgAAAAAABQAAAAHYzFqQTVJvyabKtVugLJpv54nJVgAAK8IfDAxyYW5kb21NZXRob2QMFMQCpH17s6IRR4esDaYGozC8t/0RQWJ9W1IBQgxAO2nxSMSRNFqBD5lOA37E9Px+nYDGMy6IqZromHXFtVTYD1c1hdUK4vTccoOr2AksdGwDsdQ8qIGJhXdEDxv8NSoRDCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcIRQZ7Q3Do=]"}
    logger.go:130: 2022-10-26T10:47:51.713Z	DEBUG	done processing headers	{"headerIndex": 3, "blockHeight": 2, "took": "228.756µs"}
    logger.go:130: 2022-10-26T10:47:51.813Z	DEBUG	processing rpc request	{"method": "getversion", "params": "[]"}
    logger.go:130: 2022-10-26T10:47:51.815Z	DEBUG	processing rpc request	{"method": "getnativecontracts", "params": "[]"}
    logger.go:130: 2022-10-26T10:47:51.923Z	DEBUG	processing rpc request	{"method": "getrawtransaction", "params": "[22bbb08d3f4b9e601a05c1bb1f7ac456d44bfad013287599bf3f843a75b30076 1]"}
=== CONT  TestQueryTx/verbose/FAULT
    executor.go:238:
        	Error Trace:	executor.go:238
        	            				executor.go:234
        	            				query_test.go:119
        	            				query_test.go:97
        	Error:      	Expect "OnChain:		false" to match "OnChain:\s+true"
        	Test:       	TestQueryTx/verbose/FAULT
```

chain.GetTransaction is looking into mempool also, so we need to check for the
AER instead of transaction.
2022-10-26 14:24:56 +03:00
Roman Khimov
1ac60ada19 cli: move tests to subpackages
Refs. #2379, but not completely solves it, one package seriously outweights
others:

?       github.com/nspcc-dev/neo-go/cli [no test files]
ok      github.com/nspcc-dev/neo-go/cli/app     0.036s  coverage: 100.0% of statements
ok      github.com/nspcc-dev/neo-go/cli/cmdargs 0.011s  coverage: 60.8% of statements
ok      github.com/nspcc-dev/neo-go/cli/flags   0.009s  coverage: 97.7% of statements
?       github.com/nspcc-dev/neo-go/cli/input   [no test files]
ok      github.com/nspcc-dev/neo-go/cli/options 0.033s  coverage: 50.0% of statements
?       github.com/nspcc-dev/neo-go/cli/paramcontext    [no test files]
ok      github.com/nspcc-dev/neo-go/cli/query   2.155s  coverage: 45.3% of statements
ok      github.com/nspcc-dev/neo-go/cli/server  1.373s  coverage: 67.8% of statements
ok      github.com/nspcc-dev/neo-go/cli/smartcontract   8.819s  coverage: 94.3% of statements
ok      github.com/nspcc-dev/neo-go/cli/util    0.006s  coverage: 10.9% of statements
?       github.com/nspcc-dev/neo-go/cli/vm      [no test files]
ok      github.com/nspcc-dev/neo-go/cli/wallet  72.103s coverage: 88.2% of statements

Still a nice thing to have.
2022-10-06 09:21:26 +03:00
Renamed from cli/query_test.go (Browse further)