10 static bool GetKeyIDFromUTXO(
const CTxOut& utxo,
CKeyID& keyIDRet)
12 std::vector<valtype> vSolutions;
34 return error(
"%s: failed to sign block hash with key", __func__);
42 if (!GetKeyIDFromUTXO(block.
vtx[1]->vout[1], keyID)) {
43 return error(
"%s: failed to find key for PoS", __func__);
47 if (!keystore.
GetKey(keyID, key))
48 return error(
"%s: failed to get key from keystore", __func__);
59 return error(
"%s: vchBlockSig is empty!", __func__);
66 bool fzPIVStake = block.
vtx[1]->vin[0].IsZerocoinSpend();
72 std::vector<valtype> vSolutions;
73 const CTxOut& txout = block.
vtx[1]->vout[1];
78 valtype& vchPubKey = vSolutions[0];
81 const CTxIn& txin = block.
vtx[1]->vin[0];
95 const CTxIn& txin = block.
vtx[1]->vin[0];
105 return error(
"%s: invalid pubkey %s", __func__,
HexStr(pubkey));
bool SignBlock(CBlock &block, const CKeyStore &keystore)
bool CheckBlockSignature(const CBlock &block)
bool SignBlockWithKey(CBlock &block, const CKey &key)
std::vector< CTransactionRef > vtx
std::vector< unsigned char > vchBlockSig
bool IsProofOfWork() const
A reference to a CKey: the Hash160 of its serialized public key, special case for exchange key.
An encapsulated private key.
bool Sign(const uint256 &hash, std::vector< unsigned char > &vchSig, uint32_t test_case=0) const
Create a DER-serialized signature.
A reference to a CKey: the Hash160 of its serialized public key.
A virtual base class for key stores.
virtual bool GetKey(const CKeyID &address, CKey &keyOut) const =0
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
bool Verify(const uint256 &hash, const std::vector< unsigned char > &vchSig) const
Verify a DER signature (~72 bytes).
An input of a transaction.
An output of a transaction.
The complete proof needed to spend a zerocoin.
CPubKey getPubKey() const
std::vector< unsigned char > valtype
libzerocoin::CoinSpend TxInToZerocoinSpend(const CTxIn &txin)
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
bool error(const char *fmt, const Args &... args)
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.