Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
d8f4310147
  1. 2
      basilisk/basilisk_bitcoin.c
  2. 8
      basilisk/basilisk_swap.c
  3. 6
      iguana/iguana_interpreter.c
  4. 2
      iguana/iguana_payments.c
  5. 8
      iguana/iguana_sign.c

2
basilisk/basilisk_bitcoin.c

@ -522,7 +522,7 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi
} else oplen = datachain_opreturnscript(coin,buf,opreturn,oplen);
}
rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,amount,changeaddr,txfee,addresses,minconf,oplen!=0?buf:0,oplen+offset,burnamount,remoteaddr);
printf("generated.(%s) vins.(%s)\n",rawtx!=0?rawtx:"",vins!=0?jprint(vins,0):"");
//printf("generated.(%s) vins.(%s)\n",rawtx!=0?rawtx:"",vins!=0?jprint(vins,0):"");
}
if ( rawtx != 0 )
{

8
basilisk/basilisk_swap.c

@ -340,7 +340,8 @@ int32_t basilisk_verify_bobdeposit(struct supernet_info *myinfo,struct basilisk_
uint8_t userdata[512]; int32_t len = 0;
if ( basilisk_rawtx_spendscript(myinfo,swap->bobcoin->blocks.hwmchain.height,&swap->bobdeposit,0,data,datalen,0) == 0 )
{
len = basilisk_swapuserdata(userdata,0,GENESIS_PRIVKEY,0x02,swap->pubA0,1);
//len = basilisk_swapuserdata(userdata,0,GENESIS_PRIVKEY,0x02,swap->pubA0,1);
userdata[len++] = 0x51;
return(basilisk_rawtx_sign(myinfo,swap->bobcoin->blocks.hwmchain.height,swap,&swap->aliceclaim,&swap->bobdeposit,swap->myprivs[0],0,userdata,len));
}
printf("error with bobdeposit\n");
@ -366,7 +367,8 @@ int32_t basilisk_bobpayment_reclaim(struct supernet_info *myinfo,struct basilisk
{
uint8_t userdata[512]; int32_t len = 0;
printf("basilisk_bobpayment_reclaim\n");
len = basilisk_swapuserdata(userdata,0,GENESIS_PRIVKEY,0x03,swap->pubB1,1);
userdata[len++] = 0x51;
//len = basilisk_swapuserdata(userdata,0,GENESIS_PRIVKEY,0x03,swap->pubB1,1);
return(basilisk_rawtx_sign(myinfo,swap->bobcoin->blocks.hwmchain.height,swap,&swap->bobreclaim,&swap->bobpayment,swap->myprivs[1],0,userdata,len));
}
@ -1082,7 +1084,7 @@ void basilisk_swaploop(void *_swap)
printf("A r%u/q%u swapstate.%x\n",swap->req.requestid,swap->req.quoteid,swap->statebits);
basilisk_sendpubkeys(myinfo,swap,data,maxlen); // send pubkeys
basilisk_checkdeck(myinfo,swap,data,maxlen); // check for other deck 0x02
if ( (swap->statebits & 0x02) != 0 )
//if ( (swap->statebits & 0x02) != 0 )
basilisk_sendchoosei(myinfo,swap,data,maxlen);
basilisk_waitchoosei(myinfo,swap,data,maxlen); // wait for choosei 0x08
if ( (swap->statebits & (0x08|0x02)) == (0x08|0x02) )

6
iguana/iguana_interpreter.c

@ -498,7 +498,7 @@ static int32_t iguana_pushdata(struct iguana_interpreter *stacks,int64_t num64,u
struct iguana_stackdata Snum; cJSON *item = 0; char tmpstr[2048]; int32_t num = (int32_t)num64;
if ( stacks->lastpath[stacks->ifdepth] < 0 )
return(0);
//printf("PUSH.(%lld %p %d)\n",(long long)num64,numbuf,numlen);
printf("PUSH.(%lld %p %d)\n",(long long)num64,numbuf,numlen);
if ( stacks->maxstackdepth > 0 )
{
/*if ( numbuf != 0 )
@ -1143,7 +1143,7 @@ int32_t bitcoin_assembler(struct iguana_info *coin,cJSON *logarray,uint8_t scrip
break;
}
HASH_FIND(hh,OPTABLE,str,j,op);
//printf("{%s}\n",str);
printf("{%s}\n",str);
str += j;
if ( op != 0 )
{
@ -1553,7 +1553,7 @@ int32_t bitcoin_assembler(struct iguana_info *coin,cJSON *logarray,uint8_t scrip
else
{
jadd(interpreter,"result",jfalse());
printf("Evaluate FALSE, depth.%d errs.%d\n",stacks->stackdepth,errs);
printf("Evaluate FALSE, depth.%d errs.%d [0] size.%d num.%d\n",stacks->stackdepth,errs,stacks->stack[0].size,stacks->stack[0].U.val);
}
//if ( stacks->logarray != 0 )
// printf("LOG.(%s)\n",jprint(stacks->logarray,0));

2
iguana/iguana_payments.c

@ -311,7 +311,7 @@ char *iguana_signrawtx(struct supernet_info *myinfo,struct iguana_info *coin,int
memset(&msgtx,0,sizeof(msgtx));
if ( V == 0 )
V = calloc(numinputs,sizeof(*V)), flagV = 1;
printf("SIGN.(%s) priv.(%s) %llx %llx\n",jprint(vins,0),jprint(privkeys,0),(long long)V->signers[0].privkey.txid,(long long)V->signers[1].privkey.txid);
//printf("SIGN.(%s) priv.(%s) %llx %llx\n",jprint(vins,0),jprint(privkeys,0),(long long)V->signers[0].privkey.txid,(long long)V->signers[1].privkey.txid);
if ( V != 0 )
{
if ( iguana_signrawtransaction(myinfo,coin,height,&msgtx,&signedtx,signedtxidp,V,numinputs,rawtx,vins,privkeys) > 0 )

8
iguana/iguana_sign.c

@ -67,7 +67,7 @@ int32_t iguana_vinparse(struct iguana_info *coin,int32_t rwflag,uint8_t *seriali
}
}
len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->sequence),&msg->sequence);
if ( 1 )
if ( 0 )
{
int32_t i; char str[65];
for (i=0; i<len; i++)
@ -415,7 +415,7 @@ bits256 bitcoin_sigtxid(struct iguana_info *coin,int32_t height,uint8_t *seriali
{
#ifdef BTC2_VERSION
if ( height >= BTC2_HARDFORK_HEIGHT )
hashtype |= (BTC2_MAGICBYTE << 24); // the 0xff can be any non-zero byte
hashtype |= (0x777 << 20);
#endif
len += iguana_rwnum(1,&serialized[len],sizeof(hashtype),&hashtype);
revsigtxid = bits256_doublesha256(0,serialized,len);
@ -1223,8 +1223,8 @@ int32_t iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_inf
decode_hex(serialized,len,rawtx);
if ( (txobj= bitcoin_hex2json(coin,height,&txid,msgtx,rawtx,extraspace,extralen,serialized4,vins,V->suppress_pubkeys)) != 0 )
{
if ( vins != 0 )
printf("vins.(%s)\n",jprint(vins,0));
//if ( vins != 0 )
// printf("vins.(%s)\n",jprint(vins,0));
if ( jobj(txobj,"error") != 0 )
{
printf("txobj.(%s)\n",jprint(txobj,0));

Loading…
Cancel
Save