Skip to content

Commit

Permalink
Use readonly BlockHeader fields in genesis block creation (#4509)
Browse files Browse the repository at this point in the history
  • Loading branch information
danield9tqh authored Jan 9, 2024
1 parent b91d5c3 commit 9f75391
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ironfish/src/genesis/makeGenesisBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,18 @@ export async function makeGenesisBlock(
GraffitiUtils.fromString('genesis'),
)

// Modify the block with any custom properties.
block.header.target = info.target
block.header.timestamp = new Date(info.timestamp)
const genesisBlock = Block.fromRaw({
header: {
...block.header,
target: info.target,
timestamp: new Date(info.timestamp),
},
transactions: block.transactions,
})

genesisBlock.header.noteSize = block.header.noteSize
genesisBlock.header.work = block.header.work

logger.info('Block complete.')
return { block }
return { block: genesisBlock }
}

0 comments on commit 9f75391

Please sign in to comment.