diff options
| author | liuyujun <[email protected]> | 2018-09-12 21:00:06 +0800 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-09-13 09:58:26 +0200 |
| commit | 9a565a8282236f29334a6ec2de6a03358f5ce86e (patch) | |
| tree | 9311400e5f757c09b8a5f326c79da9bf7eb27522 /src/key.cpp | |
| parent | Merge #13886: utils: run commands using utf-8 string on Windows (diff) | |
| download | discoin-9a565a8282236f29334a6ec2de6a03358f5ce86e.tar.xz discoin-9a565a8282236f29334a6ec2de6a03358f5ce86e.zip | |
Pass export privkey DER compression flag correctly
By passing a bitfield where a boolean was expected, the result was
always compressed. Fix this.
Diffstat (limited to 'src/key.cpp')
| -rw-r--r-- | src/key.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/key.cpp b/src/key.cpp index df452cd33..80d6589a3 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -89,7 +89,7 @@ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *ou * will be set to the number of bytes used in the buffer. * key32 must point to a 32-byte raw private key. */ -static int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) { +static int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, bool compressed) { assert(*privkeylen >= CKey::PRIVATE_KEY_SIZE); secp256k1_pubkey pubkey; size_t pubkeylen = 0; @@ -170,7 +170,7 @@ CPrivKey CKey::GetPrivKey() const { size_t privkeylen; privkey.resize(PRIVATE_KEY_SIZE); privkeylen = PRIVATE_KEY_SIZE; - ret = ec_privkey_export_der(secp256k1_context_sign, privkey.data(), &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED); + ret = ec_privkey_export_der(secp256k1_context_sign, privkey.data(), &privkeylen, begin(), fCompressed); assert(ret); privkey.resize(privkeylen); return privkey; |