chaindb: fix getCoinView.
This commit is contained in:
parent
4e9bec4cd3
commit
c9fbaae0da
@ -857,15 +857,15 @@ ChainDB.prototype.hasCoins = function hasCoins(hash) {
|
||||
ChainDB.prototype.getCoinView = co(function* getCoinView(tx, callback) {
|
||||
var view = new CoinView();
|
||||
var prevout = tx.getPrevout();
|
||||
var i, prev, coins;
|
||||
var i, hash, coins;
|
||||
|
||||
for (i = 0; i < prevout.length; i++) {
|
||||
prev = prevout[i];
|
||||
coins = yield this.getCoins(prev);
|
||||
hash = prevout[i];
|
||||
coins = yield this.getCoins(hash);
|
||||
|
||||
if (!coins) {
|
||||
coins = new Coins();
|
||||
coins.hash = prev.hash;
|
||||
coins.hash = hash;
|
||||
view.add(coins);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1309,19 +1309,11 @@ Mempool.prototype.injectCoins = function injectCoins(tx, view) {
|
||||
for (i = 0; i < tx.inputs.length; i++) {
|
||||
input = tx.inputs[i];
|
||||
prevout = input.prevout;
|
||||
|
||||
if (!view.has(prevout.hash)) {
|
||||
missing.push(prevout.hash);
|
||||
continue;
|
||||
}
|
||||
|
||||
coin = view.getCoin(prevout.hash, prevout.index);
|
||||
|
||||
if (!coin) {
|
||||
throw new VerifyError(tx,
|
||||
'duplicate',
|
||||
'bad-txns-inputs-spent',
|
||||
0);
|
||||
missing.push(prevout.hash);
|
||||
continue;
|
||||
}
|
||||
|
||||
input.coin = coin;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user