src/main.cpp
// fluttercoin: attempt to generate suitable proof-of-stake
attempt to generate suitable proof-of-stake
attempt to generate suitable proof - of - stake
bool CBlock::SignBlock(CWallet& wallet)
{
    if (!vtx[0].vout[0].IsEmpty())
        return false;
    if (IsProofOfStake())
        return true;
    static int64 nLastCoinStakeSearchTime = GetAdjustedTime(); 
    CKey key;
    CTransaction txCoinStake;
    int64 nSearchTime = txCoinStake.nTime; 
    if (nSearchTime > nLastCoinStakeSearchTime)
    {
        if (wallet.CreateCoinStake(wallet, nBits, nSearchTime-nLastCoinStakeSearchTime, txCoinStake, key))
        {
            if (txCoinStake.nTime >= max(pindexBest->GetMedianTimePast()+1, PastDrift(pindexBest->GetBlockTime())))
            {
                vtx[0].nTime = nTime = txCoinStake.nTime;
                nTime = max(pindexBest->GetMedianTimePast()+1, GetMaxTransactionTime());
                nTime = max(GetBlockTime(), PastDrift(pindexBest->GetBlockTime()));
                for (vector<CTransaction>::iterator it = vtx.begin(); it != vtx.end();)
                    if (it->nTime > nTime) { it = vtx.erase(it); } else { ++it; }
                vtx.insert(vtx.begin() + 1, txCoinStake);
                hashMerkleRoot = BuildMerkleTree();
                return key.Sign(GetHash(), vchBlockSig);
            }
        }
        nLastCoinStakeSearchInterval = nSearchTime - nLastCoinStakeSearchTime;
        nLastCoinStakeSearchTime = nSearchTime;
    }
    return false;
}
bool CBlock :: SignBlock ( CWallet & wallet ) { if ( ! vtx [ 0 ] . vout [ 0 ] . IsEmpty ( ) ) return false ; if ( IsProofOfStake ( ) ) return true ; static int64 nLastCoinStakeSearchTime = GetAdjustedTime ( ) ; CKey key ; CTransaction txCoinStake ; int64 nSearchTime = txCoinStake . nTime ; if ( nSearchTime > nLastCoinStakeSearchTime ) { if ( wallet . CreateCoinStake ( wallet , nBits , nSearchTime - nLastCoinStakeSearchTime , txCoinStake , key ) ) { if ( txCoinStake . nTime >= max ( pindexBest -> GetMedianTimePast ( ) + 1 , PastDrift ( pindexBest -> GetBlockTime ( ) ) ) ) { vtx [ 0 ] . nTime = nTime = txCoinStake . nTime ; nTime = max ( pindexBest -> GetMedianTimePast ( ) + 1 , GetMaxTransactionTime ( ) ) ; nTime = max ( GetBlockTime ( ) , PastDrift ( pindexBest -> GetBlockTime ( ) ) ) ; for ( vector < CTransaction > :: iterator it = vtx . begin ( ) ; it != vtx . end ( ) ; ) if ( it -> nTime > nTime ) { it = vtx . erase ( it ) ; } else { ++ it ; } vtx . insert ( vtx . begin ( ) + 1 , txCoinStake ) ; hashMerkleRoot = BuildMerkleTree ( ) ; return key . Sign ( GetHash ( ) , vchBlockSig ) ; } } nLastCoinStakeSearchInterval = nSearchTime - nLastCoinStakeSearchTime ; nLastCoinStakeSearchTime = nSearchTime ; } return false ; }
fluttercoin: attempt to generate suitable proof-of-stake
fluttercoin : attempt to generate suitable proof - of - stake
// if we are trying to sign //    something except proof-of-stake block template // if we are trying to sign //    a complete proof-of-stake block // startup timestamp // search to current time // make sure coinstake would meet timestamp protocol //    as it would be the same as the block timestamp // we have to make sure that we have no future timestamps in //    our transactions set // append a signature to our block