@@ -1,5 +1,5 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Copyright © 2014-2017 The SuperNET Developers. *
|
* Copyright © 2014-2018 The SuperNET Developers. *
|
||||||
* *
|
* *
|
||||||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
|
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
|
||||||
* the top-level directory of this distribution for the individual copyright *
|
* the top-level directory of this distribution for the individual copyright *
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char *symbol,uint8_t type,uint8_t *data,uint16_t datalen)
|
struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char *symbol,uint8_t type,uint8_t *data,uint16_t datalen)
|
||||||
{
|
{
|
||||||
struct komodo_event *ep=0; uint16_t len = (uint16_t)(sizeof(*ep) + datalen);
|
struct komodo_event *ep=0; uint16_t len = (uint16_t)(sizeof(*ep) + datalen);
|
||||||
if ( sp != 0 )
|
if ( sp != 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
{
|
{
|
||||||
portable_mutex_lock(&komodo_mutex);
|
portable_mutex_lock(&komodo_mutex);
|
||||||
ep = (struct komodo_event *)calloc(1,len);
|
ep = (struct komodo_event *)calloc(1,len);
|
||||||
@@ -55,7 +55,7 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig
|
|||||||
N.notarizedheight = notarizedheight;
|
N.notarizedheight = notarizedheight;
|
||||||
N.MoM = MoM;
|
N.MoM = MoM;
|
||||||
N.MoMdepth = MoMdepth;
|
N.MoMdepth = MoMdepth;
|
||||||
strcpy(N.dest,dest);
|
strncpy(N.dest,dest,sizeof(N.dest)-1);
|
||||||
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N));
|
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N));
|
||||||
if ( sp != 0 )
|
if ( sp != 0 )
|
||||||
komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid,MoM,MoMdepth);
|
komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid,MoM,MoMdepth);
|
||||||
@@ -77,18 +77,23 @@ void komodo_eventadd_pubkeys(struct komodo_state *sp,char *symbol,int32_t height
|
|||||||
void komodo_eventadd_pricefeed(struct komodo_state *sp,char *symbol,int32_t height,uint32_t *prices,uint8_t num)
|
void komodo_eventadd_pricefeed(struct komodo_state *sp,char *symbol,int32_t height,uint32_t *prices,uint8_t num)
|
||||||
{
|
{
|
||||||
struct komodo_event_pricefeed F;
|
struct komodo_event_pricefeed F;
|
||||||
|
if ( num == sizeof(F.prices)/sizeof(*F.prices) )
|
||||||
|
{
|
||||||
memset(&F,0,sizeof(F));
|
memset(&F,0,sizeof(F));
|
||||||
F.num = num;
|
F.num = num;
|
||||||
memcpy(F.prices,prices,sizeof(*F.prices) * num);
|
memcpy(F.prices,prices,sizeof(*F.prices) * num);
|
||||||
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_PRICEFEED,(uint8_t *)&F,(int32_t)(sizeof(F.num) + sizeof(*F.prices) * num));
|
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_PRICEFEED,(uint8_t *)&F,(int32_t)(sizeof(F.num) + sizeof(*F.prices) * num));
|
||||||
if ( sp != 0 )
|
if ( sp != 0 )
|
||||||
komodo_pvals(height,prices,num);
|
komodo_pvals(height,prices,num);
|
||||||
|
} //else fprintf(stderr,"skip pricefeed[%d]\n",num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_eventadd_opreturn(struct komodo_state *sp,char *symbol,int32_t height,uint256 txid,uint64_t value,uint16_t vout,uint8_t *buf,uint16_t opretlen)
|
void komodo_eventadd_opreturn(struct komodo_state *sp,char *symbol,int32_t height,uint256 txid,uint64_t value,uint16_t vout,uint8_t *buf,uint16_t opretlen)
|
||||||
{
|
{
|
||||||
struct komodo_event_opreturn O; uint8_t opret[16384];
|
struct komodo_event_opreturn O; uint8_t *opret;
|
||||||
memset(&O,0,sizeof(O));
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
{
|
||||||
|
opret = (uint8_t *)calloc(1,sizeof(O) + opretlen + 16);
|
||||||
O.txid = txid;
|
O.txid = txid;
|
||||||
O.value = value;
|
O.value = value;
|
||||||
O.vout = vout;
|
O.vout = vout;
|
||||||
@@ -96,9 +101,11 @@ void komodo_eventadd_opreturn(struct komodo_state *sp,char *symbol,int32_t heigh
|
|||||||
memcpy(&opret[sizeof(O)],buf,opretlen);
|
memcpy(&opret[sizeof(O)],buf,opretlen);
|
||||||
O.oplen = (int32_t)(opretlen + sizeof(O));
|
O.oplen = (int32_t)(opretlen + sizeof(O));
|
||||||
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_OPRETURN,opret,O.oplen);
|
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_OPRETURN,opret,O.oplen);
|
||||||
|
free(opret);
|
||||||
if ( sp != 0 )
|
if ( sp != 0 )
|
||||||
komodo_opreturn(height,value,buf,opretlen,txid,vout,symbol);
|
komodo_opreturn(height,value,buf,opretlen,txid,vout,symbol);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void komodo_event_undo(struct komodo_state *sp,struct komodo_event *ep)
|
void komodo_event_undo(struct komodo_state *sp,struct komodo_event *ep)
|
||||||
{
|
{
|
||||||
@@ -171,6 +178,7 @@ void komodo_eventadd_kmdheight(struct komodo_state *sp,char *symbol,int32_t heig
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//fprintf(stderr,"REWIND kmdheight.%d\n",kmdheight);
|
||||||
kmdheight = -kmdheight;
|
kmdheight = -kmdheight;
|
||||||
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_REWIND,(uint8_t *)&height,sizeof(height));
|
komodo_eventadd(sp,height,symbol,KOMODO_EVENT_REWIND,(uint8_t *)&height,sizeof(height));
|
||||||
if ( sp != 0 )
|
if ( sp != 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user