Exemplo n.º 1
0
bool TransactionSignatureChecker::RecoverPubKey(const std::vector<unsigned char>& vchSigIn, std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const
{
        int nHashType = vchSigIn.back();
    uint256 sighash = SignatureHash(scriptCode, *txTo, nIn, nHashType);
    CPubKey rPubKey;
    std::vector<unsigned char> vchSigCompact;
        vchSigCompact = vchSigIn;
    vchSigCompact.resize(65);
    if(!rPubKey.RecoverCompact(sighash,vchSigCompact))
        return false;
    
    vchPubKey = rPubKey.GetChar();
    return true;
}