Allow NULL keystore to actually work
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user