Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
152fcbb181
  1. 10
      basilisk/basilisk_swap.c
  2. 9
      iguana/iguana_realtime.c
  3. 4
      iguana/iguana_recv.c
  4. 5
      iguana/iguana_sign.c

10
basilisk/basilisk_swap.c

@ -53,7 +53,7 @@
Alice timeout event is triggered if INSTANTDEX_LOCKTIME elapses from the start of a FSM instance. Bob timeout event is triggered after INSTANTDEX_LOCKTIME*2
*/
//#define BASILISK_DISABLETX
#define BASILISK_DISABLETX
#define SCRIPT_OP_IF 0x63
#define SCRIPT_OP_ELSE 0x67
#define SCRIPT_OP_ENDIF 0x68
@ -204,14 +204,16 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,struct basilisk_swap *s
V.suppress_pubkeys = dest->suppress_pubkeys;
if ( dest->redeemlen != 0 )
memcpy(V.p2shscript,dest->redeemscript,dest->redeemlen), V.p2shlen = dest->redeemlen;
txobj = bitcoin_txcreate(rawtx->coin->chain->isPoS,locktime,rawtx->coin->chain->locktime_txversion);
vins = cJSON_CreateArray();
item = cJSON_CreateObject();
if ( userdata != 0 && userdatalen > 0 )
{
memcpy(V.userdata,userdata,userdatalen);
V.userdatalen = userdatalen;
init_hexbytes_noT(hexstr,userdata,userdatalen);
jaddstr(item,"suffix",hexstr);
}
txobj = bitcoin_txcreate(rawtx->coin->chain->isPoS,locktime,rawtx->coin->chain->locktime_txversion);
vins = cJSON_CreateArray();
item = cJSON_CreateObject();
if ( bits256_nonz(rawtx->actualtxid) != 0 )
jaddbits256(item,"txid",rawtx->actualtxid);
else jaddbits256(item,"txid",rawtx->signedtxid);

9
iguana/iguana_realtime.c

@ -225,18 +225,21 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
usleep(100000);
return(0);
}
portable_mutex_lock(&coin->RTmutex);
for (i=0; i<coin->bundlescount-1; i++)
{
if ( (bp= coin->bundles[i]) != 0 && (i > 0 && bp->utxofinish == 0) && bp != coin->current )
{
if ( iguana_spendvectors(myinfo,coin,bp,&bp->ramchain,0,bp->n,0,0) < 0 )
{
portable_mutex_unlock(&coin->RTmutex);
printf("error generating spendvectors.[%d], skipping\n",i);
return(0);
} // else printf("generated UTXO.[%d]\n",i);
coin->spendvectorsaved = 1;
}
}
portable_mutex_unlock(&coin->RTmutex);
bp = coin->current;
if ( bp == 0 || iguana_validated(coin) < bp->hdrsi )
{
@ -347,7 +350,9 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
//printf("RTgenesis verified\n");
if ( (coin->RTheight % coin->chain->bundlesize) > 3 )
{
portable_mutex_lock(&coin->RTmutex);
iguana_RTspendvectors(myinfo,coin,bp);
portable_mutex_unlock(&coin->RTmutex);
coin->RTgenesis = (uint32_t)time(NULL);
}
}
@ -362,6 +367,8 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
if ( coin->RTdatabad != 0 )
{
bits256 lastbundle;
portable_mutex_lock(&coin->RTmutex);
printf("START DATABAD fixing\n");
iguana_RTramchainfree(coin,bp);
if ( coin->RTdatabad < 0 )
{
@ -379,6 +386,8 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
myfree(ptr,(bp->n+1)*sizeof(*bp->speculative));
}
iguana_RTramchainalloc("RTbundle",coin,bp);
printf("DONE DATABAD fixing\n");
portable_mutex_unlock(&coin->RTmutex);
}
return(flag);
}

4
iguana/iguana_recv.c

@ -1641,13 +1641,14 @@ int32_t iguana_processrecv(struct supernet_info *myinfo,struct iguana_info *coin
{
int32_t i,newhwm = 0,hwmheight,flag = 0; char str[2000];
hwmheight = coin->blocks.hwmchain.height;
portable_mutex_lock(&coin->RTmutex);
coin->RTramchain_busy = 1;
if ( coin->balanceflush != 0 )
{
fprintf(stderr,"%s call balanceflush\n",coin->symbol);
portable_mutex_lock(&coin->RTmutex);
if ( iguana_balanceflush(coin,coin->balanceflush) > 0 )
printf("balanceswritten.%d flushed coin->balanceflush %d vs %d coin->longestchain/coin->chain->bundlesize\n",coin->balanceswritten,coin->balanceflush,coin->longestchain/coin->chain->bundlesize);
portable_mutex_unlock(&coin->RTmutex);
fprintf(stderr,"%s back balanceflush\n",coin->symbol);
coin->balanceflush = 0;
}
@ -1676,7 +1677,6 @@ int32_t iguana_processrecv(struct supernet_info *myinfo,struct iguana_info *coin
}
}
coin->RTramchain_busy = 0;//(coin->RTgenesis == 0);
portable_mutex_unlock(&coin->RTmutex);
flag += iguana_process_msgrequestQ(myinfo,coin);
//if ( strcmp("BTCD",coin->symbol) == 0 )
// instantdex_update(SuperNET_MYINFO(0));

5
iguana/iguana_sign.c

@ -120,6 +120,11 @@ cJSON *iguana_vinjson(struct iguana_info *coin,struct iguana_msgvin *vin,bits256
iguana_addscript(coin,json,vin->spendscript,vin->spendlen,"scriptPubKey");
if ( vin->p2shlen > 0 )
iguana_addscript(coin,json,vin->redeemscript,vin->p2shlen,"redeemScript");
if ( vin->suffixlen > 0 )
{
iguana_addscript(coin,json,&vin->redeemscript[vin->p2shlen],vin->suffixlen,"suffix");
vin->p2shlen += vin->suffixlen;
}
}
return(json);
}

Loading…
Cancel
Save