mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Add ReadRemaining helper
This commit is contained in:
parent
10a17d62aa
commit
21f37aefb4
1 changed files with 7 additions and 0 deletions
|
|
@ -120,3 +120,10 @@ func (bb *ByteBuffer) GetVarBytes(byteSizeOfSliceLen int) ([]byte, error) {
|
||||||
func (bb *ByteBuffer) Remaining() int {
|
func (bb *ByteBuffer) Remaining() int {
|
||||||
return bb.size - bb.position
|
return bb.size - bb.position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadRemaining returns all unread bytes in the buffer.
|
||||||
|
// Used by types that need to consume the rest of the buffer (e.g. opaque
|
||||||
|
// placeholder types for forward-compatible deserialization).
|
||||||
|
func (bb *ByteBuffer) ReadRemaining() ([]byte, error) {
|
||||||
|
return bb.getBytes(bb.Remaining())
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue