Changeset View
Changeset View
Standalone View
Standalone View
src/key.cpp
Show First 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | bool CKey::SignCompact(const uint256 &hash, | ||||
} | } | ||||
vchSig.resize(CPubKey::COMPACT_SIGNATURE_SIZE); | vchSig.resize(CPubKey::COMPACT_SIGNATURE_SIZE); | ||||
int rec = -1; | int rec = -1; | ||||
secp256k1_ecdsa_recoverable_signature sig; | secp256k1_ecdsa_recoverable_signature sig; | ||||
int ret = secp256k1_ecdsa_sign_recoverable( | int ret = secp256k1_ecdsa_sign_recoverable( | ||||
secp256k1_context_sign, &sig, hash.begin(), begin(), | secp256k1_context_sign, &sig, hash.begin(), begin(), | ||||
secp256k1_nonce_function_rfc6979, nullptr); | secp256k1_nonce_function_rfc6979, nullptr); | ||||
assert(ret); | assert(ret); | ||||
secp256k1_ecdsa_recoverable_signature_serialize_compact( | ret = secp256k1_ecdsa_recoverable_signature_serialize_compact( | ||||
secp256k1_context_sign, &vchSig[1], &rec, &sig); | secp256k1_context_sign, &vchSig[1], &rec, &sig); | ||||
assert(ret); | assert(ret); | ||||
assert(rec != -1); | assert(rec != -1); | ||||
vchSig[0] = 27 + rec + (fCompressed ? 4 : 0); | vchSig[0] = 27 + rec + (fCompressed ? 4 : 0); | ||||
return true; | return true; | ||||
} | } | ||||
bool CKey::Load(const CPrivKey &privkey, const CPubKey &vchPubKey, | bool CKey::Load(const CPrivKey &privkey, const CPubKey &vchPubKey, | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |