MCPcopy Create free account
hub / github.com/LUX-Core/lux / CreateBlockStake

Method CreateBlockStake

src/stake.cpp:1331–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329}
1330
1331bool Stake::CreateBlockStake(CWallet* wallet, CBlock* block) {
1332 bool result = false;
1333 int64_t nTime = GetAdjustedTime();
1334 CBlockIndex* tip = chainActive.Tip();
1335 block->nTime = nTime;
1336 block->nBits = GetNextWorkRequired(tip, block, Params().GetConsensus(), true);
1337 if (nTime >= nLastStakeTime) {
1338 CMutableTransaction tx;
1339 unsigned int txTime = 0;
1340 if (CreateCoinStake(wallet, *wallet, block->nBits, nTime - nLastStakeTime, tx, txTime)) {
1341 block->nTime = txTime;
1342 CMutableTransaction buftx = CMutableTransaction(block->vtx[0]);
1343 buftx.vout[0].SetEmpty();
1344 block->vtx[0] = CTransaction(buftx);
1345 block->vtx[1] = CTransaction(tx);
1346 result = true;
1347 }
1348 nStakeInterval = nTime - nLastStakeTime;
1349 nLastStakeTime = nTime;
1350 }
1351 return result;
1352}
1353
1354bool Stake::GenBlockStake(CWallet* wallet, unsigned int& extra) {
1355 CBlockIndex* tip = nullptr;

Callers 1

CreateNewBlockMethod · 0.80

Calls 7

GetAdjustedTimeFunction · 0.85
GetNextWorkRequiredFunction · 0.85
TipMethod · 0.80
SetEmptyMethod · 0.80
ParamsClass · 0.70
CMutableTransactionClass · 0.70
CTransactionClass · 0.70

Tested by

no test coverage detected