Roman Khimov
71a18b1727
Merge pull request #688 from nspcc-dev/fix/jmplabels
...
compiler: use uint16 for labels
2020-02-27 00:28:46 +03:00
Roman Khimov
b1b184f77f
Merge pull request #692 from nspcc-dev/persist-timer-fix
...
core: reschedule the next persist in a second from previous one
2020-02-26 10:34:40 +03:00
Roman Khimov
2f2a4afe21
Merge pull request #693 from nspcc-dev/memorystore-seek-lock
...
storage: add locking into (*MemoryStore).Seek
2020-02-26 10:15:40 +03:00
Roman Khimov
ed9e9e8590
storage: add locking into (*MemoryStore).Seek
...
It was missing there.
2020-02-24 17:51:50 +03:00
Roman Khimov
b49808b766
core: reschedule the next persist in a second from previous one
...
It makes little sense queueing up several persistence goroutines (or actually
even running them concurrently).
2020-02-24 17:17:25 +03:00
Anna Shaleva
76a0a6e7e8
rpc: implement getblocksysfee RPC
...
Closes #341
2020-02-21 18:45:52 +03:00
Evgenii Stratonikov
177b725dc1
compiler: make writeJumps return error for bad jumps
...
The script is invalid anyway so it is better to notify user.
2020-02-21 17:45:45 +03:00
Evgenii Stratonikov
5e229d84d4
compiler: use uint16 for label numbers
...
As noted in #687 this will make compiler a bit more predictable.
2020-02-21 17:45:45 +03:00
Roman Khimov
8da20055d6
rpc: drop duplicating structures used in tests
...
We have proper results now, so use those. The only left is Invoke, but that
depends on another issue at the moment.
2020-02-21 15:23:11 +03:00
Roman Khimov
6a3be6081c
smartcontract: support "ByteArray" string for ByteArrayType
...
We actually do emit it ourselves in String()
2020-02-21 15:23:11 +03:00
Roman Khimov
3fa9de764b
rpc/client: only return the Result from calls, handle Error internally
...
Adjust structures accordingly and throw away most of them, they're useless.
2020-02-21 15:23:11 +03:00
Roman Khimov
28a26d2cae
rpc/client: look into data first, then HTTP error code
...
In case of error our own server responds with an HTTP error and proper
JSON-RPC error in the body, so look there first as it has more specific data.
2020-02-21 15:12:04 +03:00
Roman Khimov
877b987ecf
rpc: omitempty some fields in TransactionOutputRaw
...
These might be undefined for mempool transactions, thus they should be defined
as omitempty.
2020-02-21 15:12:04 +03:00
Roman Khimov
bba8ac15ff
rpc: introduce proper type for sendrawtransaction, drop useless types
...
sendrawtransaction just returns a bool, sendtoaddress returns a proper
transaction and that should be the same as the one we have in
TransactionOutputRaw.
2020-02-21 15:12:04 +03:00
Roman Khimov
465476201c
rpc/response: drop duplicating AccountState structure
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
b50704fd3b
rpc: move server-related code to a separate package
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
d24c6d1d9e
rpc: move client-related code to a separate package
...
This includes Client struct with RPC methods and
BalanceGetter implementation with NeoSCAN.
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
b6bc4e580a
rpc: move functions for Tx building in request package/
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
98a1e2170a
rpc: move ContractDetails to request/ package
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
63751a6e6b
rpc: merge neoscan-related definitions into one file
...
It will make refactoring easier.
2020-02-21 15:12:04 +03:00
Roman Khimov
f330f2f40b
rpc: separate out request and response structures
...
Mostly as is, no real effort done yet to optimize them, so there are still a
lot of duplicates there, but at least we sort them out into different smaller
packages.
2020-02-21 15:12:04 +03:00
Roman Khimov
69e1ad512f
rpc: move result package into response
...
`response` is to be populated soon.
2020-02-21 15:12:04 +03:00
Roman Khimov
1801e545a0
rpc: remove wrappers package, move things to result
...
These are all RPC call results, `wrappers` package doesn't make much sense to
me.
2020-02-21 15:12:04 +03:00
Roman Khimov
b8f7ab8e6a
rpc: move Invoke to result package
...
It's just a data.
2020-02-21 15:12:04 +03:00
Roman Khimov
c189062f40
rpc: move ValidateAddress to the result package
...
Because it is a result of the RPC call.
2020-02-21 15:12:04 +03:00
Roman Khimov
bfa2d54e16
rpc: move validateAddress() function from wrappers into server
...
It's a server implementation detail, it has nothing to do with the data format
itself. It also makes no sense exporing it.
2020-02-21 15:12:04 +03:00
Roman Khimov
72a62f1292
result: add trivial test for peers management functions
2020-02-21 15:12:04 +03:00
Roman Khimov
723b33e108
network: implement unconnected/bad peers getters
...
Which allows node to respond to `getpeers` RPC request correctly.
2020-02-21 15:12:03 +03:00
Roman Khimov
d92e193e63
rpc/network: refactor getpeers logic
...
Deduplicate and simplify code.
2020-02-21 15:12:03 +03:00
Roman Khimov
336a94456f
rpc: make blockHeightFromParam a pointer method
...
Makes no sense copying Server here.
2020-02-21 15:12:03 +03:00
Roman Khimov
f345db58ab
Merge pull request #678 from nspcc-dev/feature/breakfor
...
compiler: support break statement in for loops and switch statements
Closes #677 .
Implements 4-th point from #628 .
2020-02-21 12:22:16 +03:00
Evgenii Stratonikov
da89f18999
compiler: support break and continue in range loops
2020-02-21 12:03:37 +03:00
Evgenii Stratonikov
ccb53414f2
compiler: support break in switch statements
2020-02-21 12:03:37 +03:00
Evgenii Stratonikov
03dc6f7cbb
compiler: support continue statement in for loops
2020-02-21 12:03:36 +03:00
Evgenii Stratonikov
fa2edc46e0
compiler: support break statement in for loops
2020-02-21 11:38:23 +03:00
Evgenii Stratonikov
25ffb56982
wallet: support creating multisig accounts
...
(*Account).ConvertMultisig() will convert an existing account
into a multisig one.
2020-02-21 11:19:35 +03:00
Evgenii Stratonikov
5a727cabf8
wallet: add signature check contracts to new accounts
2020-02-21 10:45:57 +03:00
Evgenii Stratonikov
eacea8bff5
smartcontract: implement json.Unmarshaler for ParamType
2020-02-20 15:52:08 +03:00
Evgenii Stratonikov
ea30122a09
wallet: rewrite file on save
...
When we are opening a file, it is expected that
it will be rewritten, not appended to a already existing wallet.
2020-02-20 15:52:08 +03:00
Evgenii Stratonikov
ad6fa2aea9
wallet: set WIF and public key on account decrypt
...
They are set during account creation and open+decrypt is
expected to put account in the same state.
2020-02-20 15:52:08 +03:00
Evgenii Stratonikov
d837eb3761
wallet: allow to create accounts from encrypted WIFs
2020-02-20 15:52:08 +03:00
Roman Khimov
a903147b60
keys: rename Signature to GetScriptHash, make it return Uint160
...
Signature itself wasn't used at all and its name is very misleading, Uint160
script hash is way more useful.
2020-02-19 12:19:03 +03:00
Roman Khimov
eb11e5fb11
core: implement basic policying support, fix #370
...
Implement mempool and consensus block creation policies, almost the same as
SimplePolicy plugin for C# node provides with two caveats:
* HighPriorityTxType is not configured and hardcoded to ClaimType
* BlockedAccounts are not supported
Other than that it allows us to run successfuly as testnet CN, previously our
proposals were rejected because we were proposing blocks with oversized
transactions (that are rejected by PoolTx() now).
Mainnet and testnet configuration files are updated accordingly, but privnet
is left as is with no limits.
Configuration is currently attached to the Blockchain and so is the code that
does policying, it may be moved somewhere in the future, but it works for
now.
2020-02-19 12:19:02 +03:00
Roman Khimov
22f5667530
mempool: return fee along with tx when requesting tx
...
Users of GetVerifiedTransactions() don't want to recalculate tx fee and it's
nice to have it returned from TryGetValue() also sometimes.
2020-02-19 12:19:02 +03:00
Roman Khimov
06daeb44f3
core: make IsLowPriority work with pre-calculated fee
...
Don't recalculate it again and again.
2020-02-19 12:19:02 +03:00
Roman Khimov
37c48b00b4
consensus/network: reinit dbft after block addition
...
Don't stall on some height if everyone else have moved up already. Fix #673 .
2020-02-19 12:19:02 +03:00
Roman Khimov
c5d54e9992
network: introduce (*Server).IsInSync, start consensus in synced state
...
We define synchronized state as a combination of minimum number of peers and
chain height being not behind of more than 2/3 of these peers.
2020-02-19 12:13:27 +03:00
Roman Khimov
a2616cfafe
consensus: correctly generate miner TX outputs based on net fee
2020-02-19 12:13:27 +03:00
Roman Khimov
17d1b1a2ae
wallet: implement GetChangeAddress()
...
To select the default address to send tokens to.
2020-02-19 12:13:27 +03:00
Roman Khimov
a4294f4b5f
core: export UtilityTokenID and GoverningTokenID
...
Both are very useful outside of the core, this change also makes respective
transactions initialize with the package as they don't depend on any kind of
input and it makes no sense recreating them again and again on every use.
2020-02-19 12:13:27 +03:00