chaindb: fix getFullBlock.
This commit is contained in:
parent
5bed0455d2
commit
de1f658ede
@ -945,7 +945,7 @@ ChainDB.prototype.getRawBlock = co(function* getRawBlock(block) {
|
||||
|
||||
ChainDB.prototype.getFullBlock = co(function* getFullBlock(hash) {
|
||||
var block = yield this.getBlock(hash);
|
||||
var i, j, view, undo, tx, input;
|
||||
var i, j, view, undo, tx, input, hash, coins;
|
||||
|
||||
if (!block)
|
||||
return;
|
||||
@ -958,8 +958,22 @@ ChainDB.prototype.getFullBlock = co(function* getFullBlock(hash) {
|
||||
|
||||
for (i = block.txs.length - 1; i > 0; i--) {
|
||||
tx = block.txs[i];
|
||||
|
||||
for (j = tx.inputs.length - 1; j >= 0; j--) {
|
||||
input = tx.inputs[j];
|
||||
hash = input.prevout.hash;
|
||||
|
||||
if (!view.has(hash)) {
|
||||
assert(!undo.isEmpty());
|
||||
|
||||
if (undo.top().height === -1) {
|
||||
coins = new Coins();
|
||||
coins.hash = hash;
|
||||
coins.coinbase = false;
|
||||
view.add(coins);
|
||||
}
|
||||
}
|
||||
|
||||
input.coin = undo.apply(view, input.prevout);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user