Skip to content

Commit

Permalink
use sortedmulti (bip67)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansnigirev committed Oct 29, 2019
1 parent 35d4fb1 commit 74f19a5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/keystore/keystore.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ int keystore_get_addr(const keystore_t * key, const char * path, const network_t
return res;
}

static int pubkeys_compare(const void * pub1, const void * pub2) {
return memcmp(pub1, pub2, 33);
}

int wallet_get_scriptpubkey(const wallet_t * wallet, const uint32_t * derivation, size_t derlen, uint8_t * scriptpubkey, size_t scriptpubkey_len){
if(wallet->val == 0){ // TODO: implement for p2wpkh!
return -1;
Expand Down Expand Up @@ -206,6 +210,7 @@ int wallet_get_scriptpubkey(const wallet_t * wallet, const uint32_t * derivation
bip32_key_free(k2);
}
}
qsort(pubs, n, 33, pubkeys_compare);
size_t len = 34*n+3;
uint8_t * script = (uint8_t *)malloc(len);
size_t lenout = 0;
Expand Down

0 comments on commit 74f19a5

Please sign in to comment.