From 007489f4aaacd3f40576916e5beb1cd6989b29ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 14:59:22 +0200 Subject: [PATCH] BTCP support --- iguana/exchanges/LP_bitcoin.c | 8 ++++++-- iguana/exchanges/LP_swap.c | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 29d8d90d6..10ec14d12 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -3391,7 +3391,7 @@ int32_t iguana_rwmsgtx(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2shty bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,uint8_t *serialized,int32_t maxlen,struct iguana_msgtx *msgtx,int32_t vini,uint8_t *spendscript,int32_t spendlen,uint64_t spendamount,uint32_t hashtype,char *vpnstr,int32_t suppress_pubkeys,int32_t zcash) { - int32_t i,len,sbtcflag = 0; bits256 sigtxid,txid,revsigtxid; struct iguana_msgtx dest; + int32_t i,len,sbtcflag = 0,btcpflag=0; bits256 sigtxid,txid,revsigtxid; struct iguana_msgtx dest; dest = *msgtx; dest.vins = calloc(dest.tx_in,sizeof(*dest.vins)); dest.vouts = calloc(dest.tx_out,sizeof(*dest.vouts)); @@ -3400,6 +3400,8 @@ bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2sht memset(sigtxid.bytes,0,sizeof(sigtxid)); if ( strcmp(symbol,"SBTC") == 0 ) sbtcflag = 1; + else if ( strcmp(symbol,"BTCP") == 0 ) + btcpflag = 1; if ( ((hashtype & ~SIGHASH_FORKID) & 0xff) != SIGHASH_ALL ) { printf("currently only SIGHASH_ALL supported, not %d\n",hashtype); @@ -3434,6 +3436,8 @@ bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2sht if ( height >= BTC2_HARDFORK_HEIGHT ) hashtype |= (0x777 << 20); #endif + if ( btcpflag != 0 ) + hashtype = 0x2a41; len += iguana_rwnum(1,&serialized[len],sizeof(hashtype),&hashtype); if ( sbtcflag != 0 ) { @@ -3610,7 +3614,7 @@ uint32_t LP_sighash(char *symbol,int32_t zcash) sighash |= SIGHASH_FORKID; sighash |= (LP_IS_BITCOINGOLD << 8); } - else if ( strcmp(symbol,"SBTC") == 0 ) + else if ( strcmp(symbol,"SBTC") == 0 || strcmp(symbol,"BTCP") == 0 ) sighash |= SIGHASH_FORKID; return(sighash); } diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index ad2e9be0d..bcecd5232 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -969,10 +969,6 @@ void LP_aliceloop(void *_swap) printf("error waiting for bobpayment\n"); else { - if ( swap->I.alicetomic[0] != 0 ) - { - // artem: do stuff alice needs to do after bobpayment comes in - } LP_swap_endcritical = (uint32_t)time(NULL); while ( (n= LP_numconfirms(bobstr,swap->bobpayment.I.destaddr,swap->bobpayment.I.signedtxid,0,1)) < swap->I.bobconfirms ) {