coins: refactor.
This commit is contained in:
parent
67695b7e53
commit
dd2d9f48bd
@ -262,7 +262,7 @@ Coins.prototype.toRaw = function toRaw() {
|
|||||||
if (!output)
|
if (!output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
output.toRaw(bw);
|
output.toWriter(bw);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the buffer with all
|
// Render the buffer with all
|
||||||
@ -331,7 +331,7 @@ Coins.prototype.fromRaw = function fromRaw(data, hash, index) {
|
|||||||
|
|
||||||
// Store the offset and size
|
// Store the offset and size
|
||||||
// in the compressed coin object.
|
// in the compressed coin object.
|
||||||
coin = CoinEntry.fromRaw(br);
|
coin = CoinEntry.fromReader(br);
|
||||||
|
|
||||||
this.outputs.push(coin);
|
this.outputs.push(coin);
|
||||||
pos++;
|
pos++;
|
||||||
@ -515,10 +515,9 @@ CoinEntry.prototype.toCoin = function toCoin(coins, index) {
|
|||||||
/**
|
/**
|
||||||
* Slice off the part of the buffer
|
* Slice off the part of the buffer
|
||||||
* relevant to this particular coin.
|
* relevant to this particular coin.
|
||||||
* @returns {Buffer}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CoinEntry.prototype.toRaw = function toRaw(bw) {
|
CoinEntry.prototype.toWriter = function toWriter(bw) {
|
||||||
var raw;
|
var raw;
|
||||||
|
|
||||||
if (this.output) {
|
if (this.output) {
|
||||||
@ -544,12 +543,12 @@ CoinEntry.prototype.toRaw = function toRaw(bw) {
|
|||||||
* @returns {CoinEntry}
|
* @returns {CoinEntry}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CoinEntry.fromRaw = function fromRaw(br) {
|
CoinEntry.fromReader = function fromReader(br) {
|
||||||
var coin = new CoinEntry();
|
var entry = new CoinEntry();
|
||||||
coin.offset = br.offset;
|
entry.offset = br.offset;
|
||||||
coin.size = skipCoin(br);
|
entry.size = skipCoin(br);
|
||||||
coin.raw = br.data;
|
entry.raw = br.data;
|
||||||
return coin;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -560,9 +559,9 @@ CoinEntry.fromRaw = function fromRaw(br) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CoinEntry.fromTX = function fromTX(tx, index) {
|
CoinEntry.fromTX = function fromTX(tx, index) {
|
||||||
var coin = new CoinEntry();
|
var entry = new CoinEntry();
|
||||||
coin.output = tx.outputs[index];
|
entry.output = tx.outputs[index];
|
||||||
return coin;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user