Previously, `ArithmeticException` was thrown which is unlikely to be handled by
consumers.
`BufferUnderflowException` is the correct exception to throw, under the assumption
that a giant length can't be followed by a collection of equally giant length.
`-1` and `Integer.MIN_VALUE` (and all values inbetween) are in fact
very large VarInts that can only be expressed as a long. So their
test data have been moved from `VarIntTest.integerTestVectors` to
`longTestVectors`.
`intValue()` is changed to guard against such cases, and a helper
`fitsInt()` is introduced.
JavaDocs are added to `intValue()` and `longValue()` to clarify the
expected value ranges.
It is never sent on its own, so it doesn't need to be a `Message`.
* Static constructor `read(protocolVariant)` replaces the native constructor that deserialized
from a payload.
* `write()` helper replaces `bitcoinSerializeToStream()`.
* `serialize()` and `getMessageSize()` helpers replace `bitcoinSerialize()`.
It is never sent on its own, so it doesn't need to be a `Message`.
* Static constructor `read()` replaces the native constructor that deserialized
from a payload.
* `write()` helper replaces `bitcoinSerializeToStream()`.
* `serialize()` and `getMessageSize()` helpers replace `bitcoinSerialize()`.
Includes a test.
Rather, use `InetSocketAddress` and `Services`.
This makes `time` in `PeerAddress` a required field. It also drops
support for TORv2 addresses in `VersionMessage` (if that was ever
a thing).
* Rename `getBitcoinProtocolVersion()` to `intValue()`
* Deprecate `NetworkParameters.getProtocolVersionNum()`. This eliminates
what seems to be an unnecessary level of indirection.
* Add tests.
This will also help eliminate a dependency on `NetworkParameters` in some places.
It is never sent on its own, so it doesn't need to be a `Message`.
* A static constructur `read()` replaces the native constructor that deserialized
from a payload.
* A `write()` helper replaces `bitcoinSerializeToStream()`.
* A `serialize()` helper replaces `bitcoinSerialize()`.
This comes with tests.
* A static constructur `read()` deserializes from a payload.
* A `write()` helper replaces `bitcoinSerializeToStream()`.
* A `serialize()` helper gets the serialized bytes.
This comes with a test.