Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0fb6ca1
[Core] Define STAKING_ADDRESS addresses
random-zebra Jul 4, 2019
6ec51f4
[Script] Define OP_CHECKCOLDSTAKEVERIFY opcode behaviour
random-zebra Jul 4, 2019
c7d1934
[Core] define TX_COLDSTAKE standard and P2CS script
random-zebra Jul 4, 2019
f6bba23
[Wallet] Get ColdStaking/Delegated balance
random-zebra Jul 5, 2019
b709748
[RPC] define: getnewstakingaddress, delegatestake, rawdelegatestake
random-zebra Jul 4, 2019
97b6332
[RPC/Wallet] fix IsMine filters and add option to include delegated
random-zebra Jul 5, 2019
e8abd21
[Cleanup] Remove re-declaration of EnsureWalletIsUnlocked in rpcdump
random-zebra Jul 5, 2019
dea30c7
[Script] Define IsPayToColdStaking() fast test
random-zebra Jul 5, 2019
ca90d02
[Script] Sign P2CS scripts
random-zebra Jul 5, 2019
e19bfa4
[Wallet] Add flag 'fStakeDelegationVoided' to tx when P2PC gets spent
random-zebra Jul 5, 2019
8ac0ed3
[Script] Add fColdStake to ExtractDestination
random-zebra Jul 5, 2019
cdb758b
[RPC] define getcoldstakingbalance
random-zebra Jul 5, 2019
f30c299
[Wallet] Use cold inputs to stake
random-zebra Jul 11, 2019
661083d
[Core] Sign block with staking key if coinstake is 'cold' stake
random-zebra Jul 8, 2019
92515c3
[Core] add main P2CS check in CheckTransaction
random-zebra Jul 8, 2019
e546ec6
[Core][Tests] REGTEST: fix nStakeModifier
random-zebra Jul 10, 2019
bff6c9e
[RPC] signrawtransaction: select proper key for 'cold' inputs
random-zebra Jul 10, 2019
1d69ef3
[Wallet] Add -coldstaking flag to enable/disable feature
random-zebra Jul 12, 2019
4064423
[Consensus] ColdStaking enforcement
random-zebra Jul 12, 2019
8bc0893
[Wallet/DB] Add Delegators-whitelist protection for cold staker
random-zebra Jul 12, 2019
8b56c33
[RPC] define: delegatoradd, delegatorremove
random-zebra Jul 12, 2019
1d071f4
[Tests] Add Cold Staking functional testing
random-zebra Jul 10, 2019
c5de40f
[Cleanup] Fix linter
random-zebra Jul 18, 2019
6c1d399
[Trivial] Fix spelling in delegatorremove RPC help
random-zebra Jul 19, 2019
ad6bee1
[Wallet][DB] Refactor Delegator whitelist as AddressBook entry
random-zebra Jul 29, 2019
6e28ec1
[Core] prevent abuse on mn output when spork 8 is disabled
random-zebra Jul 29, 2019
c723ab6
[Core] Add threshold for P2CS value (hardcoded to 10 PIV)
random-zebra Jul 29, 2019
374a78c
[Tests] Fix Script UnitTests data
random-zebra Aug 3, 2019
0f09fce
[Core] Init CBitcoinAddress and Visitor with base58 prefix instead of…
random-zebra Aug 6, 2019
61e9d6e
[Consensus] Fix output index in CheckColdStake()
random-zebra Aug 6, 2019
9c8a656
[Wallet] Speed up ColdStaking and Delegated balance computation
random-zebra Aug 6, 2019
f20e1a6
[RPC] CreateColdStakeDelegation move checks before creating address
random-zebra Aug 6, 2019
e67c152
[Cleanup] minor styling in standard.cpp and remove fStakeDelegationVo…
random-zebra Aug 6, 2019
2a5bae7
[Script] Guard against GetPubKey() failures in Solver()
random-zebra Aug 6, 2019
75b8861
[Script] Unify OP_CHECKCOLDSTAKEVERIFY checks
random-zebra Aug 7, 2019
618afdb
[Tests] Additional case for Cold Staking functional test
random-zebra Aug 7, 2019
7ce9432
[Tests] Fix coldstaking functional test
random-zebra Sep 4, 2019
5383f52
[Fix] MintableCoins include cold staking balance
random-zebra Oct 2, 2019
f771f86
[Trivial] define GetSakingBalance and update it in miner
random-zebra Oct 2, 2019
4000b6e
[RPC] Define listcoldutxos function
random-zebra Oct 2, 2019
968931e
[RPC] listcoldutxos: fix staking addresses base58 prefix
random-zebra Oct 2, 2019
5209c3f
[DB] Fix unserialization check for cold staking txes
random-zebra Oct 2, 2019
87327fc
[RPC] listcoldutxos: include only final, trusted, unspent coins
random-zebra Oct 2, 2019
f7f7119
[Trivial][RPC] Fix delegatoradd help text and remove extra arg fRescan
random-zebra Oct 6, 2019
d81ecdc
[Wallet] don't include P2CS in SelectStakeCoins if CS is not enabled
random-zebra Oct 7, 2019
b20bc52
[RPC] define getdelegatedbalance
random-zebra Oct 14, 2019
2f246d2
[Wallet] fix IsValid and validateaddress for Staking Addresses
random-zebra Oct 14, 2019
23ecdee
[RPC] define listdelegators
random-zebra Oct 14, 2019
16fa605
[RPC] define liststakingaddresses
random-zebra Oct 14, 2019
b33c6bc
[Wallet] define GetColdStakingDebit and GetStakeDelegationDebit
random-zebra Oct 14, 2019
436f383
[Wallet] Add fUnspent flag to GetCredit
random-zebra Jul 12, 2019
bf27e84
[Wallet] Stop duplicating cached amount update. Single method doing i…
furszy Oct 2, 2019
80678b7
[Wallet][Refactor] Inline getDebit/getCredit if else in updateAmount …
furszy Oct 15, 2019
6cadfea
[Wallet] Add fStakeDelegation voided in-memory flag
random-zebra Oct 16, 2019
620bc19
[Bug] Fix isMine type in GetColdStakingDebit
random-zebra Oct 18, 2019
244feca
[Wallet] Fix spending P2CS delegations with coin control
random-zebra Oct 15, 2019
3bfc380
[Tests] Speed up feature_coldStaking + check 'listcoldutxos'
random-zebra Oct 19, 2019
255d757
[Core] Add CheckColdStakeFreeOutput function
random-zebra Oct 21, 2019
e498a06
[Core] Cold Staking: lower dust threshold to 1 PIV
random-zebra Oct 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions src/base58.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,24 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
{
private:
CBitcoinAddress* addr;
CChainParams::Base58Type type;

Comment thread
random-zebra marked this conversation as resolved.
Outdated
public:
CBitcoinAddressVisitor(CBitcoinAddress* addrIn) : addr(addrIn) {}
CBitcoinAddressVisitor(CBitcoinAddress* addrIn,
const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS) :
addr(addrIn),
type(addrType){};

bool operator()(const CKeyID& id) const { return addr->Set(id); }
bool operator()(const CKeyID& id) const { return addr->Set(id, type); }
bool operator()(const CScriptID& id) const { return addr->Set(id); }
bool operator()(const CNoDestination& no) const { return false; }
};

} // anon namespace

bool CBitcoinAddress::Set(const CKeyID& id)
bool CBitcoinAddress::Set(const CKeyID& id, const CChainParams::Base58Type addrType)
{
SetData(Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS), &id, 20);
SetData(Params().Base58Prefix(addrType), &id, 20);
return true;
}

Expand All @@ -247,9 +251,9 @@ bool CBitcoinAddress::Set(const CScriptID& id)
return true;
}

bool CBitcoinAddress::Set(const CTxDestination& dest)
bool CBitcoinAddress::Set(const CTxDestination& dest, const CChainParams::Base58Type addrType)
{
return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
return boost::apply_visitor(CBitcoinAddressVisitor(this, addrType), dest);
}

bool CBitcoinAddress::IsValid() const
Expand All @@ -261,7 +265,8 @@ bool CBitcoinAddress::IsValid(const CChainParams& params) const
{
bool fCorrectSize = vchData.size() == 20;
bool fKnownVersion = vchVersion == params.Base58Prefix(CChainParams::PUBKEY_ADDRESS) ||
vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS) ||
vchVersion == params.Base58Prefix(CChainParams::STAKING_ADDRESS);
return fCorrectSize && fKnownVersion;
}

Expand All @@ -271,7 +276,8 @@ CTxDestination CBitcoinAddress::Get() const
return CNoDestination();
uint160 id;
memcpy(&id, &vchData[0], 20);
if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS) ||
vchVersion == Params().Base58Prefix(CChainParams::STAKING_ADDRESS))
return CKeyID(id);
else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
return CScriptID(id);
Expand All @@ -281,7 +287,9 @@ CTxDestination CBitcoinAddress::Get() const

bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
{
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
if (!IsValid() ||
(vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS) &&
vchVersion != Params().Base58Prefix(CChainParams::STAKING_ADDRESS)))
return false;
uint160 id;
memcpy(&id, &vchData[0], 20);
Expand All @@ -291,7 +299,14 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const

bool CBitcoinAddress::IsScript() const
{
return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);
bool fCorrectSize = vchData.size() == 20;
return fCorrectSize && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);
}

bool CBitcoinAddress::IsStakingAddress() const
{
bool fCorrectSize = vchData.size() == 20;
return fCorrectSize && vchVersion == Params().Base58Prefix(CChainParams::STAKING_ADDRESS);
}

void CBitcoinSecret::SetKey(const CKey& vchSecret)
Expand Down
7 changes: 4 additions & 3 deletions src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,21 @@ class CBase58Data
class CBitcoinAddress : public CBase58Data
{
public:
bool Set(const CKeyID& id);
bool Set(const CKeyID& id, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
bool Set(const CScriptID& id);
bool Set(const CTxDestination& dest);
bool Set(const CTxDestination& dest, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS);
bool IsValid() const;
bool IsValid(const CChainParams& params) const;

CBitcoinAddress() {}
CBitcoinAddress(const CTxDestination& dest) { Set(dest); }
CBitcoinAddress(const CTxDestination& dest, const CChainParams::Base58Type addrType = CChainParams::PUBKEY_ADDRESS) { Set(dest, addrType); }
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }

CTxDestination Get() const;
bool GetKeyID(CKeyID& keyID) const;
bool IsScript() const;
bool IsStakingAddress() const;
};

/**
Expand Down
10 changes: 9 additions & 1 deletion src/blocksignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ bool GetKeyIDFromUTXO(const CTxOut& txout, CKeyID& keyID)
return false;
if (whichType == TX_PUBKEY) {
keyID = CPubKey(vSolutions[0]).GetID();
} else if (whichType == TX_PUBKEYHASH) {
} else if (whichType == TX_PUBKEYHASH || whichType == TX_COLDSTAKE) {
keyID = CKeyID(uint160(vSolutions[0]));
} else {
return false;
}

return true;
Expand Down Expand Up @@ -80,6 +82,12 @@ bool CheckBlockSignature(const CBlock& block)
if (whichType == TX_PUBKEY || whichType == TX_PUBKEYHASH) {
valtype& vchPubKey = vSolutions[0];
pubkey = CPubKey(vchPubKey);
} else if (whichType == TX_COLDSTAKE) {
// pick the public key from the P2CS input
const CTxIn& txin = block.vtx[1].vin[0];
int start = 1 + (int) *txin.scriptSig.begin(); // skip sig
start += 1 + (int) *(txin.scriptSig.begin()+start); // skip flag
pubkey = CPubKey(txin.scriptSig.begin()+start+1, txin.scriptSig.end());
}
}

Expand Down
22 changes: 20 additions & 2 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ libzerocoin::ZerocoinParams* CChainParams::Zerocoin_Params(bool useModulusV1) co
bool CChainParams::HasStakeMinAgeOrDepth(const int contextHeight, const uint32_t contextTime,
const int utxoFromBlockHeight, const uint32_t utxoFromBlockTime) const
{
if (NetworkID() == CBaseChainParams::REGTEST)
return true;

// before stake modifier V2, the age required was 60 * 60 (1 hour) / not required on regtest
if (!IsStakeModifierV2(contextHeight))
return (NetworkID() == CBaseChainParams::REGTEST || (utxoFromBlockTime + 3600 <= contextTime));
return (utxoFromBlockTime + 3600 <= contextTime);

// after stake modifier V2, we require the utxo to be nStakeMinDepth deep in the chain
return (contextHeight - utxoFromBlockHeight >= nStakeMinDepth);
Expand Down Expand Up @@ -168,6 +171,7 @@ class CMainParams : public CChainParams
nFutureTimeDriftPoS = 180;
nMasternodeCountDrift = 20;
nMaxMoneyOut = 21000000 * COIN;
nMinColdStakingAmount = 1 * COIN;

/** Height or Time Based Activations **/
nLastPOWBlock = 259200;
Expand All @@ -187,6 +191,7 @@ class CMainParams : public CChainParams
nEnforceNewSporkKey = 1566860400; //!> Sporks signed after Monday, August 26, 2019 11:00:00 PM GMT must use the new spork key
nRejectOldSporkKey = 1569538800; //!> Fully reject old spork key after Thursday, September 26, 2019 11:00:00 PM GMT
nBlockStakeModifierlV2 = 1967000;

