MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / CreateStableCoinGenesisBlock

Function CreateStableCoinGenesisBlock

src/miner/miner.cpp:408–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406}
407
408static bool CreateStableCoinGenesisBlock(std::unique_ptr<CBlock> &pBlock) {
409 LOCK(cs_main);
410
411 // Create block reward transaction.
412 pBlock->vptx.push_back(std::make_shared<CBlockRewardTx>());
413
414 // Create stale coin genesis transactions.
415 SysCfg().CreateFundCoinMintTx(pBlock->vptx, SysCfg().NetworkID());
416
417 // Fill in header
418 CBlockIndex *pIndexPrev = chainActive.Tip();
419 int32_t height = pIndexPrev->height + 1;
420 uint32_t fuelRate = GetElementForBurn(pIndexPrev);
421
422 pBlock->SetPrevBlockHash(pIndexPrev->GetBlockHash());
423 pBlock->SetNonce(0);
424 pBlock->SetHeight(height);
425 pBlock->SetFuel(0);
426 pBlock->SetFuelRate(fuelRate);
427
428 return true;
429}
430
431static bool CreateNewBlockForStableCoinRelease(int64_t startMiningMs, Miner &miner, CCacheWrapper &cwIn, std::unique_ptr<CBlock> &pBlock) {
432 pBlock->vptx.push_back(std::make_shared<CUCoinBlockRewardTx>());

Callers 1

ProduceBlockFunction · 0.85

Calls 11

GetElementForBurnFunction · 0.85
push_backMethod · 0.80
CreateFundCoinMintTxMethod · 0.80
TipMethod · 0.80
SetPrevBlockHashMethod · 0.80
SetNonceMethod · 0.80
SetFuelMethod · 0.80
SetFuelRateMethod · 0.80
NetworkIDMethod · 0.45
GetBlockHashMethod · 0.45
SetHeightMethod · 0.45

Tested by

no test coverage detected