Browse Source

colour

patch-14
blackjok3r 5 years ago
parent
commit
3cf750c2a4
  1. 3
      basilisk/basilisk_DEX.c
  2. 4
      iguana/dPoW.h
  3. 3
      iguana/dpow/dpow_fsm.c
  4. 15
      iguana/dpow/dpow_network.c
  5. 6
      iguana/dpow/dpow_rpc.c
  6. 3
      iguana/dpow/dpow_tx.c
  7. 2
      iguana/iguana_payments.c
  8. 18
      includes/iguana_defines.h

3
basilisk/basilisk_DEX.c

@ -532,7 +532,6 @@ char *basilisk_sendrawtransaction(struct supernet_info *myinfo,struct iguana_inf
{ {
retstr = _dex_sendrawtransaction(myinfo,coin->symbol,signedtx); retstr = _dex_sendrawtransaction(myinfo,coin->symbol,signedtx);
} }
else retstr = dpow_sendrawtransaction(myinfo,coin,signedtx); else retstr = dpow_sendrawtransaction(myinfo,coin,signedtx,0);
return(retstr); return(retstr);
} }

4
iguana/dPoW.h

@ -116,7 +116,7 @@ struct dpow_block
struct dpow_recvdata recv[64]; struct dpow_recvdata recv[64];
struct dpow_entry notaries[DPOW_MAXRELAYS]; struct dpow_entry notaries[DPOW_MAXRELAYS];
uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend; uint32_t MoMdepth,state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch,paxwdcrc,lastnanosend;
int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS],destht_start; int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS];
int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk,matches,bestmatches; int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk,matches,bestmatches;
cJSON *ratified; cJSON *ratified;
uint16_t CCid; uint16_t CCid;
@ -179,7 +179,7 @@ cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin
cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash); cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash);
bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height); bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,int32_t height);
bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin); bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin);
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx); char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx, int32_t mine);
cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout); cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout);
char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address); char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address);
char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address); char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address);

3
iguana/dpow/dpow_fsm.c

@ -145,7 +145,7 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct
jaddistr(addresses,coinaddr); jaddistr(addresses,coinaddr);
if ( myinfo->nosplit == 0 && (rawtx= iguana_utxoduplicates(myinfo,coin,dp->minerkey33,DPOW_UTXOSIZE,n,&completed,&signedtxid,0,addresses)) != 0 ) if ( myinfo->nosplit == 0 && (rawtx= iguana_utxoduplicates(myinfo,coin,dp->minerkey33,DPOW_UTXOSIZE,n,&completed,&signedtxid,0,addresses)) != 0 )
{ {
if ( (sendtx= dpow_sendrawtransaction(myinfo,coin,rawtx)) != 0 ) if ( (sendtx= dpow_sendrawtransaction(myinfo,coin,rawtx,0)) != 0 )
{ {
printf("sendrawtransaction.(%s)\n",sendtx); printf("sendrawtransaction.(%s)\n",sendtx);
free(sendtx); free(sendtx);
@ -309,7 +309,6 @@ void dpow_statemachinestart(void *ptr)
bp->srccoin = src; bp->srccoin = src;
bp->destcoin = dest; bp->destcoin = dest;
bp->myind = -1; bp->myind = -1;
bp->destht_start = bp->destcoin->longestchain;
for (i=0; i<sizeof(bp->notaries)/sizeof(*bp->notaries); i++) for (i=0; i<sizeof(bp->notaries)/sizeof(*bp->notaries); i++)
bp->notaries[i].bestk = -1; bp->notaries[i].bestk = -1;
bp->opret_symbol = dp->symbol; bp->opret_symbol = dp->symbol;

15
iguana/dpow/dpow_network.c

@ -667,7 +667,7 @@ return(clonestr("{\"error\":\"basilisk disabled\"}"));
} }
else if ( dexreq.func == 'S' ) else if ( dexreq.func == 'S' )
{ {
retstr = dpow_sendrawtransaction(myinfo,coin,(char *)&dexp->packet[datalen]); retstr = dpow_sendrawtransaction(myinfo,coin,(char *)&dexp->packet[datalen],0);
} }
else if ( dexreq.func == '*' ) else if ( dexreq.func == '*' )
{ {
@ -2000,19 +2000,6 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru
bp->bestmask = dpow_maskmin(bp->recvmask,bp,&bp->bestk); bp->bestmask = dpow_maskmin(bp->recvmask,bp,&bp->bestk);
} }
// check that block has advanced by 1 on KMD before allowing bestmask to be calculated
if ( strcmp(bp->destcoin->symbol,"KMD") == 0 )
{
if ( bp->destht_start == bp->destcoin->longestchain )
return;
}
else
{
if ( bp->height == bp->srccoin->longestchain )
return;
}
//fprintf(stderr, "[%s] checkpoint ht.%i vs longestchain.%i\n",bp->srccoin->symbol, bp->destht_start, bp->destcoin->longestchain);
dpow_bestconsensus(dp,bp); dpow_bestconsensus(dp,bp);
if ( bp->bestk >= 0 ) if ( bp->bestk >= 0 )
bp->notaries[bp->myind].bestk = bp->bestk; bp->notaries[bp->myind].bestk = bp->bestk;

6
iguana/dpow/dpow_rpc.c

@ -741,7 +741,7 @@ cJSON *dpow_kvsearch(struct supernet_info *myinfo,struct iguana_info *coin,char
} }
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx) char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx, int32_t mine)
{ {
bits256 txid; cJSON *json,*array; char *paramstr,*retstr; bits256 txid; cJSON *json,*array; char *paramstr,*retstr;
if ( coin->FULLNODE < 0 ) if ( coin->FULLNODE < 0 )
@ -750,7 +750,9 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c
jaddistr(array,signedtx); jaddistr(array,signedtx);
paramstr = jprint(array,1); paramstr = jprint(array,1);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr);
printf(">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n",coin->symbol,retstr); char colour[16];
sprintf(colour,mine != 0 ? GREEN : RED);
fprintf(stderr,"%s>>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n"RESET,colour,coin->symbol,retstr);
free(paramstr); free(paramstr);
return(retstr); return(retstr);
} }

