jl777 8 years ago
parent
commit
09d9b5eb2b
  1. 4
      basilisk/basilisk_bitcoin.c
  2. 14
      iguana/dpow/dpow_fsm.c

4
basilisk/basilisk_bitcoin.c

@ -557,15 +557,15 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
for (i=0; i<duplicates; i++) for (i=0; i<duplicates; i++)
bitcoin_txoutput(txobj,script,spendlen,satoshis); bitcoin_txoutput(txobj,script,spendlen,satoshis);
rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,satoshis * duplicates,changeaddr,coin->txfee + duplicates*coin->txfee/5,addresses,0,0,0,0,"127.0.0.1",0,1); rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,satoshis * duplicates,changeaddr,coin->txfee + duplicates*coin->txfee/5,addresses,0,0,0,0,"127.0.0.1",0,1);
printf("duplicatesTX.(%s)\n",rawtx); //printf("duplicatesTX.(%s)\n",rawtx);
if ( signedtxidp != 0 ) if ( signedtxidp != 0 )
{ {
if ( (signedtx= iguana_signrawtx(myinfo,coin,0,signedtxidp,completedp,vins,rawtx,0,0)) != 0 ) if ( (signedtx= iguana_signrawtx(myinfo,coin,0,signedtxidp,completedp,vins,rawtx,0,0)) != 0 )
{ {
free(rawtx); free(rawtx);
printf("signedtx.(%s)\n",signedtx);
if ( *completedp != 0 && sendflag != 0 ) if ( *completedp != 0 && sendflag != 0 )
{ {
printf("splitfunds signedtx.(%s)\n",signedtx);
iguana_sendrawtransaction(myinfo,coin,signedtx); iguana_sendrawtransaction(myinfo,coin,signedtx);
} }
rawtx = signedtx; rawtx = signedtx;

14
iguana/dpow/dpow_fsm.c

@ -69,7 +69,7 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
} }
} }
struct dpow_entry *dpow_notaryfind(struct supernet_info *myinfo,struct dpow_block *bp,int32_t *senderindp,uint8_t *senderpub) struct dpow_entry *dpow_notaryfind(struct supernet_info *myinfo,struct dpow_block *bp,int32_t height,int32_t *senderindp,uint8_t *senderpub)
{ {
int32_t i; int32_t i;
*senderindp = -1; *senderindp = -1;
@ -179,7 +179,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,uint8
printf("couldnt find height.%d | if you just started notary dapp this is normal\n",height); printf("couldnt find height.%d | if you just started notary dapp this is normal\n",height);
return(-1); return(-1);
} }
dpow_notaryfind(myinfo,bp,&myind,dp->minerkey33); dpow_notaryfind(myinfo,bp,height,&myind,dp->minerkey33);
if ( myind < 0 ) if ( myind < 0 )
{ {
printf("couldnt find myind height.%d | this means your pubkey for this node is not registered and needs to be ratified by majority vote of all notaries\n",height); printf("couldnt find myind height.%d | this means your pubkey for this node is not registered and needs to be ratified by majority vote of all notaries\n",height);
@ -252,7 +252,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,uint8
printf("unexpected mismatch hashmsg.%s vs %s\n",bits256_str(str,U.hashmsg),bits256_str(str2,bp->hashmsg)); printf("unexpected mismatch hashmsg.%s vs %s\n",bits256_str(str,U.hashmsg),bits256_str(str2,bp->hashmsg));
return(0); return(0);
} }
if ( (ep= dpow_notaryfind(myinfo,bp,&senderind,U.pubkey)) != 0 ) if ( (ep= dpow_notaryfind(myinfo,bp,height,&senderind,U.pubkey)) != 0 )
{ {
dpow_utxo2entry(bp,ep,&U); dpow_utxo2entry(bp,ep,&U);
if ( ((1LL << senderind) & bp->recvmask) == 0 ) if ( ((1LL << senderind) & bp->recvmask) == 0 )
@ -290,7 +290,7 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,uint8
} }
if ( dsig.senderind >= 0 && dsig.senderind < DPOW_MAXRELAYS ) if ( dsig.senderind >= 0 && dsig.senderind < DPOW_MAXRELAYS )
{ {
if ( dsig.lastk < bp->numnotaries && dsig.senderind < bp->numnotaries && (ep= dpow_notaryfind(myinfo,bp,&senderind,dsig.senderpub)) != 0 ) if ( dsig.lastk < bp->numnotaries && dsig.senderind < bp->numnotaries && (ep= dpow_notaryfind(myinfo,bp,height,&senderind,dsig.senderpub)) != 0 )
{ {
vcalc_sha256(0,commit.bytes,dsig.beacon.bytes,sizeof(dsig.beacon)); vcalc_sha256(0,commit.bytes,dsig.beacon.bytes,sizeof(dsig.beacon));
if ( memcmp(dsig.senderpub,bp->notaries[dsig.senderind].pubkey,33) == 0 ) if ( memcmp(dsig.senderpub,bp->notaries[dsig.senderind].pubkey,33) == 0 )
@ -619,9 +619,9 @@ void dpow_statemachinestart(void *ptr)
bp->numnotaries = komodo_notaries(pubkeys,kmdheight); bp->numnotaries = komodo_notaries(pubkeys,kmdheight);
for (i=0; i<bp->numnotaries; i++) for (i=0; i<bp->numnotaries; i++)
{ {
//for (j=0; j<33; j++) int32_t j; for (j=0; j<33; j++)
// printf("%02x",pubkeys[i][j]); printf("%02x",pubkeys[i][j]);
//printf(" <= pubkey[%d]\n",i); printf(" <= pubkey[%d]\n",i);
memcpy(bp->notaries[i].pubkey,pubkeys[i],33); memcpy(bp->notaries[i].pubkey,pubkeys[i],33);
if ( memcmp(bp->notaries[i].pubkey,dp->minerkey33,33) == 0 ) if ( memcmp(bp->notaries[i].pubkey,dp->minerkey33,33) == 0 )
{ {

Loading…
Cancel
Save