Commit Graph

9 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
4226232881
lnwire: export ReadElements and WriteElements
In this commit, we export the ReadElements and WriteElements functions.
We do this as exporting these functions makes it possible for outside
packages to define serializations which use the BOLT 1.0 wire format.
2018-12-24 19:58:06 -06:00
Olaoluwa Osuntokun
f7436f43b2
lnwire: check length of payload in decodeShortChanIDs 2018-09-13 15:57:08 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Conner Fromknecht
61c2493b7d
lnwire/query_short_chan_ids: short circuit if 0 sids
In this commit, we alter the behavior of the regular
short channel id encoding, such that it returns a nil
slice if the decoded number of elements is 0. This is
done so that it matches the behavior of the zlib
decompression, allowing us to test both in using the
same corpus.
2018-07-03 17:08:40 -07:00
Olaoluwa Osuntokun
23b1678266
lnwire: ensure zlib short chan id's are sorted 2018-06-25 16:16:37 -07:00
Olaoluwa Osuntokun
5caf3d7310
lnwire: add new package level mutex to limit # of concurrent zlib decodings
In this commit, we add a new package level mutex. Each time we decode a
new set of chan IDs w/ zlib, we also grab this mutex. The purpose here
is to ensure that we only EVER allocate the maxZlibBufSize globally
across all peers. Otherwise, it may be possible for us to allocate up to
64 MB for _each_ peer, exposing an easy OOM attack vector.
2018-06-25 16:16:36 -07:00
Olaoluwa Osuntokun
a0e2f8dbd1 lnwire: implement zlib encode/decode for channel range queries
In this commit, we implement zlib encoding and decoding for the channel
range queries. Notably, we utilize an io.LimitedReader to ensure that we
can enforce a hard cap on the total number of bytes we'll ever allocate
in a decoding attempt.
2018-06-25 16:16:13 -07:00
Olaoluwa Osuntokun
1c8c1cba96
lnwire: only check payload for proper size if encoding type is sorted plain
In this commit, we fix a slight bug in the parsing of encoded short
channel ID's. Before this commit, we would always assume that the remote
peer was sending us the sorted+encoded variant of the short channel
ID's. In the case that they weren't (as there isn't yet a feature bit),
we would assert this check and fail early as atm we don't support any
sort of compression.
2018-06-04 16:31:22 -07:00
Olaoluwa Osuntokun
898d5ffccf
lnwire: add new QueryShortChanIDs gossip query msg 2018-05-31 16:30:50 -07:00