Skip to content

Commit cd3054a

Browse files
committed
fix: logger and remove numbers parameter
1 parent 5b2340c commit cd3054a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

‎cli/lib/nf3.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ class Nf3 {
664664
const { type, txDataToSignList } = msg;
665665
logger.debug(`Proposer received websocket message of type ${type}`);
666666
if (type === 'block') {
667-
if (process.env.VERBOSE) console.log(`Found ${txDataToSignList.length} blocks to process`);
667+
logger.debug(`Found ${txDataToSignList.length} blocks to process`);
668668
const submitTxList = [];
669669
// Send all transactions at once
670670
for (let i = 0; i < txDataToSignList.length; i++) {

‎nightfall-optimist/src/services/block-assembler.mjs

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function setBlockAssembledWebSocketConnection(_ws) {
2525
ws = _ws;
2626
}
2727

28-
async function makeBlock(proposer, unprocessed, number = TRANSACTIONS_PER_BLOCK) {
28+
async function makeBlock(proposer, unprocessed) {
2929
logger.debug('Block Assembler - about to make a new block');
3030
// we retrieve un-processed transactions from our local database, relying on
3131
// the transaction service to keep the database current
@@ -37,8 +37,11 @@ async function makeBlock(proposer, unprocessed, number = TRANSACTIONS_PER_BLOCK)
3737

3838
// then we make new block objects until we run out of unprocessed
3939
// transactions
40-
for (let i = 0; i < unprocessedTransactions.length / number; i++) {
41-
const transactions = unprocessedTransactions.slice(i * number, i * number + number);
40+
for (let i = 0; i < Math.floor(unprocessedTransactions.length / TRANSACTIONS_PER_BLOCK); i++) {
41+
const transactions = unprocessedTransactions.slice(
42+
i * TRANSACTIONS_PER_BLOCK,
43+
(i + 1) * TRANSACTIONS_PER_BLOCK,
44+
);
4245
const { block, updatedTimber } = Block.build({
4346
proposer,
4447
transactions,

0 commit comments

Comments
 (0)