3
iguana/dpow/dpow_tx.c

@ -627,7 +627,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
bp->state = 1; bp->state = 1;
if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs ) if ( bits256_nonz(signedtxid) != 0 && numsigs == bp->minsigs )
{ {
if ( (retstr= dpow_sendrawtransaction(myinfo,coin,bp->signedtx)) != 0 ) if ( (retstr= dpow_sendrawtransaction(myinfo,coin,bp->signedtx,(bestmask & (1LL << bp->myind)) != 0)) != 0 )
{ {
//printf("sendrawtransaction.(%s)\n",retstr); //printf("sendrawtransaction.(%s)\n",retstr);
if ( is_hexstr(retstr,0) == sizeof(txid)*2 ) if ( is_hexstr(retstr,0) == sizeof(txid)*2 )
@ -669,4 +669,3 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
} else printf("numsigs.%d vs required.%d\n",numsigs,bp->minsigs); } else printf("numsigs.%d vs required.%d\n",numsigs,bp->minsigs);
} }
} }

2
iguana/iguana_payments.c

@ -303,7 +303,7 @@ bits256 iguana_sendrawtransaction(struct supernet_info *myinfo,struct iguana_inf
if ( coin->FULLNODE < 0 || coin->notarychain >= 0 ) if ( coin->FULLNODE < 0 || coin->notarychain >= 0 )
{ {
if ( coin->FULLNODE < 0 ) if ( coin->FULLNODE < 0 )
str = dpow_sendrawtransaction(myinfo,coin,signedtx); str = dpow_sendrawtransaction(myinfo,coin,signedtx,0);
else str = _dex_sendrawtransaction(myinfo,coin->symbol,signedtx); else str = _dex_sendrawtransaction(myinfo,coin->symbol,signedtx);
if ( str != 0 ) if ( str != 0 )
{ {

18
includes/iguana_defines.h

@ -211,4 +211,22 @@ extern int32_t IGUANA_NUMHELPERS;
#define IGUANA_MAXSCRIPTSIZE 10001 #define IGUANA_MAXSCRIPTSIZE 10001
#define RESET "\033[0m"
#define BLACK "\033[30m" /* Black */
#define RED "\033[31m" /* Red */
#define GREEN "\033[32m" /* Green */
#define YELLOW "\033[33m" /* Yellow */
#define BLUE "\033[34m" /* Blue */
#define MAGENTA "\033[35m" /* Magenta */
#define CYAN "\033[36m" /* Cyan */
#define WHITE "\033[37m" /* White */
#define BOLDBLACK "\033[1m\033[30m" /* Bold Black */
#define BOLDRED "\033[1m\033[31m" /* Bold Red */
#define BOLDGREEN "\033[1m\033[32m" /* Bold Green */
#define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */
#define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */
#define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */
#define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */
#define BOLDWHITE "\033[1m\033[37m" /* Bold White */
#endif #endif

Loading…
Cancel
Save