bip152: minor. add assertion.
This commit is contained in:
parent
de9f37b290
commit
33c32d32c1
@ -132,8 +132,11 @@ CompactBlock.prototype.fromRaw = function fromRaw(data) {
|
|||||||
|
|
||||||
this.totalTX += idCount;
|
this.totalTX += idCount;
|
||||||
|
|
||||||
for (let i = 0; i < idCount; i++)
|
for (let i = 0; i < idCount; i++) {
|
||||||
this.ids.push(br.readU32() + br.readU16() * 0x100000000);
|
const lo = br.readU32();
|
||||||
|
const hi = br.readU16();
|
||||||
|
this.ids.push(hi * 0x100000000 + lo);
|
||||||
|
}
|
||||||
|
|
||||||
const txCount = br.readVarint();
|
const txCount = br.readVarint();
|
||||||
|
|
||||||
@ -259,8 +262,8 @@ CompactBlock.prototype.writeRaw = function writeRaw(bw, witness) {
|
|||||||
|
|
||||||
for (const id of this.ids) {
|
for (const id of this.ids) {
|
||||||
const lo = id % 0x100000000;
|
const lo = id % 0x100000000;
|
||||||
let hi = (id - lo) / 0x100000000;
|
const hi = (id - lo) / 0x100000000;
|
||||||
hi &= 0xffff;
|
assert(hi <= 0xffff);
|
||||||
bw.writeU32(lo);
|
bw.writeU32(lo);
|
||||||
bw.writeU16(hi);
|
bw.writeU16(hi);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user