|
@ -87,20 +87,19 @@ cJSON *LP_create_transaction(struct iguana_info *coin,bits256 txid,uint8_t *seri |
|
|
|
|
|
|
|
|
void LP_SPV_store(struct iguana_info *coin,bits256 txid,int32_t height) |
|
|
void LP_SPV_store(struct iguana_info *coin,bits256 txid,int32_t height) |
|
|
{ |
|
|
{ |
|
|
FILE *fp; char fname[512]; struct LP_transaction *tx = 0; |
|
|
FILE *fp; char fname[512],str[65]; struct LP_transaction *tx = 0; |
|
|
if ( (tx= LP_transactionfind(coin,txid)) != 0 && tx->serialized != 0 && tx->len > 0 ) |
|
|
if ( (tx= LP_transactionfind(coin,txid)) != 0 && tx->serialized != 0 && tx->len > 0 ) |
|
|
{ |
|
|
{ |
|
|
sprintf(fname,"%s/UNSPENTS/%s.SPV",GLOBAL_DBDIR,coin->symbol), OS_portable_path(fname); |
|
|
sprintf(fname,"%s/UNSPENTS/%s.SPV",GLOBAL_DBDIR,coin->symbol), OS_portable_path(fname); |
|
|
if ( (fp= OS_appendfile(fname)) != 0 ) |
|
|
if ( (fp= OS_appendfile(fname)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
char str[65]; printf("store %s %s.[%d]\n",coin->symbol,bits256_str(str,txid),tx->len); |
|
|
|
|
|
fwrite(&tx->txid,1,sizeof(tx->txid),fp); |
|
|
fwrite(&tx->txid,1,sizeof(tx->txid),fp); |
|
|
fwrite(&tx->len,1,sizeof(tx->len),fp); |
|
|
fwrite(&tx->len,1,sizeof(tx->len),fp); |
|
|
fwrite(&tx->height,1,sizeof(tx->height),fp); |
|
|
fwrite(&tx->height,1,sizeof(tx->height),fp); |
|
|
fwrite(tx->serialized,1,tx->len,fp); |
|
|
fwrite(tx->serialized,1,tx->len,fp); |
|
|
fclose(fp); |
|
|
fclose(fp); |
|
|
} |
|
|
} |
|
|
} else printf("cant store tx.%p len.%d\n",tx,tx!=0?tx->len:0); |
|
|
} else printf("cant store %s %s tx.%p [%d]\n",coin->symbol,bits256_str(str,txid),tx,tx!=0?tx->len:-1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int32_t LP_cacheitem(struct iguana_info *coin,FILE *fp) |
|
|
int32_t LP_cacheitem(struct iguana_info *coin,FILE *fp) |
|
|