From 6c621e0e4376d8009759bc6bb126d7907f2b5da2 Mon Sep 17 00:00:00 2001 From: miketout Date: Sat, 13 Oct 2018 21:03:47 -0700 Subject: [PATCH] Allow NULL keystore to actually work --- src/cheatcatcher.cpp | 2 +- src/miner.cpp | 2 +- src/script/sign.cpp | 2 +- src/transaction_builder.cpp | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cheatcatcher.cpp b/src/cheatcatcher.cpp index 85252f7d3..c48f80f1e 100644 --- a/src/cheatcatcher.cpp +++ b/src/cheatcatcher.cpp @@ -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)) diff --git a/src/miner.cpp b/src/miner.cpp index e1f8f9d8d..674d6540f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -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(); diff --git a/src/script/sign.cpp b/src/script/sign.cpp index ac39f3ea7..6c3a4678c 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -26,7 +26,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector& vchSig, CKey key; if (pprivKey) key = *pprivKey; - else if (!keystore->GetKey(address, key)) + else if (!keystore || !keystore->GetKey(address, key)) return false; uint256 hash; diff --git a/src/transaction_builder.cpp b/src/transaction_builder.cpp index 4fd34e3bc..558cd0756 100644 --- a/src/transaction_builder.cpp +++ b/src/transaction_builder.cpp @@ -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);