Skip to content

Commit

Permalink
msvc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
conradoplg committed May 27, 2024
1 parent ceba7ea commit 73f28be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions depend/zcash/src/pubkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS
return secp256k1_ecdsa_verify(secp256k1_context_static, &sig, hash.begin(), &pubkey);
}

#if 0

bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned char>& vchSig) {
if (vchSig.size() != COMPACT_SIGNATURE_SIZE)
return false;
Expand Down Expand Up @@ -138,6 +140,7 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const {
out.nChild = _nChild;
return pubkey.Derive(out.pubkey, out.chaincode, _nChild, chaincode);
}
#endif

/* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) {
secp256k1_ecdsa_signature sig;
Expand All @@ -149,10 +152,13 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const {
return (!secp256k1_ecdsa_signature_normalize(secp256k1_context_static, NULL, &sig));
}

#if 0
/* static */ std::optional<CChainablePubKey> CChainablePubKey::FromParts(ChainCode chaincode, CPubKey pubkey) {
if (pubkey.IsCompressed()) {
return CChainablePubKey(chaincode, pubkey);
} else {
return std::nullopt;
}
}

#endif
6 changes: 6 additions & 0 deletions depend/zcash/src/pubkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ class CPubKey
return size() > 0;
}

#if 0
//! fully validate whether this is a valid public key (more expensive than IsValid())
bool IsFullyValid() const;
#endif

//! Check whether this is a compressed public key.
bool IsCompressed() const
Expand All @@ -193,6 +195,7 @@ class CPubKey
*/
static bool CheckLowS(const std::vector<unsigned char>& vchSig);

#if 0
//! Recover a public key from a compact signature.
bool RecoverCompact(const uint256& hash, const std::vector<unsigned char>& vchSig);

Expand All @@ -201,8 +204,10 @@ class CPubKey

//! Derive BIP32 child pubkey.
bool Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
#endif
};

#if 0
class CChainablePubKey {
private:
ChainCode chaincode;
Expand Down Expand Up @@ -303,5 +308,6 @@ struct CExtPubKey {
Decode(code);
}
};
#endif

#endif // BITCOIN_PUBKEY_H
2 changes: 1 addition & 1 deletion depend/zcash/src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ bool CallbackTransactionSignatureChecker::CheckSig(
try {
std::array<uint8_t, 32> sighashArray;
auto scriptBase = static_cast<const CScriptBase&>(scriptCode);
this->sighash(sighashArray.begin(), sighashArray.size(), this->tx, &scriptBase[0], scriptBase.size(), nHashType);
this->sighash(sighashArray.data(), sighashArray.size(), this->tx, &scriptBase[0], scriptBase.size(), nHashType);
sighash = uint256::FromRawBytes(sighashArray);
} catch (logic_error ex) {
return false;
Expand Down

0 comments on commit 73f28be

Please sign in to comment.