Commit graph

19 commits

Author SHA1 Message Date
Roman Khimov
a44cb99df6 payload: add a check for zero-length address list
Which is also present in C# code. Thanks, @AnnaShaleva.
2020-10-08 13:26:18 +03:00
Roman Khimov
5abec520c7 payload: limit the number of possible addresses 2020-10-07 23:29:20 +03:00
Anna Shaleva
8c5c248e79 protocol: add capabilities to address payload
Part of #871
2020-05-27 19:02:25 +03:00
Roman Khimov
e41d434a49 *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
Roman Khimov
54d888ba70 io: add type-specific read/write methods
This seriously improves the serialization/deserialization performance for
several reasons:
 * no time spent in `binary` reflection
 * no memory allocations being made on every read/write
 * uses fast ReadBytes everywhere it's appropriate

It also makes Fixed8 Serializable just for convenience.
2019-12-12 20:19:50 +03:00
Evgenii Stratonikov
fccb008594 io: implement ReadBytes() 2019-12-09 15:00:15 +03:00
Roman Khimov
844491d365 *: use more efficient WriteBytes where appropriate
Before this patch on block import we could easily be spending more than 6
seconds out of 30 in Uint256 encoding for UnspentBalance, now it's completely
off the radar.
2019-12-06 18:22:21 +03:00
Evgenii Stratonikov
b16e56a47b io: refactor BinReader.ReadArray()
Make it accept arbitrary slice pointer.
2019-11-14 14:19:58 +03:00
Evgenii Stratonikov
ad9091d13d io: implement generic array (de-)serialization
It is done through reflection and panics
in every unexpected situation.
2019-11-13 17:27:23 +03:00
Roman Khimov
6029d5a888 payload: drop useless type declaration
golint suggests:
    pkg/network/payload/address.go:48:12: should omit type net.IP from declaration of var netip; it will be inferred from the right-hand side
2019-10-17 12:19:41 +03:00
Roman Khimov
d1a4e43c48 io: redo Serializable to return errors in BinReader/BinWriter
Further simplifies error handling.
2019-09-17 13:21:52 +03:00
Roman Khimov
5bf00db2c9 io: move BinReader/BinWriter there, redo Serializable with it
The logic here is that we'll have all binary encoding/decoding done via our io
package, which simplifies error handling. This functionality doesn't belong to
util, so it's moved.

This also expands BufBinWriter with Reset() method to fit the needs of core
package.
2019-09-16 23:39:51 +03:00
Roman Khimov
aacf58c9ab util: add 'constructors' for BinReader/BinWriter
And an additional BufBinWriter to ease buffer management.
2019-09-16 23:38:48 +03:00
Roman Khimov
b9ff4d929c network: add getaddr message handling
Respond with known good addresses.
2019-09-16 16:32:04 +03:00
Roman Khimov
90e13debe4 network: implement getaddr sends and addr receival
Request new addresses if we're short on known addresses pool size.
2019-09-16 16:26:30 +03:00
Roman Khimov
8d9bc83214 util: drop Endpoint structure, fix #321
I think it's useless, buggy and hides parsing errors for no good reason.
2019-09-09 17:54:38 +03:00
Roman Khimov
459542a978 pkg/network: convert to using binaryReader/Writer 2019-08-28 19:45:17 +03:00
Anthony De Meulemeester
aa4bc1b6e8
Node improvements (#47)
* block partial persist

* replaced refactored files with old one.

* removed gokit/log from deps

* Tweaks to not overburden remote nodes with getheaders/getblocks

* Changed Transporter interface to not take the server as argument due to a cause of race warning from the compiler

* started server test suite

* more test + return errors from message handlers

* removed --race from build

* Little improvements.
2018-03-14 10:36:59 +01:00
Anthony De Meulemeester
4023661cf1
Refactor of the Go node (#44)
* added headersOp for safely processing headers

* Better handling of protocol messages.

* housekeeping + cleanup tests

* Added more blockchain logic + unit tests

* fixed unreachable error.

* added structured logging for all (node) components.

* added relay flag + bumped version
2018-03-09 16:55:25 +01:00