|
|
@ -55,6 +55,14 @@ |
|
|
|
|
|
|
|
//auto create utxo
|
|
|
|
|
|
|
|
void revcalc_rmd160_sha256(uint8_t rmd160[20],bits256 revhash) |
|
|
|
{ |
|
|
|
bits256 hash; int32_t i; |
|
|
|
for (i=0; i<32; i++) |
|
|
|
hash.bytes[i] = revhash.bytes[31-i]; |
|
|
|
calc_rmd160_sha256(rmd160,hash.bytes,sizeof(hash)); |
|
|
|
} |
|
|
|
|
|
|
|
#define SCRIPT_OP_IF 0x63 |
|
|
|
#define SCRIPT_OP_ELSE 0x67 |
|
|
|
#define SCRIPT_OP_ENDIF 0x68 |
|
|
@ -449,7 +457,7 @@ int32_t basilisk_verify_privi(struct supernet_info *myinfo,void *ptr,uint8_t *da |
|
|
|
{ |
|
|
|
for (j=0; j<32; j++) |
|
|
|
privkey.bytes[j] = data[len++]; |
|
|
|
calc_rmd160_sha256(secret160,privkey.bytes,sizeof(privkey)); |
|
|
|
revcalc_rmd160_sha256(secret160,privkey);//.bytes,sizeof(privkey));
|
|
|
|
memcpy(&txid,secret160,sizeof(txid)); |
|
|
|
pubi = bitcoin_pubkey33(myinfo->ctx,pubkey33,privkey); |
|
|
|
if ( basilisk_verify_pubpair(&wrongfirstbyte,swap,swap->choosei,pubkey33[0],pubi,txid) == 0 ) |
|
|
@ -638,7 +646,7 @@ int32_t instantdex_pubkeyargs(struct supernet_info *myinfo,struct basilisk_swap |
|
|
|
if ( m < INSTANTDEX_DECKSIZE ) |
|
|
|
{ |
|
|
|
swap->privkeys[m] = privkey; |
|
|
|
calc_rmd160_sha256(secret160,privkey.bytes,sizeof(privkey)); |
|
|
|
revcalc_rmd160_sha256(secret160,privkey);//.bytes,sizeof(privkey));
|
|
|
|
memcpy(&txid,secret160,sizeof(txid)); |
|
|
|
len += iguana_rwnum(1,(uint8_t *)&swap->deck[m][0],sizeof(txid),&txid); |
|
|
|
len += iguana_rwnum(1,(uint8_t *)&swap->deck[m][1],sizeof(pubi.txid),&pubi.txid); |
|
|
@ -1053,7 +1061,7 @@ int32_t basilisk_verify_privkeys(struct supernet_info *myinfo,void *ptr,uint8_t |
|
|
|
if ( i != swap->choosei ) |
|
|
|
{ |
|
|
|
pubi = bitcoin_pubkey33(myinfo->ctx,otherpubkey,otherpriv); |
|
|
|
calc_rmd160_sha256(secret160,otherpriv.bytes,sizeof(otherpriv)); |
|
|
|
revcalc_rmd160_sha256(secret160,otherpriv);//.bytes,sizeof(otherpriv));
|
|
|
|
memcpy(&txid,secret160,sizeof(txid)); |
|
|
|
errs += basilisk_verify_pubpair(&wrongfirstbyte,swap,i,otherpubkey[0],pubi,txid); |
|
|
|
} |
|
|
@ -1159,7 +1167,7 @@ void basilisk_waitchoosei(struct supernet_info *myinfo,struct basilisk_swap *swa |
|
|
|
{ |
|
|
|
swap->privBn = swap->privkeys[swap->otherchoosei]; |
|
|
|
memset(&swap->privkeys[swap->otherchoosei],0,sizeof(swap->privkeys[swap->otherchoosei])); |
|
|
|
calc_rmd160_sha256(swap->secretBn,swap->privBn.bytes,sizeof(swap->privBn)); |
|
|
|
revcalc_rmd160_sha256(swap->secretBn,swap->privBn);//.bytes,sizeof(swap->privBn));
|
|
|
|
swap->pubBn = bitcoin_pubkey33(myinfo->ctx,pubkey33,swap->privBn); |
|
|
|
printf("set privBn.%s\n",bits256_str(str,swap->privBn)); |
|
|
|
} |
|
|
@ -1170,7 +1178,7 @@ void basilisk_waitchoosei(struct supernet_info *myinfo,struct basilisk_swap *swa |
|
|
|
{ |
|
|
|
swap->privAm = swap->privkeys[swap->otherchoosei]; |
|
|
|
memset(&swap->privkeys[swap->otherchoosei],0,sizeof(swap->privkeys[swap->otherchoosei])); |
|
|
|
calc_rmd160_sha256(swap->secretAm,swap->privAm.bytes,sizeof(swap->privAm)); |
|
|
|
revcalc_rmd160_sha256(swap->secretAm,swap->privAm);//.bytes,sizeof(swap->privAm));
|
|
|
|
swap->pubAm = bitcoin_pubkey33(myinfo->ctx,pubkey33,swap->privAm); |
|
|
|
printf("set privAm.%s\n",bits256_str(str,swap->privAm)); |
|
|
|
} |
|
|
|