Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
bb264537ee
  1. 2
      iguana/iguana777.h
  2. 15
      iguana/iguana_instantdex.c
  3. 17
      iguana/swaps/iguana_BTCswap.c

2
iguana/iguana777.h

@ -992,7 +992,7 @@ char *iguana_pollrawtx(queue_t *Q,cJSON **vinsp,uint32_t rawtxtag,double expirat
bits256 scrypt_blockhash(const void *input); bits256 scrypt_blockhash(const void *input);
bits256 iguana_calcblockhash(int32_t (*hashalgo)(uint8_t *blockhashp,uint8_t *serialized,int32_t len),uint8_t *serialized,int32_t len); bits256 iguana_calcblockhash(int32_t (*hashalgo)(uint8_t *blockhashp,uint8_t *serialized,int32_t len),uint8_t *serialized,int32_t len);
uint32_t iguana_targetbits(struct iguana_info *coin,struct iguana_block *hwmchain,struct iguana_block *prev,struct iguana_block *prev2,int32_t PoSflag); uint32_t iguana_targetbits(struct iguana_info *coin,struct iguana_block *hwmchain,struct iguana_block *prev,struct iguana_block *prev2,int32_t PoSflag);
struct bitcoin_eventitem *instantdex_event(char *cmdstr,cJSON *newjson,cJSON *argjson,uint8_t *serdata,int32_t serdatalen); struct bitcoin_eventitem *instantdex_event(char *cmdstr,cJSON *argjson,cJSON *newjson,uint8_t *serdata,int32_t serdatalen);
void instantdex_eventfree(struct bitcoin_eventitem *ptr); void instantdex_eventfree(struct bitcoin_eventitem *ptr);
extern int32_t HDRnet,netBLOCKS; extern int32_t HDRnet,netBLOCKS;

15
iguana/iguana_instantdex.c

@ -1181,21 +1181,6 @@ struct bitcoin_swapinfo *bitcoin_swapinit(struct supernet_info *myinfo,struct ex
return(swap); return(swap);
} }
struct bitcoin_eventitem *instantdex_event(char *cmdstr,cJSON *argjson,cJSON *newjson,uint8_t *serdata,int32_t serdatalen)
{
struct bitcoin_eventitem *ptr;
ptr = calloc(1,sizeof(*ptr) + serdatalen);
strcpy(ptr->cmd,cmdstr);
ptr->newjson = jduplicate(newjson);
ptr->argjson = jduplicate(argjson);
if ( serdatalen != 0 )
{
memcpy(ptr->serdata,serdata,serdatalen);
ptr->serdatalen = serdatalen;
}
return(ptr);
}
char *instantdex_checkoffer(struct supernet_info *myinfo,int32_t *addedp,uint64_t *txidp,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson) char *instantdex_checkoffer(struct supernet_info *myinfo,int32_t *addedp,uint64_t *txidp,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson)
{ {
struct instantdex_accept *otherap,*tmp; struct bitcoin_swapinfo *swap; cJSON *newjson; int32_t isbob = 0; char *retstr = 0; struct instantdex_accept *otherap,*tmp; struct bitcoin_swapinfo *swap; cJSON *newjson; int32_t isbob = 0; char *retstr = 0;

17
iguana/swaps/iguana_BTCswap.c

@ -670,6 +670,7 @@ cJSON *BOB_waitfeefunc(struct supernet_info *myinfo,struct exchange_info *exchan
coinbtc = iguana_coinfind("BTC"); coinbtc = iguana_coinfind("BTC");
*serdatap = 0, *serdatalenp = 0; *serdatap = 0, *serdatalenp = 0;
strcpy(swap->waitfortx,"fee"); strcpy(swap->waitfortx,"fee");
printf("BOB wait other.%p\n",swap->otherfee);
if ( coinbtc != 0 && swap->otherfee != 0 )//swap->deposit == 0 && (retstr= BTC_txconfirmed(myinfo,coinbtc,swap,newjson,swap->otherfee->txid,&swap->otherfee->numconfirms,"feefound",0)) != 0 ) if ( coinbtc != 0 && swap->otherfee != 0 )//swap->deposit == 0 && (retstr= BTC_txconfirmed(myinfo,coinbtc,swap,newjson,swap->otherfee->txid,&swap->otherfee->numconfirms,"feefound",0)) != 0 )
{ {
retstr = swap->otherfee->txbytes; retstr = swap->otherfee->txbytes;
@ -745,6 +746,7 @@ cJSON *ALICE_waitfeefunc(struct supernet_info *myinfo,struct exchange_info *exch
coinbtc = iguana_coinfind("BTC"); coinbtc = iguana_coinfind("BTC");
*serdatap = 0, *serdatalenp = 0; *serdatap = 0, *serdatalenp = 0;
strcpy(swap->waitfortx,"fee"); strcpy(swap->waitfortx,"fee");
printf("ALICE wait other.%p\n",swap->otherfee);
if ( coinbtc != 0 && swap->otherfee != 0 )//&& (retstr= BTC_txconfirmed(myinfo,coinbtc,swap,newjson,swap->otherfee->txid,&swap->otherfee->numconfirms,"feefound",0)) != 0 ) if ( coinbtc != 0 && swap->otherfee != 0 )//&& (retstr= BTC_txconfirmed(myinfo,coinbtc,swap,newjson,swap->otherfee->txid,&swap->otherfee->numconfirms,"feefound",0)) != 0 )
{ {
retstr = swap->otherfee->txbytes; retstr = swap->otherfee->txbytes;
@ -1017,6 +1019,21 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n)
return(s); return(s);
} }
struct bitcoin_eventitem *instantdex_event(char *cmdstr,cJSON *argjson,cJSON *newjson,uint8_t *serdata,int32_t serdatalen)
{
struct bitcoin_eventitem *ptr;
ptr = calloc(1,sizeof(*ptr) + serdatalen);
strcpy(ptr->cmd,cmdstr);
ptr->newjson = jduplicate(newjson);
ptr->argjson = jduplicate(argjson);
if ( serdatalen != 0 )
{
memcpy(ptr->serdata,serdata,serdatalen);
ptr->serdatalen = serdatalen;
}
return(ptr);
}
void instantdex_eventfree(struct bitcoin_eventitem *ptr) void instantdex_eventfree(struct bitcoin_eventitem *ptr)
{ {
if ( ptr != 0 ) if ( ptr != 0 )

Loading…
Cancel
Save