mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Merge #13722: trivial: Replace CPubKey::operator[] with CPubKey::vch where possible
6755569840
trivial: Replace CPubKey::operator[] with CPubKey::vch where possible (Nikolay Mitev)
Pull request description:
Use variable name instead of calling operator[] through &(*this)[0]
Tree-SHA512: 7054ffda0fa33fb45d4d9f3b29698643f02fd1421d78d5197a0881f2c368dc410647fd2e1a6feb8048e30f8ab8bc2fa8749bf42b9ccbe42c30de8ff80ac45274
This commit is contained in:
commit
59407fce54
1 changed files with 4 additions and 4 deletions
|
@ -171,7 +171,7 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS
|
||||||
return false;
|
return false;
|
||||||
secp256k1_pubkey pubkey;
|
secp256k1_pubkey pubkey;
|
||||||
secp256k1_ecdsa_signature sig;
|
secp256k1_ecdsa_signature sig;
|
||||||
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
|
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, vch, size())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) {
|
if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) {
|
||||||
|
@ -207,14 +207,14 @@ bool CPubKey::IsFullyValid() const {
|
||||||
if (!IsValid())
|
if (!IsValid())
|
||||||
return false;
|
return false;
|
||||||
secp256k1_pubkey pubkey;
|
secp256k1_pubkey pubkey;
|
||||||
return secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size());
|
return secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, vch, size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPubKey::Decompress() {
|
bool CPubKey::Decompress() {
|
||||||
if (!IsValid())
|
if (!IsValid())
|
||||||
return false;
|
return false;
|
||||||
secp256k1_pubkey pubkey;
|
secp256k1_pubkey pubkey;
|
||||||
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
|
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, vch, size())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unsigned char pub[PUBLIC_KEY_SIZE];
|
unsigned char pub[PUBLIC_KEY_SIZE];
|
||||||
|
@ -232,7 +232,7 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChi
|
||||||
BIP32Hash(cc, nChild, *begin(), begin()+1, out);
|
BIP32Hash(cc, nChild, *begin(), begin()+1, out);
|
||||||
memcpy(ccChild.begin(), out+32, 32);
|
memcpy(ccChild.begin(), out+32, 32);
|
||||||
secp256k1_pubkey pubkey;
|
secp256k1_pubkey pubkey;
|
||||||
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
|
if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, vch, size())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!secp256k1_ec_pubkey_tweak_add(secp256k1_context_verify, &pubkey, out)) {
|
if (!secp256k1_ec_pubkey_tweak_add(secp256k1_context_verify, &pubkey, out)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue