miner: minor.

This commit is contained in:
Christopher Jeffrey 2017-09-06 14:21:23 -07:00
parent eb5469088c
commit d78df4b79c
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -250,13 +250,6 @@ Miner.prototype.getAddress = function getAddress() {
*/
Miner.prototype.assemble = function assemble(attempt) {
let priority = this.options.priorityWeight > 0;
const queue = new Heap(cmpRate);
const depMap = new Map();
if (priority)
queue.set(cmpPriority);
if (!this.mempool) {
attempt.refresh();
return;
@ -265,6 +258,14 @@ Miner.prototype.assemble = function assemble(attempt) {
assert(this.mempool.tip === this.chain.tip.hash,
'Mempool/chain tip mismatch! Unsafe to create block.');
const depMap = new Map();
const queue = new Heap(cmpRate);
let priority = this.options.priorityWeight > 0;
if (priority)
queue.set(cmpPriority);
for (const entry of this.mempool.map.values()) {
const item = BlockEntry.fromEntry(entry, attempt);
const tx = item.tx;
@ -296,6 +297,7 @@ Miner.prototype.assemble = function assemble(attempt) {
const item = queue.shift();
const tx = item.tx;
const hash = item.hash;
let weight = attempt.weight;
let sigops = attempt.sigops;