This commit is contained in:
jl777
2019-07-07 01:31:29 -11:00
parent 03ce22bf09
commit 80e9cec7bc
2 changed files with 8 additions and 18 deletions

View File

@@ -416,17 +416,6 @@ int32_t NSPV_pubkeysextract(uint8_t pubkeys[64][33],CTransaction tx,uint8_t elec
return(numsigs);
}
uint256 NSPV_DBopretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std::vector<uint8_t> opret)
{
uint256 desttxid; int32_t i;
iguana_rwnum(0,&opret[32],sizeof(*heightp),heightp);
for (i=0; i<32; i++)
((uint8_t *)blockhashp)[i] = opret[i];
for (i=0; i<32; i++)
((uint8_t *)&desttxid)[i] = opret[4 + 32 + i];
return(desttxid);
}
uint256 NSPV_opretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std::vector<uint8_t> opret)
{
uint256 desttxid; int32_t i;
@@ -449,11 +438,11 @@ int32_t NSPV_notarizationextract(int32_t *heightp,uint256 *blockhashp,uint256 *t
GetOpReturnData(tx.vout[1].scriptPubKey,opret);
if ( opret.size() >= 32*2+4*2 )
*desttxidp = NSPV_opretextract(heightp,blockhashp,symbol,opret);
{
/*{
int z;
for (z=0; z<68; z++)
fprintf(stderr,"%02x",opret[z]);
}
}*/
fprintf(stderr," ntzht.%d %s txid.%s size.%d\n",*heightp,(*blockhashp).GetHex().c_str(),(*desttxidp).GetHex().c_str(),(int32_t)opret.size());
*txidp = tx.GetHash();
return(0);

View File

@@ -37,7 +37,7 @@ uint256 NSPV_getnotarization_txid(int32_t *ntzheightp,int32_t height)
int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 desttxids[2],int32_t ntzheights[2],int32_t height)
{
int32_t txidht; Notarisation nota; char *symbol; uint256 bhash;
int32_t txidht; Notarisation nota; char *symbol; uint256 bhash0,bhash1;
symbol = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
memset(txids,0,sizeof(*txids)*2);
memset(desttxids,0,sizeof(*desttxids)*2);
@@ -47,8 +47,8 @@ int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 des
return(-1);
txids[0] = nota.first;
txidhts[0] = txidht;
desttxids[0] = NSPV_DBopretextract(&ntzheights[0],&bhash,symbol,E_MARSHAL(ss << nota.second));
//if ( height != 2668 )
desttxids[0] = NSPV_opretextract(&ntzheights[0],&bhash0,symbol,E_MARSHAL(ss << nota.second));
/*//if ( height != 2668 )
// fprintf(stderr,"scan.%d -> %s txidht.%d ntzht.%d\n",height,desttxids[0].GetHex().c_str(),txidht,ntzheights[0]);
if ( ntzheights[0] == height-1 ) // offset the +1 from caller
{
@@ -57,13 +57,14 @@ int32_t komodo_notarized_bracket(uint256 txids[2],int32_t txidhts[2],uint256 des
ntzheights[1] = ntzheights[0];
desttxids[1] = desttxids[0];
return(0);
}
}*/
if ( (txidht= ScanNotarisationsDB2(height,symbol,1440,nota)) != 0 )
{
txids[1] = nota.first;
txidhts[1] = txidht;
desttxids[1] = NSPV_DBopretextract(&ntzheights[1],&bhash,symbol,E_MARSHAL(ss << nota.second));
desttxids[1] = NSPV_opretextract(&ntzheights[1],&bhash1,symbol,E_MARSHAL(ss << nota.second));
}
fprintf(stderr,"prev.(%s -> ht.%d %s) next.(%s -> ht.%d %s)\n",txids[0].GetHex().c_str(),ntzheights[0],bhash0.GetHex().c_str(),txids[1].GetHex().c_str(),ntzheights[1],bhash1.GetHex().c_str());
return(0);
}