jl777 8 years ago
parent
commit
b868b43f66
  1. 2
      basilisk/basilisk_bitcoin.c
  2. 2
      iguana/iguana_interpreter.c
  3. 10
      iguana/iguana_notary.c
  4. 12
      iguana/iguana_sign.c

2
basilisk/basilisk_bitcoin.c

@ -556,7 +556,7 @@ char *iguana_utxoduplicates(struct supernet_info *myinfo,struct iguana_info *coi
spendlen = bitcoin_pubkeyspend(script,0,pubkey33);
for (i=0; i<duplicates; i++)
bitcoin_txoutput(txobj,script,spendlen,satoshis);
rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,satoshis * duplicates,changeaddr,coin->txfee + duplicates*coin->txfee/10,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);
if ( signedtxidp != 0 )
{

2
iguana/iguana_interpreter.c

@ -1300,7 +1300,7 @@ int32_t bitcoin_assembler(struct iguana_info *coin,cJSON *logarray,uint8_t scrip
{
if ( stacks->stackdepth < op->stackitems )
{
printf("stackdepth.%d needed.%d (%s) at offset.%ld\n",stacks->stackdepth,op->stackitems,str,(long)str-(long)asmstr);
//printf("stackdepth.%d needed.%d (%s) at offset.%ld\n",stacks->stackdepth,op->stackitems,str,(long)str-(long)asmstr);
errs++;
break;
}

10
iguana/iguana_notary.c

@ -544,8 +544,8 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
{
for (j=0; j<sizeof(desthash); j++)
desthash.bytes[j] = notaries[i].pubkey[j+1];
printf("send to notary.%d\n",i);
basilisk_channelsend(myinfo,srchash,desthash,channel,height,data,siglen+11,600);
//printf("send to notary.%d\n",i);
basilisk_channelsend(myinfo,srchash,desthash,channel,height,data,siglen+11,120);
}
retval = 0;
}
@ -681,7 +681,7 @@ void dpow_txidupdate(struct supernet_info *myinfo,struct dpow_info *dp,struct ig
uint32_t dpow_statemachineiterate(struct supernet_info *myinfo,struct dpow_info *dp,struct iguana_info *coin,uint32_t state,bits256 hashmsg,int32_t heightmsg,bits256 btctxid,struct dpow_entry notaries[DPOW_MAXRELAYS],int32_t numnotaries,int32_t myind,uint64_t *recvmaskp,bits256 *signedtxidp,char *signedtx,uint32_t timestamp)
{
// todo: add RBF support
bits256 txid,signedtxid; int32_t vout,completed,i,j,k,m,incr,haveutxo = 0; cJSON *addresses; char *sendtx,*rawtx,*retstr,coinaddr[64],str[65],str2[65]; uint8_t data[sizeof(bits256)*2+1]; uint32_t channel; bits256 srchash,desthash; uint64_t mask;
bits256 txid,signedtxid; int32_t vout,completed,i,j,k,m,incr,haveutxo = 0; cJSON *addresses; char *sendtx,*rawtx,*retstr,coinaddr[64]; uint8_t data[sizeof(bits256)*2+1]; uint32_t channel; bits256 srchash,desthash; uint64_t mask;
if ( numnotaries > 8 )
incr = sqrt(numnotaries) + 1;
else incr = 1;
@ -727,8 +727,8 @@ uint32_t dpow_statemachineiterate(struct supernet_info *myinfo,struct dpow_info
data[j+sizeof(bits256)] = txid.bytes[j];
}
data[sizeof(bits256)*2] = vout;
printf("STATE1: %s send %s %s/v%d\n",coin->symbol,bits256_str(str,hashmsg),bits256_str(str2,txid),vout);
basilisk_channelsend(myinfo,srchash,desthash,channel,heightmsg,data,sizeof(data),600);
//printf("STATE1: %s send %s %s/v%d\n",coin->symbol,bits256_str(str,hashmsg),bits256_str(str2,txid),vout);
basilisk_channelsend(myinfo,srchash,desthash,channel,heightmsg,data,sizeof(data),120);
}
state = 2;
}

12
iguana/iguana_sign.c

@ -319,7 +319,11 @@ int32_t iguana_parsevinobj(struct supernet_info *myinfo,struct iguana_info *coin
if ( (pubkeystr= jstr(jitem(pubkeysjson,i),0)) != 0 && (plen= (int32_t)strlen(pubkeystr) >> 1) > 0 )
{
if ( V != 0 )
{
memcpy(V->signers[i].pubkey,&vin->vinscript[vin->scriptlen],plen);
if ( V->spendlen == 35 && V->spendscript[0] == 33 && V->spendscript[34] == 0xac )
suppress_pubkeys = 1;
}
if ( suppress_pubkeys == 0 )
{
printf("addpub.(%s)\n",pubkeystr);
@ -1292,7 +1296,7 @@ int32_t iguana_interpreter(struct iguana_info *coin,cJSON *logarray,int64_t nLoc
//printf("interpreter.(%s)\n",jprint(spendscript,0));
if ( (scriptlen= bitcoin_assembler(coin,logarray,script,spendscript,1,nLockTime,&V[vini])) < 0 )
{
printf("bitcoin_assembler error scriptlen.%d\n",scriptlen);
//printf("bitcoin_assembler error scriptlen.%d\n",scriptlen);
errs++;
}
else if ( scriptlen != activescriptlen || memcmp(script,activescript,scriptlen) != 0 )
@ -1457,12 +1461,12 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
finalized = iguana_vininfo_create(myinfo,coin,serialized2,maxsize,msgtx,vins,numinputs,V);
if ( (complete= bitcoin_verifyvins(coin,height,signedtxidp,&signedtx,msgtx,serialized3,maxsize,V,SIGHASH_ALL,1,V->suppress_pubkeys)) > 0 && signedtx != 0 )
{
int32_t tmp;
int32_t tmp; char str[65];
if ( (tmp= iguana_interpreter(coin,0,iguana_lockval(finalized,jint(txobj,"locktime")),V,numinputs)) < 0 )
{
printf("iguana_interpreter %d error.(%s)\n",tmp,signedtx);
//printf("iguana_interpreter %d error.(%s)\n",tmp,signedtx);
complete = 0;
}
} else printf("%s signed\n",bits256_str(str,*signedtxidp));
}
}
}

Loading…
Cancel
Save