rename toSmall/fromSmall.
This commit is contained in:
parent
c9d8ae9f4a
commit
132798e898
@ -353,7 +353,7 @@ Block.fromRaw = function fromRaw(data, enc, type) {
|
|||||||
return new Block(Block._fromRaw(data, enc));
|
return new Block(Block._fromRaw(data, enc));
|
||||||
};
|
};
|
||||||
|
|
||||||
Block.prototype.toSmall = function toSmall() {
|
Block.prototype.toCompact = function toCompact() {
|
||||||
var block = this.abbr();
|
var block = this.abbr();
|
||||||
var height = this.height;
|
var height = this.height;
|
||||||
var off = 0;
|
var off = 0;
|
||||||
@ -378,7 +378,7 @@ Block.prototype.toSmall = function toSmall() {
|
|||||||
return buf;
|
return buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
Block.fromSmall = function fromSmall(buf) {
|
Block.fromCompact = function fromCompact(buf) {
|
||||||
var tx, txCount, i;
|
var tx, txCount, i;
|
||||||
var off = 0;
|
var off = 0;
|
||||||
var hashes = [];
|
var hashes = [];
|
||||||
|
|||||||
@ -136,7 +136,7 @@ BlockDB.prototype.saveBlock = function saveBlock(block, callback) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var batch = this.db.batch();
|
var batch = this.db.batch();
|
||||||
|
|
||||||
batch.put('b/b/' + block.hash('hex'), block.toSmall());
|
batch.put('b/b/' + block.hash('hex'), block.toCompact());
|
||||||
|
|
||||||
block.txs.forEach(function(tx, i) {
|
block.txs.forEach(function(tx, i) {
|
||||||
batch.put('t/t/' + tx.hash('hex'), tx.toExtended());
|
batch.put('t/t/' + tx.hash('hex'), tx.toExtended());
|
||||||
@ -528,7 +528,7 @@ BlockDB.prototype.getCoin = function getCoin(hash, index, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
coin = bcoin.coin.fromRaw(data);
|
coin = bcoin.coin.fromExtended(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return callback(e);
|
return callback(e);
|
||||||
}
|
}
|
||||||
@ -764,7 +764,7 @@ BlockDB.prototype.getBlock = function getBlock(hash, callback) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
block = bcoin.block.fromSmall(data);
|
block = bcoin.block.fromCompact(data);
|
||||||
block.txs = [];
|
block.txs = [];
|
||||||
|
|
||||||
utils.forEach(block.hashes, function(hash, next, i) {
|
utils.forEach(block.hashes, function(hash, next, i) {
|
||||||
|
|||||||
@ -1345,7 +1345,7 @@ TXPool.prototype.getCoin = function getCoin(hash, index, callback) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback(null, bcoin.coin.fromRaw(coin));
|
return callback(null, bcoin.coin.fromExtended(coin));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user