coins: minor.
This commit is contained in:
parent
b37b99a86e
commit
dbed720d20
@ -304,7 +304,7 @@ Coins.prototype.fromRaw = function fromRaw(data, hash) {
|
||||
code = br.readVarint();
|
||||
this.coinbase = (code & 1) !== 0;
|
||||
|
||||
// Recalculate number of non-zero bytes.
|
||||
// Recalculate size.
|
||||
size = code / 8 | 0;
|
||||
|
||||
if ((code & 6) === 0)
|
||||
@ -364,7 +364,7 @@ Coins.parseCoin = function parseCoin(data, hash, index) {
|
||||
code = br.readVarint();
|
||||
coin.coinbase = (code & 1) !== 0;
|
||||
|
||||
// Recalculate number of non-zero bytes.
|
||||
// Recalculate size.
|
||||
size = code / 8 | 0;
|
||||
|
||||
if ((code & 6) === 0)
|
||||
@ -373,12 +373,13 @@ Coins.parseCoin = function parseCoin(data, hash, index) {
|
||||
if (index >= 2 + size * 8)
|
||||
return;
|
||||
|
||||
// Read spent field.
|
||||
// Setup spent field.
|
||||
offset = br.offset;
|
||||
br.seek(size);
|
||||
|
||||
for (i = 2; i <= 4; i += 2) {
|
||||
if ((code & i) !== 0) {
|
||||
// Read first two outputs.
|
||||
for (i = 0; i < 2; i++) {
|
||||
if ((code & (2 << i)) !== 0) {
|
||||
if (index === 0) {
|
||||
decompress.coin(coin, br);
|
||||
return coin;
|
||||
@ -391,6 +392,7 @@ Coins.parseCoin = function parseCoin(data, hash, index) {
|
||||
index -= 1;
|
||||
}
|
||||
|
||||
// Read outputs.
|
||||
for (i = 0; i < size; i++) {
|
||||
ch = br.data[offset++];
|
||||
for (j = 0; j < 8; j++) {
|
||||
|
||||
@ -195,6 +195,8 @@ UndoCoin.prototype.toRaw = function toRaw(writer) {
|
||||
var bw = new BufferWriter(writer);
|
||||
var height = this.height;
|
||||
|
||||
assert(height !== 0);
|
||||
|
||||
if (height === -1)
|
||||
height = 0;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user