kostaleonard / theblockchainkiller

Leo's anti-The Blockchain
MIT License
4 stars 1 forks source link

Add block mining functions #9

Closed kostaleonard closed 11 months ago

kostaleonard commented 1 year ago

As a user, I want to be able to mine blocks so that I can validate transactions and earn mined coin.

I have a rough outline for these functions, but I wasn't ready to include in the latest merge request.

/**
 * @brief Fills block's proof_of_work with a number that produces a valid hash.
 * 
 * @param blockchain The blockchain.
 * @param block The block for which to calculate a proof of work.
 * @return return_code_t A return code indicating success or failure.
 */
return_code_t blockchain_mine_block(blockchain_t *blockchain, block_t *block);

//TODO add blockchain_is_valid_proof(blockchain_t *, block_t *)