Skip to content

Commit

Permalink
Adjustments for Ravencoin
Browse files Browse the repository at this point in the history
  • Loading branch information
fdoving committed Dec 19, 2021
1 parent 5d30e6b commit d4df6f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/rpc/assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
void CheckRestrictedAssetTransferInputs(const CWalletTx& transaction, const std::string& asset_name) {
// Do a validity check before commiting the transaction
if (IsAssetNameAnRestricted(asset_name)) {
if (pcoinsTip && passets) {
if (pcoinsTip.get() && passets) {
for (auto input : transaction.tx->vin) {
const COutPoint &prevout = input.prevout;
const Coin &coin = pcoinsTip->AccessCoin(prevout);
Expand Down Expand Up @@ -1802,7 +1802,7 @@ UniValue getcacheinfo(const JSONRPCRequest& request)
if (!currentActiveAssetCache)
throw JSONRPCError(RPC_VERIFY_ERROR, "asset cache is null");

if (!pcoinsTip)
if (!pcoinsTip.get())
throw JSONRPCError(RPC_VERIFY_ERROR, "coins tip cache is null");

if (!passetsCache)
Expand Down
8 changes: 4 additions & 4 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ UniValue gettxoutproof(const JSONRPCRequest& request)
} else {
// Loop through txids and try to find which block they're in. Exit loop once a block is found.
for (const auto& tx : setTxids) {
const Coin& coin = AccessByTxid(*pcoinsTip, tx);
const Coin& coin = AccessByTxid(pcoinsTip.get(), tx);
if (!coin.IsSpent()) {
pblockindex = chainActive[coin.nHeight];
break;
Expand Down Expand Up @@ -1753,7 +1753,7 @@ UniValue combinerawtransaction(const JSONRPCRequest& request)
{
LOCK(cs_main);
LOCK(mempool.cs);
CCoinsViewCache &viewChain = *pcoinsTip;
CCoinsViewCache viewChain(pcoinsTip.get());
CCoinsViewMemPool viewMempool(&viewChain, mempool);
view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view

Expand Down Expand Up @@ -1874,7 +1874,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
CCoinsViewCache view(&viewDummy);
{
LOCK(mempool.cs);
CCoinsViewCache &viewChain = *pcoinsTip;
CCoinsViewCache viewChain(pcoinsTip.get());
CCoinsViewMemPool viewMempool(&viewChain, mempool);
view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view

Expand Down Expand Up @@ -2083,7 +2083,7 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
if (!request.params[1].isNull() && request.params[1].get_bool())
nMaxRawTxFee = 0;

CCoinsViewCache &view = *pcoinsTip;
CCoinsViewCache view(pcoinsTip.get());
bool fHaveChain = false;
for (size_t o = 0; !fHaveChain && o < tx->vout.size(); o++) {
const Coin& existingCoin = view.AccessCoin(COutPoint(hashTx, o));
Expand Down
2 changes: 1 addition & 1 deletion src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
if (i != mapTx.end()) {
CValidationState state;
std::vector<std::pair<std::string, uint256>> vReissueAssets;
if (!setAlreadyRemoving.count(hash) && !Consensus::CheckTxAssets(i->GetTx(), state, pcoinsTip, passets, false, vReissueAssets)) {
if (!setAlreadyRemoving.count(hash) && !Consensus::CheckTxAssets(i->GetTx(), state, pcoinsTip.get(), passets, false, vReissueAssets)) {
entries.push_back(&*i);
trans.emplace_back(i->GetTx());
setAlreadyRemoving.insert(hash);
Expand Down
1 change: 0 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,6 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
/** RVN END */

{
CCoinsViewCache view(pcoinsTip);
/** RVN START */
// Create the empty asset cache, that will be sent into the connect block
// All new data will be added to the cache, and will be flushed back into passets after a successful
Expand Down

0 comments on commit d4df6f6

Please sign in to comment.