| 1329 | } |
| 1330 | |
| 1331 | bool 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 | |
| 1354 | bool Stake::GenBlockStake(CWallet* wallet, unsigned int& extra) { |
| 1355 | CBlockIndex* tip = nullptr; |
no test coverage detected