Allow NULL keystore to actually work

This commit is contained in:
miketout
2018-10-13 21:03:47 -07:00
parent 51848bbce5
commit 6c621e0e43
4 changed files with 7 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ bool CCheatList::IsCheatInList(const CTransaction &tx, CTransaction *cheatTx)
for (auto it = range.first; it != range.second; it++)
{
CTransaction &cTx = it->second->tx;
printf("cTx::opret : %s\n", cTx.vout[1].scriptPubKey.ToString().c_str());
//printf("cTx::opret : %s\n", cTx.vout[1].scriptPubKey.ToString().c_str());
// need both parameters to check
if (GetStakeParams(cTx, s))

View File

@@ -262,7 +262,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
{
extern CWallet *pwalletMain;
LOCK(pwalletMain->cs_wallet);
TransactionBuilder tb = TransactionBuilder(consensusParams, nHeight, pwalletMain);
TransactionBuilder tb = TransactionBuilder(consensusParams, nHeight);
CTransaction cb = b.vtx[0];
cbHash = cb.GetHash();

View File

@@ -26,7 +26,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
CKey key;
if (pprivKey)
key = *pprivKey;
else if (!keystore->GetKey(address, key))
else if (!keystore || !keystore->GetKey(address, key))
return false;
uint256 hash;

View File

@@ -60,7 +60,10 @@ void TransactionBuilder::AddSaplingOutput(
void TransactionBuilder::AddTransparentInput(COutPoint utxo, CScript scriptPubKey, CAmount value)
{
if (keystore == nullptr) {
throw std::runtime_error("Cannot add transparent inputs to a TransactionBuilder without a keystore");
if (!scriptPubKey.IsPayToCryptoCondition())
{
throw std::runtime_error("Cannot add transparent inputs to a TransactionBuilder without a keystore, except with crypto conditions");
}
}
mtx.vin.emplace_back(utxo);