Skip to content

Commit

Permalink
miner: minor.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Sep 6, 2017
1 parent eb54690 commit d78df4b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/mining/miner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit d78df4b

Please sign in to comment.