Commit 53dcf4be authored by pcw109550's avatar pcw109550

op-node: Fix span batch decode/encode logic error

parent 1e751d4e
......@@ -76,7 +76,7 @@ func (bp *spanBatchPayload) decodeOriginBits(r *bytes.Reader) error {
originBits := new(big.Int)
for i := 0; i < int(bp.blockCount); i += 8 {
end := i + 8
if end < int(bp.blockCount) {
if end > int(bp.blockCount) {
end = int(bp.blockCount)
}
bits := originBitBuffer[i/8]
......@@ -302,7 +302,7 @@ func (bp *spanBatchPayload) encodeOriginBits(w io.Writer) error {
originBitBuffer := make([]byte, originBitBufferLen)
for i := 0; i < int(bp.blockCount); i += 8 {
end := i + 8
if end < int(bp.blockCount) {
if end > int(bp.blockCount) {
end = int(bp.blockCount)
}
var bits uint = 0
......
......@@ -48,7 +48,7 @@ func (btx *spanBatchTxs) encodeContractCreationBits(w io.Writer) error {
contractCreationBitBuffer := make([]byte, contractCreationBitBufferLen)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
var bits uint = 0
......@@ -81,7 +81,7 @@ func (btx *spanBatchTxs) decodeContractCreationBits(r *bytes.Reader) error {
contractCreationBits := new(big.Int)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
bits := contractCreationBitBuffer[i/8]
......@@ -173,7 +173,7 @@ func (btx *spanBatchTxs) encodeYParityBits(w io.Writer) error {
yParityBitBuffer := make([]byte, yParityBitBufferLen)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
var bits uint = 0
......@@ -260,7 +260,7 @@ func (btx *spanBatchTxs) decodeYParityBits(r *bytes.Reader) error {
yParityBits := new(big.Int)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
bits := yParityBitBuffer[i/8]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment