jl777 8 years ago
parent
commit
4238d2a2d6
  1. 10
      iguana/dpow/dpow_fsm.c
  2. 4
      iguana/dpow/dpow_rpc.c
  3. 2
      iguana/dpow/dpow_tx.c
  4. 3
      iguana/iguana_bundles.c
  5. 6
      iguana/iguana_notary.c

10
iguana/dpow/dpow_fsm.c

@ -556,13 +556,13 @@ void dpow_statemachinestart(void *ptr)
{
bp = calloc(1,sizeof(*bp));
bp->minsigs = minsigs;
if ( (bp->duration= duration) == DPOW_RATIFYDURATION )
bp->isratify = 1;
bp->duration = duration;
bp->srccoin = src;
bp->destcoin = dest;
bp->opret_symbol = dp->symbol;
if ( jsonstr != 0 && (ratified= cJSON_Parse(jsonstr)) != 0 )
{
bp->isratify = 1;
if ( (numratified= cJSON_GetArraySize(ratified)) > 0 )
{
for (i=0; i<numratified; i++)
@ -619,9 +619,9 @@ void dpow_statemachinestart(void *ptr)
bp->numnotaries = komodo_notaries(src->symbol,pubkeys,strcmp("KMD",src->symbol) == 0 ? kmdheight : bp->height);
for (i=0; i<bp->numnotaries; i++)
{
int32_t j; for (j=0; j<33; j++)
printf("%02x",pubkeys[i][j]);
printf(" <= pubkey[%d]\n",i);
//int32_t j; for (j=0; j<33; j++)
// printf("%02x",pubkeys[i][j]);
//printf(" <= pubkey[%d]\n",i);
memcpy(bp->notaries[i].pubkey,pubkeys[i],33);
if ( memcmp(bp->notaries[i].pubkey,dp->minerkey33,33) == 0 )
{

4
iguana/dpow/dpow_rpc.c

@ -15,14 +15,14 @@
#define issue_curl(cmdstr) bitcoind_RPC(0,"curl",cmdstr,0,0,0)
int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t kmdheight)
int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height)
{
int32_t i,num=-1; struct iguana_info *coin; char params[256],*retstr,*pubkeystr; cJSON *retjson,*item,*array;
if ( (coin= iguana_coinfind(symbol)) != 0 )
{
if ( coin->FULLNODE < 0 )
{
sprintf(params,"[\"%d\"]",kmdheight);
sprintf(params,"[\"%d\"]",height);
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"notaries",params)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )

2
iguana/dpow/dpow_tx.c

@ -201,7 +201,7 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in
satoshis = 0;
len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis);
if ( src_or_dest != 0 )
opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,0,bp,src_or_dest);
opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,bp,src_or_dest);
else opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,bp,src_or_dest);
if ( opretlen < 0 )
return(-1);

3
iguana/iguana_bundles.c

@ -420,8 +420,9 @@ struct iguana_txid *iguana_bundletx(struct iguana_info *coin,struct iguana_bundl
{
static const bits256 zero;
int32_t hdrsi,iter; struct iguana_txid *T; int64_t Toffset; char fname[1024]; FILE *fp; struct iguana_ramchaindata rdata,*rptr;
usleep(1000);
portable_mutex_lock(&coin->special_mutex);
if ( (rptr= bp->ramchain.H.data) != 0 )//|| (bp == coin->current && (rptr= coin->RTramchain.H.data) != 0) )
if ( (rptr= bp->ramchain.H.data) != 0 )
{
T = RAMCHAIN_PTR(rptr,Toffset);
*tx = T[txidind];

6
iguana/iguana_notary.c

@ -59,7 +59,7 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che
void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime)
{
void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t freq,minsigs;
void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t freq,minsigs; uint8_t pubkeys[64][33];
dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime);
checkpoint = dp->srcfifo[dp->srcconfirms];
if ( strcmp("BTC",dp->dest) == 0 )
@ -70,9 +70,9 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
else
{
freq = 1;
minsigs = 2;
minsigs = (komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1;
}
printf("%s src ht.%d dest.%u nonz.%d %s\n",dp->symbol,height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash));
printf("%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs);
dpow_fifoupdate(myinfo,dp->srcfifo,dp->last);
if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 )
{

Loading…
Cancel
Save