mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
Merge 0aea942be3 into 3ebcf92b42
This commit is contained in:
commit
6680b5ce09
2 changed files with 8 additions and 1 deletions
|
|
@ -68,7 +68,7 @@ func compressChunk(dat []byte) (ret []byte, n int) {
|
||||||
return []byte{token, tokenToken}, 1
|
return []byte{token, tokenToken}, 1
|
||||||
case len(dat) > 1 && dat[0] == 0x0 && dat[1] == 0x0:
|
case len(dat) > 1 && dat[0] == 0x0 && dat[1] == 0x0:
|
||||||
j := 0
|
j := 0
|
||||||
for j <= 254 && j < len(dat) {
|
for j <= 249 && j < len(dat) {
|
||||||
if dat[j] != 0 {
|
if dat[j] != 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,3 +48,10 @@ func (s *CompressionRleSuite) TestDecompressSimple(c *checker.C) {
|
||||||
c.Assert(res, checker.DeepEquals, make([]byte, 10))
|
c.Assert(res, checker.DeepEquals, make([]byte, 10))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *CompressionRleSuite) TestIdentity(c *checker.C) {
|
||||||
|
var exp []byte = make([]byte, 251)
|
||||||
|
res, err := Decompress(Compress(exp))
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
c.Assert(res, checker.DeepEquals, exp)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue