Browse Source

Grab proof before overwritten

warmup
jl777 5 years ago
parent
commit
b069d6a74a
  1. 2
      src/komodo_nSPV_fullnode.h
  2. 11
      src/komodo_nSPV_superlite.h

2
src/komodo_nSPV_fullnode.h

@ -167,7 +167,7 @@ int32_t NSPV_getaddressutxos(struct NSPV_utxosresp *ptr,char *coinaddr) // check
if ( len < maxlen )
{
len = (int32_t)(sizeof(*ptr) + sizeof(*ptr->utxos)*ptr->numutxos - sizeof(ptr->utxos));
fprintf(stderr,"getaddressutxos for %s -> n.%d:%d total %.8f interest %.8f len.%d\n",coinaddr,n,ptr->numutxos,dstr(total),dstr(interest),len);
//fprintf(stderr,"getaddressutxos for %s -> n.%d:%d total %.8f interest %.8f len.%d\n",coinaddr,n,ptr->numutxos,dstr(total),dstr(interest),len);
if ( n == ptr->numutxos )
{
ptr->total = total;

11
src/komodo_nSPV_superlite.h

@ -587,7 +587,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx)
{
int32_t i,offset,retval = 0;
int32_t i,offset,retval = 0; std::vector<uint8_t> proof;
for (i=0; i<3; i++)
{
NSPV_txproof(vout,txid,height);
@ -606,6 +606,11 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
retval = -21;
else if ( skipvalidation == 0 )
{
if ( NSPV_txproofresult.txprooflen > 0 )
{
proof.resize(NSPV_txproofresult.txprooflen);
memcpy(&proof[0],NSPV_txproofresult.txproof,txprooflen);
}
NSPV_notarizations(height); // gets the prev and next notarizations
if ( NSPV_inforesult.notarization.height >= height && (NSPV_ntzsresult.prevntz.height == 0 || NSPV_ntzsresult.prevntz.height >= NSPV_ntzsresult.nextntz.height) )
{
@ -623,9 +628,7 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
NSPV_txidhdrsproof(NSPV_ntzsresult.prevntz.txid,NSPV_ntzsresult.nextntz.txid);
if ( (retval= NSPV_validatehdrs(&NSPV_ntzsproofresult)) == 0 )
{
std::vector<uint256> txids; std::vector<uint8_t> proof; uint256 proofroot;
proof.resize(NSPV_txproofresult.txprooflen);
memcpy(&proof[0],NSPV_txproofresult.txproof,NSPV_txproofresult.txprooflen);
std::vector<uint256> txids; uint256 proofroot;
proofroot = BitcoinGetProofMerkleRoot(proof,txids);
if ( proofroot != NSPV_ntzsproofresult.common.hdrs[offset].hashMerkleRoot )
{

Loading…
Cancel
Save