Changes for most chain power rule

This commit is contained in:
miketout
2018-09-28 01:38:14 -07:00
parent f82b75eb8b
commit 4b729ec577
51 changed files with 666 additions and 444 deletions

View File

@@ -385,19 +385,19 @@ int64_t CCduration(int32_t &numblocks,uint256 txid)
fprintf(stderr,"CCduration no hashBlock for txid %s\n",uint256_str(str,txid));
return(0);
}
else if ( (pindex= mapBlockIndex[hashBlock]) == 0 || (txtime= pindex->nTime) == 0 || (txheight= pindex->nHeight) <= 0 )
else if ( (pindex= mapBlockIndex[hashBlock]) == 0 || (txtime= pindex->nTime) == 0 || (txheight= pindex->GetHeight()) <= 0 )
{
fprintf(stderr,"CCduration no txtime %u or txheight.%d %p for txid %s\n",txtime,txheight,pindex,uint256_str(str,txid));
return(0);
}
else if ( (pindex= chainActive.LastTip()) == 0 || pindex->nTime < txtime || pindex->nHeight <= txheight )
else if ( (pindex= chainActive.LastTip()) == 0 || pindex->nTime < txtime || pindex->GetHeight() <= txheight )
{
fprintf(stderr,"CCduration backwards timestamps %u %u for txid %s hts.(%d %d)\n",(uint32_t)pindex->nTime,txtime,uint256_str(str,txid),txheight,(int32_t)pindex->nHeight);
fprintf(stderr,"CCduration backwards timestamps %u %u for txid %s hts.(%d %d)\n",(uint32_t)pindex->nTime,txtime,uint256_str(str,txid),txheight,(int32_t)pindex->GetHeight());
return(0);
}
numblocks = (pindex->nHeight - txheight);
numblocks = (pindex->GetHeight() - txheight);
duration = (pindex->nTime - txtime);
fprintf(stderr,"duration %d (%u - %u) numblocks %d (%d - %d)\n",(int32_t)duration,(uint32_t)pindex->nTime,txtime,numblocks,pindex->nHeight,txheight);
fprintf(stderr,"duration %d (%u - %u) numblocks %d (%d - %d)\n",(int32_t)duration,(uint32_t)pindex->nTime,txtime,numblocks,pindex->GetHeight(),txheight);
return(duration);
}

View File

@@ -263,7 +263,7 @@ bool Eval::DisputePayout(AppVM &vm, std::vector<uint8_t> params, const CTransact
if (!GetTxConfirmed(disputeTx.vin[0].prevout.hash, sessionTx, sessionBlock))
return Error("couldnt-get-parent");
if (GetCurrentHeight() < sessionBlock.nHeight + waitBlocks)
if (GetCurrentHeight() < sessionBlock.GetHeight() + waitBlocks)
return Invalid("dispute-too-soon"); // Not yet
}

View File

@@ -46,7 +46,7 @@ bool Eval::DisputePayout(AppVM &vm, std::vector<uint8_t> params, const CTransact
if (!GetTxConfirmed(disputeTx.vin[0].prevout.hash, sessionTx, sessionBlock))
return Error("couldnt-get-parent");
if (GetCurrentHeight() < sessionBlock.nHeight + waitBlocks)
if (GetCurrentHeight() < sessionBlock.GetHeight() + waitBlocks)
return Invalid("dispute-too-soon"); // Not yet
}

View File

@@ -191,7 +191,7 @@ bool Eval::GetNotarisationData(const uint256 notaryHash, NotarisationData &data)
CTransaction notarisationTx;
CBlockIndex block;
if (!GetTxConfirmed(notaryHash, notarisationTx, block)) return false;
if (!CheckNotaryInputs(notarisationTx, block.nHeight, block.nTime)) return false;
if (!CheckNotaryInputs(notarisationTx, block.GetHeight(), block.nTime)) return false;
if (!ParseNotarisationOpReturn(notarisationTx, data)) return false;
return true;
}