Roman Khimov
c3175112fe
network: fix Ping messages
...
* NewPing() accepts block index first and nonce then.
* Block height should be used, it'll be important for state exchanging nodes
2021-08-06 11:31:31 +03:00
Roman Khimov
38d14d4e3a
network: drop requests to discovery pool when it can't be handled
...
It happens from time to time in a four-node private network where there are
seeds (aka CNs) and not a lot of other nodes to connect to.
I don't know how to test for an infinite loop that has no side-effects, so no
test added here.
2021-06-18 10:55:29 +03:00
Roman Khimov
9d6439bbe6
network: don't attempt to connect to the same node twice
...
We can have multiple copies of the same address in the pool and we should only
proceed to connect once per attempt.
2021-06-18 10:50:01 +03:00
Roman Khimov
46a59e904a
network: don't register addresses before version handshake
...
1) It duplicates registration in `version` message handler and no valid
connection can work without version exchange.
2) On public networks we have seed nodes defined by names, so we register
connections to them using these names, but then if connection is dropped we
delist them by IP:PORT combinations which can lead to zero PeerCount() with
all seeds still being registered as connected in the discovery subsystem
and thus no reconnection attempts being made.
2021-06-18 10:49:42 +03:00
Roman Khimov
bcc2d1bb8f
dao: don't treat zero stateroot as valid during MPT init
...
Because it's not really valid and MPT state should be the same as if it was
initialized at height 0. Fixes #1870
2021-04-19 12:39:43 +03:00
Roman Khimov
1202494479
state: reject too big transfers, fix #1900
2021-04-12 12:14:33 +03:00
Roman Khimov
663f10192f
core: record transfers even if 'from' balance is 0
...
Transfer events should still be saved even if balance tracking goes wild.
2021-03-16 12:57:20 +03:00
Roman Khimov
3f50f90dc5
Merge pull request #1760 from nspcc-dev/rpc-compatibility-fixes-and-docs
...
[2.x] RPC compatibility (and other) fixes and docs
2021-02-19 12:30:59 +03:00
Roman Khimov
98580ae9b4
transaction: always JSONize all contract fields for Publish tx
2021-02-18 17:28:19 +03:00
Roman Khimov
7fc4f3c4ea
transaction: always marshal all token's data for register tx
...
Fix missing precision and token type.
2021-02-18 17:28:19 +03:00
Roman Khimov
9d6a5dc26f
result: fix confirmations count for blocks
...
It's +1, current block actually had `-1` value calcuated that transformed into
4294967295.
2021-02-18 17:28:19 +03:00
Roman Khimov
8571107741
core: bump DB version for NEP5 tracking data change
...
It's incompatible.
2021-02-18 17:28:19 +03:00
Roman Khimov
eb1986d2fc
state: use big.Int for NEP5 balances and transfer amounts
...
In general, NEP5 contracts are not limited to int64. And we have an example
of pnWETH Flamingo token now (with 18 decimals) that easily overflows int64,
so for correctness we need to store big.Int.
And as TransferLog is shared for different purposes I've decided to not make
it variable-length on Neo 2.
2021-02-18 17:28:19 +03:00
Roman Khimov
38842531ca
core: drop NEP5 tracker data if balance is zero
...
Makes no sense storing it and returning to the user (C# plugin doesn't do
that).
2021-02-18 17:28:19 +03:00
Roman Khimov
07c91ea22d
core: fix getenrollments
...
Make getvalidators return the same set of keys with C# for mainnet.
2021-02-18 17:28:19 +03:00
Roman Khimov
1ef91fa409
rpc: encode port numbers as proper numbers in getpeers
...
The way C# node does it.
2021-02-18 17:28:19 +03:00
Roman Khimov
850d29060a
result: assets are LE in JSON
...
LE/BE split is the worst NEO feature ever.
2021-02-18 17:28:19 +03:00
Roman Khimov
70a20ce031
core: fix system fee calculation
...
It was completely wrong starting from the genesis block.
2021-02-18 17:28:19 +03:00
Roman Khimov
5ff57e890b
consensus: flush previous proposal on new block
...
Reusing proposals from previous blocks doesn't make sense. And reduce some
code duplication along the way.
2021-02-18 15:45:34 +03:00
Roman Khimov
d1e02c393d
consensus: only use previous proposal if it has something in it
...
It might just be uninitialized it doesn't really make sense using zero-length
previous proposal anyway.
2021-02-18 15:42:06 +03:00
Roman Khimov
62a11807a8
fixedn: always correctly unmarshal Fixed8 values
...
Quoted or not, they should be unmarshalled without going through float64.
2021-02-18 15:38:02 +03:00
Evgeniy Stratonikov
feb6ba2ef7
io: allow to restrict string size
2021-02-18 15:36:22 +03:00
Roman Khimov
a46c93f6bb
rpc: fix getblocksystemfee call
...
It should return cumulative fee and it should be wrapped into a string.
2021-02-15 17:58:39 +03:00
Roman Khimov
fda8b784c8
rpc/server: allow numbers for getblockheader call
2021-02-15 17:27:23 +03:00
Roman Khimov
9c34dea296
rpc/server: return more specific error in getblockhash
2021-02-15 16:18:03 +03:00
Roman Khimov
c3b6405f0f
transaction: fix asset type JSONization
...
It's stringy in C#.
2021-02-12 23:02:51 +03:00
Roman Khimov
90a06ed7a5
rpc: fix IsFrozen JSONization for assets
...
C# node uses `frozen` as field name here.
2021-02-12 00:04:13 +03:00
Roman Khimov
9571ecffac
core: add proper asset issuer for UTXO assets
...
It just wasn't set which is wrong (AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM was
always the issuer).
2021-02-12 00:01:00 +03:00
Roman Khimov
89fb02a7f8
Merge pull request #1648 from nspcc-dev/backport-fixes-from-master
...
Backport fixes from master to 2.x
2021-01-11 12:44:05 +03:00
Roman Khimov
9e35758653
rpc: fix gettxout result for already spent outputs
...
As per C# documentation [1]:
If the transaction output is already spent, the result value will be null .
[1]: https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api/gettxout.html
2020-12-31 13:54:42 +03:00
Evgenii Stratonikov
ee45d7739f
network: fix requestTx()
...
2 bugs were here:
1. If amount of tx is small, no messages were sent.
2. Correctly cut byte slice if last message is small.
2020-12-31 13:00:50 +03:00
Roman Khimov
363c24d128
network: fix tx requests, we can't ask more than 500 txes at once
2020-12-31 13:00:00 +03:00
Evgenii Stratonikov
9756ed2b06
network: set timeout on write
...
Fix a bug occuring under high load when node
hangs during this write.
2020-12-31 12:58:00 +03:00
Evgenii Stratonikov
edf587bbf1
network: fix a bug in discovery with a peer connected twice
...
It could be the case that checks are performed simultaneosly and
peers connections goes down from 2 to 0. We must take such case into
account and register address as good in discovery.
2020-12-31 12:57:43 +03:00
Evgenii Stratonikov
0d2bc8f4a6
network: remove extra error check from Message.Encode()
...
Buffer write error is returned from `Encode()`.
2020-12-31 12:52:40 +03:00
Evgenii Stratonikov
0510d1e6c1
vmcli: return after error in break
2020-12-31 12:51:01 +03:00
Evgenii Stratonikov
5d6065c3ee
vmcli: set breakpoint before the instruction
...
Breakpoint should occur before actual instruction execution.
2020-12-31 12:50:52 +03:00
Anna Shaleva
4a8259caea
rpc: adjust getrawtransaction
and gettransactionheight
RPC call
...
We should not return transaction metadata from `getrawtransaction` in case
transaction is not in the mempool. Height shouldn't be returned from
`gettransactionheight` in case transaction is in the mempool.
2020-12-31 12:44:07 +03:00
Roman Khimov
124c674b17
*: gofmt -s
2020-12-31 11:52:27 +03:00
Anna Shaleva
66a64dd4c9
core: fix bug with mempool.verifiedMap
...
Changes ported from #1621 .
2020-12-16 14:14:09 +03:00
Roman Khimov
64d0876fc0
Merge pull request #1503 from nspcc-dev/mpt/refcount
...
Implement reference counting in MPT
2020-11-18 14:20:42 +03:00
Evgenii Stratonikov
0ffffb93d7
mpt: implement reference counting
2020-11-18 12:16:05 +03:00
Evgenii Stratonikov
d93ddfda10
network: retransmit stale transactions
2020-11-11 15:51:36 +03:00
Roman Khimov
06f3c34981
mempool: replace timeStamp with blockStamp
...
Time is not really relevant for us here and we don't use this timestamp in any
way. Yet it occupies 24 bytes and we do two clock_gettime calls to get it.
Replace it with blockStamp which is going to be used in the future for
transaction retransmissions.
It allows to improve single-node TPS by another 3%.
2020-11-11 15:48:13 +03:00
Evgenii Stratonikov
f3abbf34e3
mpt: fill cached fields when getting node from store
...
Node which has been got from store shouldn't be flushed again.
2020-11-11 13:22:53 +03:00
Evgenii Stratonikov
df1792c80b
mpt: export func for decoding node with type
...
`NodeObject` can contain auxilliary fields and shouldn't be used from outside.
2020-11-11 13:22:53 +03:00
Anna Shaleva
ef3eb0a842
rpc: allow batch JSON-RPC requests
...
Close #1509
2020-11-06 17:20:27 +03:00
Roman Khimov
68fc8168ec
rpc: add getblocktransfertx RPC call
...
It uses a bit different output format than getalltransfertx, so
TransferTxEvent type was adjusted accordingly.
2020-11-02 19:01:48 +03:00
Roman Khimov
136e4b5886
core: move NotificationEvent->NEP5Transfer conversion to state
...
We'll need it as a separate function and it's cleaner this way.
2020-10-29 22:10:40 +03:00
Roman Khimov
14c39b2b26
storage: fix Get for BoltDB, fix #1482
2020-10-13 19:21:57 +03:00