// Public coin spend enforcement
nPublicZCSpends = 1880000;
nPublicZCSpendsV4 = 2880000;
Expand All @@ -198,6 +203,9 @@ class CMainParams : public CChainParams
nFakeSerialBlockheightEnd = 1686229;
nSupplyBeforeFakeSerial = 4131563 * COIN; // zerocoin supply at block nFakeSerialBlockheightEnd

// Cold Staking enforcement
nColdStakingStart = 2880000;

/**
* Build the genesis block. Note that the output of the genesis coinbase cannot
* be spent as it did not originally exist in the database.
Expand Down Expand Up @@ -233,10 +241,11 @@ class CMainParams : public CChainParams

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 30);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 13);
base58Prefixes[STAKING_ADDRESS] = std::vector<unsigned char>(1, 63); // starting with 'S'
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 212);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x02)(0x2D)(0x25)(0x33).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x02)(0x21)(0x31)(0x2B).convert_to_container<std::vector<unsigned char> >();
// BIP44 coin type is from https://github.com/satoshilabs/slips/blob/master/slip-0044.md
// BIP44 coin type is from https://github.com/satoshilabs/slips/blob/master/slip-0044.md
base58Prefixes[EXT_COIN_TYPE] = boost::assign::list_of(0x80)(0x00)(0x00)(0x77).convert_to_container<std::vector<unsigned char> >();

convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));
Expand Down Expand Up @@ -326,6 +335,7 @@ class CTestNetParams : public CMainParams
nEnforceNewSporkKey = 1566860400; //!> Sporks signed after Monday, August 26, 2019 11:00:00 PM GMT must use the new spork key
nRejectOldSporkKey = 1569538800; //!> Reject old spork key after Thursday, September 26, 2019 11:00:00 PM GMT
nBlockStakeModifierlV2 = 1214000;

// Public coin spend enforcement
nPublicZCSpends = 1106100;
nPublicZCSpendsV4 = 2106100;
Expand All @@ -337,6 +347,9 @@ class CTestNetParams : public CMainParams
nFakeSerialBlockheightEnd = -1;
nSupplyBeforeFakeSerial = 0;

// Cold Staking enforcement
nColdStakingStart = 2106100;

//! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1454124731;
genesis.nNonce = 2402015;
Expand All @@ -352,6 +365,7 @@ class CTestNetParams : public CMainParams

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 139); // Testnet pivx addresses start with 'x' or 'y'
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 19); // Testnet pivx script addresses start with '8' or '9'
base58Prefixes[STAKING_ADDRESS] = std::vector<unsigned char>(1, 73); // starting with 'W'
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 239); // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
// Testnet pivx BIP32 pubkeys start with 'DRKV'
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x3a)(0x80)(0x61)(0xa0).convert_to_container<std::vector<unsigned char> >();
Expand Down Expand Up @@ -423,6 +437,7 @@ class CRegTestParams : public CTestNetParams
nBlockFirstFraudulent = 999999999; //First block that bad serials emerged
nBlockLastGoodCheckpoint = 999999999; //Last valid accumulator checkpoint
nBlockStakeModifierlV2 = std::numeric_limits<int>::max(); // max integer value (never switch on regtest)

// Public coin spend enforcement
nPublicZCSpends = 350;
nPublicZCSpendsV4 = 450;
Expand All @@ -433,6 +448,9 @@ class CRegTestParams : public CTestNetParams
// Fake Serial Attack
nFakeSerialBlockheightEnd = -1;

// Cold Staking enforcement
nColdStakingStart = 251;

//! Modify the regtest genesis block so the timestamp is valid for a later start.
genesis.nTime = 1454124731;
genesis.nNonce = 2402015;
Expand Down
7 changes: 7 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CChainParams
EXT_PUBLIC_KEY, // BIP32
EXT_SECRET_KEY, // BIP32
EXT_COIN_TYPE, // BIP44
STAKING_ADDRESS,

MAX_BASE58_TYPES
};
Expand Down Expand Up @@ -103,6 +104,8 @@ class CChainParams
int GetBudgetCycleBlocks() const { return nBudgetCycleBlocks; }
int64_t GetProposalEstablishmentTime() const { return nProposalEstablishmentTime; }

CAmount GetMinColdStakingAmount() const { return nMinColdStakingAmount; }

/** Spork key and Masternode Handling **/
std::string SporkPubKey() const { return strSporkPubKey; }
std::string SporkPubKeyOld() const { return strSporkPubKeyOld; }
Expand Down Expand Up @@ -142,6 +145,8 @@ class CChainParams
bool IsStakeModifierV2(const int nHeight) const { return nHeight >= nBlockStakeModifierlV2; }
int NewSigsActive(const int nHeight) const { return nHeight >= nBlockEnforceNewMessageSignatures; }
int Zerocoin_PublicSpendVersion(const int nHeight) const;
bool Cold_Staking_Enabled(const int height) const { return height >= nColdStakingStart; }
int Block_Enforce_Cold_Staking() const { return nColdStakingStart; }

