test
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout);
|
void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout);
|
||||||
void komodo_init();
|
void komodo_init(int32_t height);
|
||||||
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
|
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
|
||||||
char *komodo_issuemethod(char *method,char *params,uint16_t port);
|
char *komodo_issuemethod(char *method,char *params,uint16_t port);
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
|
|||||||
printf("fname.(%s) fpos.%ld\n",fname,ftell(fp));
|
printf("fname.(%s) fpos.%ld\n",fname,ftell(fp));
|
||||||
KOMODO_INITDONE = (uint32_t)time(NULL);
|
KOMODO_INITDONE = (uint32_t)time(NULL);
|
||||||
}
|
}
|
||||||
if ( height <= 0 )
|
if ( height <= 0 || )
|
||||||
{
|
{
|
||||||
//printf("early return: stateupdate height.%d\n",height);
|
//printf("early return: stateupdate height.%d\n",height);
|
||||||
return;
|
return;
|
||||||
@@ -347,7 +347,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
uint64_t signedmask,voutmask;
|
uint64_t signedmask,voutmask;
|
||||||
uint8_t scriptbuf[4096],pubkeys[64][33]; uint256 kmdtxid,btctxid,txhash;
|
uint8_t scriptbuf[4096],pubkeys[64][33]; uint256 kmdtxid,btctxid,txhash;
|
||||||
int32_t i,j,k,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count;
|
int32_t i,j,k,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count;
|
||||||
komodo_init();
|
komodo_init(pindex->nHeight);
|
||||||
if ( pindex->nHeight > hwmheight )
|
if ( pindex->nHeight > hwmheight )
|
||||||
hwmheight = pindex->nHeight;
|
hwmheight = pindex->nHeight;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ uint64_t komodo_seed(int32_t height)
|
|||||||
void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
|
void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
|
||||||
{
|
{
|
||||||
//int32_t i; uint256 hash;
|
//int32_t i; uint256 hash;
|
||||||
komodo_init();
|
komodo_init(pindex->nHeight);
|
||||||
//hash = block.GetHash();
|
//hash = block.GetHash();
|
||||||
//for (i=0; i<32; i++)
|
//for (i=0; i<32; i++)
|
||||||
// printf("%02x",((uint8_t *)&hash)[i]);
|
// printf("%02x",((uint8_t *)&hash)[i]);
|
||||||
@@ -390,7 +390,6 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
|
|||||||
int32_t komodo_block2height(CBlock *block)
|
int32_t komodo_block2height(CBlock *block)
|
||||||
{
|
{
|
||||||
int32_t i,n,height = 0; uint8_t *ptr;
|
int32_t i,n,height = 0; uint8_t *ptr;
|
||||||
komodo_init();
|
|
||||||
#ifdef KOMODO_ZCASH
|
#ifdef KOMODO_ZCASH
|
||||||
ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data();
|
ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data();
|
||||||
#else
|
#else
|
||||||
@@ -409,6 +408,7 @@ int32_t komodo_block2height(CBlock *block)
|
|||||||
}
|
}
|
||||||
//printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height);
|
//printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height);
|
||||||
}
|
}
|
||||||
|
komodo_init(height);
|
||||||
return(height);
|
return(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,14 +419,14 @@ void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block)
|
|||||||
#else
|
#else
|
||||||
uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0];
|
uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0];
|
||||||
#endif
|
#endif
|
||||||
komodo_init();
|
komodo_init(0);
|
||||||
memcpy(pubkey33,ptr+1,33);
|
memcpy(pubkey33,ptr+1,33);
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||||
{
|
{
|
||||||
CBlock block;
|
CBlock block;
|
||||||
komodo_init();
|
komodo_init(height);
|
||||||
memset(pubkey33,0,33);
|
memset(pubkey33,0,33);
|
||||||
if ( pindex != 0 )
|
if ( pindex != 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -222,25 +222,25 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_init()
|
void komodo_init(int32_t height)
|
||||||
{
|
{
|
||||||
static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33];
|
static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33];
|
||||||
if ( didinit == 0 )
|
if ( height > didinit )
|
||||||
{
|
{
|
||||||
didinit = 1;
|
if ( didinit == 0 )
|
||||||
//iguana_initQ(&DepositsQ,(char *)"Deposits");
|
|
||||||
//iguana_initQ(&PendingsQ,(char *)"Pendings");
|
|
||||||
pthread_mutex_init(&komodo_mutex,NULL);
|
|
||||||
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
|
|
||||||
n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis));
|
|
||||||
for (k=0; k<n; k++)
|
|
||||||
{
|
{
|
||||||
if ( Notaries_genesis[k][0] == 0 || Notaries_genesis[k][1] == 0 || Notaries_genesis[k][0][0] == 0 || Notaries_genesis[k][1][0] == 0 )
|
pthread_mutex_init(&komodo_mutex,NULL);
|
||||||
break;
|
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
|
||||||
decode_hex(pubkeys[k],33,(char *)Notaries_genesis[k][1]);
|
n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis));
|
||||||
|
for (k=0; k<n; k++)
|
||||||
|
{
|
||||||
|
if ( Notaries_genesis[k][0] == 0 || Notaries_genesis[k][1] == 0 || Notaries_genesis[k][0][0] == 0 || Notaries_genesis[k][1][0] == 0 )
|
||||||
|
break;
|
||||||
|
decode_hex(pubkeys[k],33,(char *)Notaries_genesis[k][1]);
|
||||||
|
}
|
||||||
|
komodo_notarysinit(0,pubkeys,k);
|
||||||
|
memset(&zero,0,sizeof(zero));
|
||||||
}
|
}
|
||||||
komodo_notarysinit(0,pubkeys,k);
|
|
||||||
memset(&zero,0,sizeof(zero));
|
|
||||||
komodo_stateupdate(0,0,0,0,zero,0,0,0,0,0,0,0,0,0);
|
komodo_stateupdate(0,0,0,0,zero,0,0,0,0,0,0,0,0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user