Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
7ab7c81aa5
  1. 12
      basilisk/basilisk_swap.c
  2. 2
      iguana/iguana777.c
  3. 9
      iguana/iguana_spendvectors.c

12
basilisk/basilisk_swap.c

@ -105,15 +105,19 @@ int32_t basilisk_bobscript(uint8_t *rmd160,uint8_t *redeemscript,int32_t *redeem
return(n); return(n);
} }
int32_t basilisk_alicescript(uint8_t *script,int32_t n,char *msigaddr,uint8_t altps2h,bits256 pubAm,bits256 pubBn) int32_t basilisk_alicescript(uint8_t *redeemscript,int32_t *redeemlenp,uint8_t *script,int32_t n,char *msigaddr,uint8_t altps2h,bits256 pubAm,bits256 pubBn)
{ {
uint8_t p2sh160[20]; struct vin_info V; uint8_t i,p2sh160[20]; struct vin_info V;
memset(&V,0,sizeof(V)); memset(&V,0,sizeof(V));
memcpy(&V.signers[0].pubkey[1],pubAm.bytes,sizeof(pubAm)), V.signers[0].pubkey[0] = 0x02; memcpy(&V.signers[0].pubkey[1],pubAm.bytes,sizeof(pubAm)), V.signers[0].pubkey[0] = 0x02;
memcpy(&V.signers[1].pubkey[1],pubBn.bytes,sizeof(pubBn)), V.signers[1].pubkey[0] = 0x03; memcpy(&V.signers[1].pubkey[1],pubBn.bytes,sizeof(pubBn)), V.signers[1].pubkey[0] = 0x03;
V.M = V.N = 2; V.M = V.N = 2;
n = bitcoin_MofNspendscript(p2sh160,script,n,&V); *redeemlenp = bitcoin_MofNspendscript(p2sh160,redeemscript,n,&V);
bitcoin_address(msigaddr,altps2h,p2sh160,sizeof(p2sh160)); bitcoin_address(msigaddr,altps2h,p2sh160,sizeof(p2sh160));
n = bitcoin_p2shspend(script,0,p2sh160);
for (i=0; i<n; i++)
printf("%02x",redeemscript[i]);
printf(" <- redeemscript alicetx\n");
return(n); return(n);
} }
@ -1065,7 +1069,7 @@ void basilisk_sendmostprivs(struct supernet_info *myinfo,struct basilisk_swap *s
void basilisk_alicepayment(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_rawtx *alicepayment,bits256 pubAm,bits256 pubBn) void basilisk_alicepayment(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_rawtx *alicepayment,bits256 pubAm,bits256 pubBn)
{ {
alicepayment->spendlen = basilisk_alicescript(alicepayment->spendscript,0,alicepayment->destaddr,coin->chain->p2shtype,pubAm,pubBn); alicepayment->spendlen = basilisk_alicescript(alicepayment->redeemscript,&alicepayment->redeemlen,alicepayment->spendscript,0,alicepayment->destaddr,coin->chain->p2shtype,pubAm,pubBn);
basilisk_rawtx_gen("alicepayment",myinfo,0,1,alicepayment,alicepayment->locktime,alicepayment->spendscript,alicepayment->spendlen,coin->chain->txfee,1); basilisk_rawtx_gen("alicepayment",myinfo,0,1,alicepayment,alicepayment->locktime,alicepayment->spendscript,alicepayment->spendlen,coin->chain->txfee,1);
} }

2
iguana/iguana777.c

@ -423,7 +423,7 @@ void iguana_update_balances(struct iguana_info *coin)
return; return;
} }
max = coin->bundlescount; max = coin->bundlescount;
if ( coin->bundles[max-1] != 0 && coin->bundles[max-1]->emitfinish <= 1 && coin->RTheight == 0 ) if ( coin->bundles[max-1] == coin->current || coin->bundles[max-1] == 0 || (coin->bundles[max-1] != 0 && coin->bundles[max-1]->emitfinish <= 1) )
max--; max--;
//coin->spendvectorsaved = 0; //coin->spendvectorsaved = 0;
if ( iguana_balancefinished(coin) < max && iguana_spendvectorsaves(coin) == 0 ) // if ( iguana_balancefinished(coin) < max && iguana_spendvectorsaves(coin) == 0 ) //

9
iguana/iguana_spendvectors.c

@ -56,7 +56,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
int32_t i,retval = -1; FILE *fp; char fname[1024],str[65]; long fsize; bits256 zero,sha256; int32_t i,retval = -1; FILE *fp; char fname[1024],str[65]; long fsize; bits256 zero,sha256;
if ( ptr == 0 || (bp->hdrsi != 0 && ptr == bp->ramchain.Xspendinds) ) if ( ptr == 0 || (bp->hdrsi != 0 && ptr == bp->ramchain.Xspendinds) )
{ {
//printf("iguana_spendvectorsave.[%d] ptr.%p Xspendinds\n",bp->hdrsi,ptr); printf("iguana_spendvectorsave.[%d] ptr.%p Xspendinds\n",bp->hdrsi,ptr);
return(0); return(0);
} }
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
@ -72,7 +72,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
{ {
if ( fwrite(sha256.bytes,1,sizeof(sha256),fp) != sizeof(sha256) ) if ( fwrite(sha256.bytes,1,sizeof(sha256),fp) != sizeof(sha256) )
printf("error writing hash for %d -> (%s)\n",(int32_t)(sizeof(*ptr) * emit),fname); printf("error writing hash for %d -> (%s)\n",(int32_t)(sizeof(*ptr) * emit),fname);
else if ( fwrite(ptr,sizeof(*ptr),emit,fp) != emit ) else if ( emit != 0 && fwrite(ptr,sizeof(*ptr),emit,fp) != emit )
printf("error writing %d of %d -> (%s)\n",emit,n,fname); printf("error writing %d of %d -> (%s)\n",emit,n,fname);
else else
{ {
@ -84,7 +84,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
printf("error mapping Xspendmap.(%s)\n",fname); printf("error mapping Xspendmap.(%s)\n",fname);
else else
{ {
//printf("created.(%s) %p[%d]\n",fname,bp->ramchain.Xspendinds,bp->ramchain.numXspends); printf("created.(%s) %p[%d]\n",fname,bp->ramchain.Xspendinds,bp->ramchain.numXspends);
retval = 0; retval = 0;
} }
} }
@ -93,8 +93,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
//int32_t i; for (i=0; i<ramchain->numXspends; i++) //int32_t i; for (i=0; i<ramchain->numXspends; i++)
// printf("(%d u%d) ",ramchain->Xspendinds[i].hdrsi,ramchain->Xspendinds[i].ind); // printf("(%d u%d) ",ramchain->Xspendinds[i].hdrsi,ramchain->Xspendinds[i].ind);
//printf("filesize %ld Xspendptr.%p %p num.%d\n",fsize,ramchain->Xspendptr,ramchain->Xspendinds,ramchain->numXspends); //printf("filesize %ld Xspendptr.%p %p num.%d\n",fsize,ramchain->Xspendptr,ramchain->Xspendinds,ramchain->numXspends);
} } else printf("iguana_spendvectors: Error creating.(%s)\n",fname);
else printf("iguana_spendvectors: Error creating.(%s)\n",fname);
return(retval); return(retval);
} }

Loading…
Cancel
Save