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

@@ -133,7 +133,7 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_
CBlockIndex blockIdx;
if (!eval->GetTxConfirmed(assetChainProof.first, sourceNotarisation, blockIdx))
throw std::runtime_error("Notarisation not found");
kmdHeight = blockIdx.nHeight;
kmdHeight = blockIdx.GetHeight();
}
// We now have a kmdHeight of the notarisation from chain A. So we know that a MoM exists
@@ -241,7 +241,7 @@ bool GetNextBacknotarisation(uint256 kmdNotarisationTxid, Notarisation &out)
return false;
}
return (bool) ScanNotarisationsFromHeight(block.nHeight+1, &IsSameAssetChain, out);
return (bool) ScanNotarisationsFromHeight(block.GetHeight()+1, &IsSameAssetChain, out);
}
@@ -267,19 +267,19 @@ TxProof GetAssetchainProof(uint256 hash)
throw std::runtime_error("tx still in mempool");
blockIndex = mapBlockIndex[blockHash];
int h = blockIndex->nHeight;
int h = blockIndex->GetHeight();
// The assumption here is that the first notarisation for a height GTE than
// the transaction block height will contain the corresponding MoM. If there
// are sequence issues with the notarisations this may fail.
auto isTarget = [&](Notarisation &nota) {
if (!IsSameAssetChain(nota)) return false;
return nota.second.height >= blockIndex->nHeight;
return nota.second.height >= blockIndex->GetHeight();
};
if (!ScanNotarisationsFromHeight(blockIndex->nHeight, isTarget, nota))
if (!ScanNotarisationsFromHeight(blockIndex->GetHeight(), isTarget, nota))
throw std::runtime_error("backnotarisation not yet confirmed");
// index of block in MoM leaves
nIndex = nota.second.height - blockIndex->nHeight;
nIndex = nota.second.height - blockIndex->GetHeight();
}
// build merkle chain from blocks to MoM