// fake serial attack
int Zerocoin_Block_EndFakeSerial() const { return nFakeSerialBlockheightEnd; }
Expand Down Expand Up @@ -227,6 +232,8 @@ class CChainParams
int nPublicZCSpendsV4;
int nBlockStakeModifierlV2;
int nBlockEnforceNewMessageSignatures;
int nColdStakingStart;
CAmount nMinColdStakingAmount;

// fake serial attack
int nFakeSerialBlockheightEnd = 0;
Expand Down
9 changes: 7 additions & 2 deletions src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
out.pushKV("type", GetTxnOutputType(type));

UniValue a(UniValue::VARR);
for (const CTxDestination& addr : addresses)
a.push_back(CBitcoinAddress(addr).ToString());
if (type == TX_COLDSTAKE && addresses.size() == 2) {
a.push_back(CBitcoinAddress(addresses[0], CChainParams::STAKING_ADDRESS).ToString());
a.push_back(CBitcoinAddress(addresses[1], CChainParams::PUBKEY_ADDRESS).ToString());
} else {
for (const CTxDestination& addr : addresses)
a.push_back(CBitcoinAddress(addr).ToString());
}
out.pushKV("addresses", a);
}

Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ std::string HelpMessage(HelpMessageMode mode)
#ifdef ENABLE_WALLET
strUsage += HelpMessageGroup(_("Staking options:"));
strUsage += HelpMessageOpt("-staking=<n>", strprintf(_("Enable staking functionality (0-1, default: %u)"), 1));
strUsage += HelpMessageOpt("-coldstaking=<n>", strprintf(_("Enable cold staking functionality (0-1, default: %u). Disabled if staking=0"), 1));
strUsage += HelpMessageOpt("-pivstake=<n>", strprintf(_("Enable or disable staking functionality for PIV inputs (0-1, default: %u)"), 1));
strUsage += HelpMessageOpt("-zpivstake=<n>", strprintf(_("Enable or disable staking functionality for zPIV inputs (0-1, default: %u)"), 1));
strUsage += HelpMessageOpt("-reservebalance=<amt>", _("Keep the specified amount available for spending at all times (default: 0)"));
Expand Down
11 changes: 8 additions & 3 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ bool Stake(const CBlockIndex* pindexPrev, CStakeInput* stakeInput, unsigned int
while (nTryTime < maxTime)
{
//new block came in, move on
if (chainActive.Height() != prevHeight)
if (chainActive.Height() != prevHeight && Params().NetworkID() == CBaseChainParams::REGTEST)
break;

++nTryTime;
Expand Down Expand Up @@ -449,8 +449,13 @@ bool initStakeInput(const CBlock block, std::unique_ptr<CStakeInput>& stake, int
__func__, txin.prevout.hash.GetHex(), block.GetHash().GetHex());

//verify signature and script
if (!VerifyScript(txin.scriptSig, txPrev.vout[txin.prevout.n].scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&tx, 0)))
return error("%s : VerifySignature failed on coinstake %s", __func__, tx.GetHash().ToString().c_str());
ScriptError serror;
if (!VerifyScript(txin.scriptSig, txPrev.vout[txin.prevout.n].scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&tx, 0), &serror)) {
std::string strErr = "";
if (serror && ScriptErrorString(serror))
strErr = strprintf("with the following error: %s", ScriptErrorString(serror));
return error("%s : VerifyScript failed on coinstake %s %s", __func__, tx.GetHash().ToString(), strErr);
}

CPivStake* pivInput = new CPivStake();
pivInput->SetInput(txPrev, txin.prevout.n);
Expand Down
2 changes: 1 addition & 1 deletion src/keystore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ bool CBasicKeyStore::GetKey(const CKeyID& address, CKey& keyOut) const
}
}
return false;
}
}
Loading