|
@ -41,6 +41,7 @@ uint32_t datachain_checkpoint(struct supernet_info *myinfo,struct iguana_info *c |
|
|
int32_t datachain_events_rewind(struct supernet_info *myinfo,int32_t ordered,struct datachain_info *dPoW,int32_t height,uint32_t hdrsi,uint32_t unspentind) |
|
|
int32_t datachain_events_rewind(struct supernet_info *myinfo,int32_t ordered,struct datachain_info *dPoW,int32_t height,uint32_t hdrsi,uint32_t unspentind) |
|
|
{ |
|
|
{ |
|
|
uint64_t hdrsi_unspentind; int32_t i; |
|
|
uint64_t hdrsi_unspentind; int32_t i; |
|
|
|
|
|
printf("datachain_events_rewind\n"); |
|
|
if ( dPoW->numevents > 0 ) |
|
|
if ( dPoW->numevents > 0 ) |
|
|
{ |
|
|
{ |
|
|
datachain_events_sort(dPoW); |
|
|
datachain_events_sort(dPoW); |
|
@ -57,6 +58,7 @@ int32_t datachain_events_rewind(struct supernet_info *myinfo,int32_t ordered,str |
|
|
int32_t datachain_checkpoint_update(struct supernet_info *myinfo,struct iguana_info *coin,uint32_t timestamp) |
|
|
int32_t datachain_checkpoint_update(struct supernet_info *myinfo,struct iguana_info *coin,uint32_t timestamp) |
|
|
{ |
|
|
{ |
|
|
int32_t i,num,n,lastheight; bits256 *tree,hash2,lasthash2,merkle; struct iguana_block *block; |
|
|
int32_t i,num,n,lastheight; bits256 *tree,hash2,lasthash2,merkle; struct iguana_block *block; |
|
|
|
|
|
printf("datachain_checkpoint_update\n"); |
|
|
if ( coin->lastcheckpoint <= coin->blocks.hwmchain.height ) |
|
|
if ( coin->lastcheckpoint <= coin->blocks.hwmchain.height ) |
|
|
{ |
|
|
{ |
|
|
num = (coin->blocks.hwmchain.height - coin->lastcheckpoint) + 1; |
|
|
num = (coin->blocks.hwmchain.height - coin->lastcheckpoint) + 1; |
|
@ -97,6 +99,7 @@ int32_t datachain_checkpoint_update(struct supernet_info *myinfo,struct iguana_i |
|
|
void datachain_BTC_clock(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *btc,int32_t height,uint32_t hdrsi,uint32_t unspentind,uint32_t timestamp) |
|
|
void datachain_BTC_clock(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *btc,int32_t height,uint32_t hdrsi,uint32_t unspentind,uint32_t timestamp) |
|
|
{ |
|
|
{ |
|
|
int32_t retval; struct iguana_info *btcd = iguana_coinfind("BTCD"); |
|
|
int32_t retval; struct iguana_info *btcd = iguana_coinfind("BTCD"); |
|
|
|
|
|
printf("datachain_BTC_clock\n"); |
|
|
if ( (retval= datachain_eventadd(myinfo,ordered,&myinfo->dPoW.BTC,DATACHAIN_ISBTC,0)) < 0 ) |
|
|
if ( (retval= datachain_eventadd(myinfo,ordered,&myinfo->dPoW.BTC,DATACHAIN_ISBTC,0)) < 0 ) |
|
|
{ |
|
|
{ |
|
|
myinfo->dPoW.BTC.numevents = datachain_events_rewind(myinfo,ordered,&myinfo->dPoW.BTC,height,hdrsi,unspentind); |
|
|
myinfo->dPoW.BTC.numevents = datachain_events_rewind(myinfo,ordered,&myinfo->dPoW.BTC,height,hdrsi,unspentind); |
|
@ -115,6 +118,7 @@ void datachain_BTC_clock(struct supernet_info *myinfo,int32_t ordered,struct igu |
|
|
void datachain_KOMODO_newblock(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *btcd,int32_t height,uint32_t hdrsi,uint32_t unspentind,uint32_t timestamp) |
|
|
void datachain_KOMODO_newblock(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *btcd,int32_t height,uint32_t hdrsi,uint32_t unspentind,uint32_t timestamp) |
|
|
{ |
|
|
{ |
|
|
int32_t retval; struct iguana_info *virt,*tmp; |
|
|
int32_t retval; struct iguana_info *virt,*tmp; |
|
|
|
|
|
printf("datachain_KOMODO_newblock\n"); |
|
|
if ( (retval= datachain_eventadd(myinfo,ordered,&myinfo->dPoW.BTCD,DATACHAIN_ISKOMODO,0)) < 0 ) |
|
|
if ( (retval= datachain_eventadd(myinfo,ordered,&myinfo->dPoW.BTCD,DATACHAIN_ISKOMODO,0)) < 0 ) |
|
|
{ |
|
|
{ |
|
|
myinfo->dPoW.BTCD.numevents = datachain_events_rewind(myinfo,ordered,&myinfo->dPoW.BTCD,height,hdrsi,unspentind); |
|
|
myinfo->dPoW.BTCD.numevents = datachain_events_rewind(myinfo,ordered,&myinfo->dPoW.BTCD,height,hdrsi,unspentind); |
|
@ -137,6 +141,7 @@ void datachain_KOMODO_newblock(struct supernet_info *myinfo,int32_t ordered,stru |
|
|
void datachain_virt_newblock(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *virt,int32_t height,uint32_t hdrsi,uint32_t unspentind,uint32_t timestamp) |
|
|
void datachain_virt_newblock(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *virt,int32_t height,uint32_t hdrsi,uint32_t unspentind,uint32_t timestamp) |
|
|
{ |
|
|
{ |
|
|
int32_t retval; |
|
|
int32_t retval; |
|
|
|
|
|
printf("datachain_virt_newblock\n"); |
|
|
if ( (retval= datachain_eventadd(myinfo,ordered,&virt->dPoW,0,0)) < 0 ) |
|
|
if ( (retval= datachain_eventadd(myinfo,ordered,&virt->dPoW,0,0)) < 0 ) |
|
|
{ |
|
|
{ |
|
|
virt->dPoW.numevents = datachain_events_rewind(myinfo,ordered,&virt->dPoW,height,hdrsi,unspentind); |
|
|
virt->dPoW.numevents = datachain_events_rewind(myinfo,ordered,&virt->dPoW,height,hdrsi,unspentind); |
|
@ -225,6 +230,7 @@ void datachain_opreturn(struct supernet_info *myinfo,int32_t ordered,struct igua |
|
|
uint32_t hdrsi,unspentind; struct datachain_event *event; |
|
|
uint32_t hdrsi,unspentind; struct datachain_event *event; |
|
|
hdrsi = (uint32_t)(hdrsi_unspentind >> 32); |
|
|
hdrsi = (uint32_t)(hdrsi_unspentind >> 32); |
|
|
unspentind = (uint32_t)hdrsi_unspentind; |
|
|
unspentind = (uint32_t)hdrsi_unspentind; |
|
|
|
|
|
printf("datachain_opreturn\n"); |
|
|
if ( btc_or_btcd == DATACHAIN_ISBTC ) // BTC
|
|
|
if ( btc_or_btcd == DATACHAIN_ISBTC ) // BTC
|
|
|
{ |
|
|
{ |
|
|
if ( opreturn == 0 ) |
|
|
if ( opreturn == 0 ) |
|
@ -267,6 +273,7 @@ void datachain_opreturn(struct supernet_info *myinfo,int32_t ordered,struct igua |
|
|
int32_t iguana_opreturn(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,int64_t crypto777_payment,int32_t height,uint64_t hdrsi_unspentind,int64_t burned,uint32_t fileid,uint64_t scriptpos,uint32_t scriptlen) |
|
|
int32_t iguana_opreturn(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,int64_t crypto777_payment,int32_t height,uint64_t hdrsi_unspentind,int64_t burned,uint32_t fileid,uint64_t scriptpos,uint32_t scriptlen) |
|
|
{ |
|
|
{ |
|
|
uint8_t type,scriptspace[IGUANA_MAXSCRIPTSIZE],opreturn[8192]; char fname[1024]; uint32_t oplen=0; int32_t btc_or_btcd=0,len = -1; struct vin_info V; |
|
|
uint8_t type,scriptspace[IGUANA_MAXSCRIPTSIZE],opreturn[8192]; char fname[1024]; uint32_t oplen=0; int32_t btc_or_btcd=0,len = -1; struct vin_info V; |
|
|
|
|
|
printf("iguana_opreturn\n"); |
|
|
if ( strcmp("BTC",coin->symbol) == 0 ) |
|
|
if ( strcmp("BTC",coin->symbol) == 0 ) |
|
|
btc_or_btcd = DATACHAIN_ISBTC; |
|
|
btc_or_btcd = DATACHAIN_ISBTC; |
|
|
else if ( strcmp("BTCD",coin->symbol) == 0 ) |
|
|
else if ( strcmp("BTCD",coin->symbol) == 0 ) |
|
@ -314,9 +321,13 @@ void datachain_update_spend(struct supernet_info *myinfo,int32_t ordered,struct |
|
|
int64_t datachain_update(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,uint8_t rmd160[20],int64_t crypto777_payment,uint8_t type,int32_t height,uint64_t hdrsi_unspentind,int64_t value,uint32_t fileid,uint64_t scriptpos,int32_t scriptlen,bits256 txid,int32_t vout) |
|
|
int64_t datachain_update(struct supernet_info *myinfo,int32_t ordered,struct iguana_info *coin,uint32_t timestamp,struct iguana_bundle *bp,uint8_t rmd160[20],int64_t crypto777_payment,uint8_t type,int32_t height,uint64_t hdrsi_unspentind,int64_t value,uint32_t fileid,uint64_t scriptpos,int32_t scriptlen,bits256 txid,int32_t vout) |
|
|
{ |
|
|
{ |
|
|
if ( memcmp(rmd160,CRYPTO777_RMD160,20) == 0 ) |
|
|
if ( memcmp(rmd160,CRYPTO777_RMD160,20) == 0 ) |
|
|
|
|
|
{ |
|
|
crypto777_payment += value; |
|
|
crypto777_payment += value; |
|
|
|
|
|
printf("datachain_update crypto777 %.8f += %.8f\n",dstr(crypto777_payment),dstr(value)); |
|
|
|
|
|
} |
|
|
else if ( crypto777_payment != 0 && (type == IGUANA_SCRIPT_OPRETURN || type == IGUANA_SCRIPT_3of3 || type == IGUANA_SCRIPT_2of2 || type == IGUANA_SCRIPT_1of1) ) |
|
|
else if ( crypto777_payment != 0 && (type == IGUANA_SCRIPT_OPRETURN || type == IGUANA_SCRIPT_3of3 || type == IGUANA_SCRIPT_2of2 || type == IGUANA_SCRIPT_1of1) ) |
|
|
{ |
|
|
{ |
|
|
|
|
|
printf("datachain_update opreturn\n"); |
|
|
iguana_opreturn(myinfo,ordered,coin,timestamp,bp,crypto777_payment,height,hdrsi_unspentind,value,fileid,scriptpos,scriptlen); |
|
|
iguana_opreturn(myinfo,ordered,coin,timestamp,bp,crypto777_payment,height,hdrsi_unspentind,value,fileid,scriptpos,scriptlen); |
|
|
} else datachain_update_spend(myinfo,ordered,coin,timestamp,bp,height,txid,vout,rmd160,value); |
|
|
} else datachain_update_spend(myinfo,ordered,coin,timestamp,bp,height,txid,vout,rmd160,value); |
|
|
return(crypto777_payment); |
|
|
return(crypto777_payment); |
|
|