Browse Source

BCH signing SIGHASH_FORKID

etomic
jl777 7 years ago
parent
commit
cc391580df
  1. 4
      iguana/exchanges/LP_bitcoin.c
  2. 4
      iguana/exchanges/LP_coins.c
  3. 4
      iguana/exchanges/LP_include.h

4
iguana/exchanges/LP_bitcoin.c

@ -3279,6 +3279,8 @@ bits256 bitcoin_sigtxid(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t i
if ( height >= BTC2_HARDFORK_HEIGHT ) if ( height >= BTC2_HARDFORK_HEIGHT )
hashtype |= (0x777 << 20); hashtype |= (0x777 << 20);
#endif #endif
if ( zcash == LP_IS_BITCOINCASH )
hashtype |= SIGHASH_FORKID;
len += iguana_rwnum(1,&serialized[len],sizeof(hashtype),&hashtype); len += iguana_rwnum(1,&serialized[len],sizeof(hashtype),&hashtype);
revsigtxid = bits256_doublesha256(0,serialized,len); revsigtxid = bits256_doublesha256(0,serialized,len);
for (i=0; i<sizeof(revsigtxid); i++) for (i=0; i<sizeof(revsigtxid); i++)
@ -3407,7 +3409,7 @@ int32_t iguana_rwmsgtx(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t is
} }
len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->lock_time),&msg->lock_time); len += iguana_rwnum(rwflag,&serialized[len],sizeof(msg->lock_time),&msg->lock_time);
//printf("lock_time.%08x len.%d\n",msg->lock_time,len); //printf("lock_time.%08x len.%d\n",msg->lock_time,len);
if ( zcash != 0 && msg->version > 1 ) if ( zcash == LP_IS_ZCASHPROTOCOL && msg->version > 1 )
{ {
uint32_t numjoinsplits; struct iguana_msgjoinsplit joinsplit; uint8_t joinsplitpubkey[33],joinsplitsig[64]; uint32_t numjoinsplits; struct iguana_msgjoinsplit joinsplit; uint8_t joinsplitpubkey[33],joinsplitsig[64];
len += iguana_rwvarint32(rwflag,&serialized[len],&numjoinsplits); len += iguana_rwvarint32(rwflag,&serialized[len],&numjoinsplits);

4
iguana/exchanges/LP_coins.c

@ -333,7 +333,9 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse
#endif #endif
sprintf(coin->serverport,"127.0.0.1:%u",port); sprintf(coin->serverport,"127.0.0.1:%u",port);
if ( strcmp(symbol,"KMD") == 0 || coin->isassetchain != 0 || taddr != 0 ) if ( strcmp(symbol,"KMD") == 0 || coin->isassetchain != 0 || taddr != 0 )
coin->zcash = 1; coin->zcash = LP_IS_ZCASHPROTOCOL;
else if ( strcmp(symbol,"BCH") == 0 )
coin->zcash = LP_IS_BITCOINCASH;
return(port); return(port);
} }

4
iguana/exchanges/LP_include.h

@ -90,6 +90,10 @@ void emscripten_usleep(int32_t x);
#define DEX_SLEEP 3 #define DEX_SLEEP 3
#define BASILISK_KEYSIZE ((int32_t)(2*sizeof(bits256)+sizeof(uint32_t)*2)) #define BASILISK_KEYSIZE ((int32_t)(2*sizeof(bits256)+sizeof(uint32_t)*2))
#define LP_IS_ZCASHPROTOCOL 1
#define LP_IS_BITCOINCASH 2
#define SIGHASH_FORKID 0x40
#define ZKSNARK_PROOF_SIZE 296 #define ZKSNARK_PROOF_SIZE 296
#define ZCASH_SOLUTION_ELEMENTS 1344 #define ZCASH_SOLUTION_ELEMENTS 1344

Loading…
Cancel
Save