rpc: minor refactor for gbt deps.
This commit is contained in:
parent
f778a8c1b5
commit
e821eb10bf
@ -1203,7 +1203,7 @@ RPC.prototype._createTemplate = co(function* _createTemplate(maxVersion, coinbas
|
|||||||
// Build an index of every transaction.
|
// Build an index of every transaction.
|
||||||
for (i = 0; i < attempt.items.length; i++) {
|
for (i = 0; i < attempt.items.length; i++) {
|
||||||
entry = attempt.items[i];
|
entry = attempt.items[i];
|
||||||
index[entry.hash] = i;
|
index[entry.hash] = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate dependencies for each transaction.
|
// Calculate dependencies for each transaction.
|
||||||
@ -1215,9 +1215,13 @@ RPC.prototype._createTemplate = co(function* _createTemplate(maxVersion, coinbas
|
|||||||
for (j = 0; j < tx.inputs.length; j++) {
|
for (j = 0; j < tx.inputs.length; j++) {
|
||||||
input = tx.inputs[j];
|
input = tx.inputs[j];
|
||||||
dep = index[input.prevout.hash];
|
dep = index[input.prevout.hash];
|
||||||
if (dep != null && deps.indexOf(dep + 1) === -1) {
|
|
||||||
assert(dep < i);
|
if (dep == null)
|
||||||
deps.push(dep + 1);
|
continue;
|
||||||
|
|
||||||
|
if (deps.indexOf(dep) === -1) {
|
||||||
|
assert(dep < i + 1);
|
||||||
|
deps.push(dep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user