Implement NSPV_getnotarization_txid

This commit is contained in:
jl777
2019-07-04 20:05:17 -11:00
parent 2338d9c068
commit 99fb4fc194
3 changed files with 38 additions and 11 deletions

View File

@@ -135,3 +135,30 @@ int ScanNotarisationsDB(int height, std::string symbol, int scanLimitBlocks, Not
}
return 0;
}
int ScanNotarisationsDB2(int height, std::string symbol, int scanLimitBlocks, Notarisation& out)
{
int32_t i,maxheight,ht;
maxheight = chainActive.Height();
if ( height < 0 || height > maxheight )
return false;
for (i=0; i<scanLimitBlocks; i++)
{
ht = height+i;
if ( ht > maxheight )
break;
NotarisationsInBlock notarisations;
uint256 blockHash = *chainActive[ht]->phashBlock;
if ( !GetBlockNotarisations(blockHash,notarisations) )
continue;
BOOST_FOREACH(Notarisation& nota,notarisations)
{
if ( strcmp(nota.second.symbol,symbol.data()) == 0 )
{
out = nota;
return(ht);
}
}
}
return 0;
}