From 1f5f167f0ff867caeaeed95b1d2cb2885139b37a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 20 Jan 2018 11:46:09 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_bitcoin.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 17f979930..9f70b03cf 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -2169,7 +2169,7 @@ int32_t bitcoin_validaddress(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t return(0); } -int32_t base58encode_checkbuf(uint8_t taddr,uint8_t addrtype,uint8_t *data,int32_t data_len) +int32_t base58encode_checkbuf(char *symbol,uint8_t taddr,uint8_t addrtype,uint8_t *data,int32_t data_len) { uint8_t i,offset; bits256 hash; offset = 1 + (taddr != 0); @@ -2181,12 +2181,20 @@ int32_t base58encode_checkbuf(uint8_t taddr,uint8_t addrtype,uint8_t *data,int32 //for (i=0; i "); - hash = bits256_doublesha256(0,data,(int32_t)data_len+offset); + hash = bits256_calcaddrhash(symbol,data,(int32_t)data_len+offset); //for (i=0; i<32; i++) // printf("%02x",hash.bytes[i]); //printf(" checkhash\n"); - for (i=0; i<4; i++) - data[data_len+i+offset] = hash.bytes[31-i]; + if ( strcmp(symbol,"GRS") != 0 ) + { + for (i=0; i<4; i++) + data[data_len+i+offset] = hash.bytes[31-i]; + } + else + { + for (i=0; i<4; i++) + data[data_len+i+offset] = hash.bytes[i]; + } return(data_len + 4 + offset); } @@ -2219,7 +2227,7 @@ int32_t bitcoin_wif2priv(char *symbol,uint8_t wiftaddr,uint8_t *addrtypep,bits25 }*/ hash = bits256_calcaddrhash(symbol,ptr,len - 4); *addrtypep = (wiftaddr == 0) ? *ptr : ptr[1]; - if ( (ptr[len - 4]&0xff) == hash.bytes[31] && (ptr[len - 3]&0xff) == hash.bytes[30] &&(ptr[len - 2]&0xff) == hash.bytes[29] && (ptr[len - 1]&0xff) == hash.bytes[28] ) + if ( strcmp(symbol,"GRS") != 0 && (ptr[len - 4]&0xff) == hash.bytes[31] && (ptr[len - 3]&0xff) == hash.bytes[30] &&(ptr[len - 2]&0xff) == hash.bytes[29] && (ptr[len - 1]&0xff) == hash.bytes[28] ) { //int32_t i; for (i=0; i