nooschain / chain/block-builder / buildBlock
Function: buildBlock()
buildBlock(
param0):Promise<Block>
Defined in: chain/block-builder.ts:62
Builds a new block by retrieving pending transactions from the mempool, constructing the block header, computing the block hash, and inserting the block and its transactions into the database. The function ensures that the block is created atomically within a database transaction to maintain consistency and integrity of the blockchain data.
Parameters
param0
The input parameters for building the block, including height, previous hash, proposer node ID, maximum transactions, and database instance.
Returns
Promise<Block>
A promise that resolves to the newly created block.