Refactor: replace calls to GetTxid() with GetHash()
This commit is contained in:
@@ -65,7 +65,7 @@ std::string JSOutPoint::ToString() const
|
||||
|
||||
std::string COutput::ToString() const
|
||||
{
|
||||
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetTxid().ToString(), i, nDepth, FormatMoney(tx->vout[i].nValue));
|
||||
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString(), i, nDepth, FormatMoney(tx->vout[i].nValue));
|
||||
}
|
||||
|
||||
const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const
|
||||
@@ -831,7 +831,7 @@ void CWallet::UpdateNullifierNoteMap(const CWalletTx& wtx)
|
||||
|
||||
bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb)
|
||||
{
|
||||
uint256 hash = wtxIn.GetTxid();
|
||||
uint256 hash = wtxIn.GetHash();
|
||||
|
||||
if (fFromLoadWallet)
|
||||
{
|
||||
@@ -896,7 +896,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
|
||||
}
|
||||
else
|
||||
LogPrintf("AddToWallet(): found %s in block %s not in index\n",
|
||||
wtxIn.GetTxid().ToString(),
|
||||
wtxIn.GetHash().ToString(),
|
||||
wtxIn.hashBlock.ToString());
|
||||
}
|
||||
AddToSpends(hash);
|
||||
@@ -939,7 +939,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
|
||||
}
|
||||
|
||||
//// debug print
|
||||
LogPrintf("AddToWallet %s %s%s\n", wtxIn.GetTxid().ToString(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : ""));
|
||||
LogPrintf("AddToWallet %s %s%s\n", wtxIn.GetHash().ToString(), (fInsertedNew ? "new" : ""), (fUpdated ? "update" : ""));
|
||||
|
||||
// Write to disk
|
||||
if (fInsertedNew || fUpdated)
|
||||
@@ -957,7 +957,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
|
||||
|
||||
if ( !strCmd.empty())
|
||||
{
|
||||
boost::replace_all(strCmd, "%s", wtxIn.GetTxid().GetHex());
|
||||
boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
|
||||
boost::thread t(runCommand, strCmd); // thread runs free
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
{
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
bool fExisted = mapWallet.count(tx.GetTxid()) != 0;
|
||||
bool fExisted = mapWallet.count(tx.GetHash()) != 0;
|
||||
if (fExisted && !fUpdate) return false;
|
||||
auto noteData = FindMyNotes(tx);
|
||||
if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0)
|
||||
@@ -1288,7 +1288,7 @@ int CWalletTx::GetRequestCount() const
|
||||
else
|
||||
{
|
||||
// Did anyone request this transaction?
|
||||
map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(GetTxid());
|
||||
map<uint256, int>::const_iterator mi = pwallet->mapRequestCount.find(GetHash());
|
||||
if (mi != pwallet->mapRequestCount.end())
|
||||
{
|
||||
nRequests = (*mi).second;
|
||||
@@ -1346,7 +1346,7 @@ void CWalletTx::GetAmounts(list<COutputEntry>& listReceived,
|
||||
if (!ExtractDestination(txout.scriptPubKey, address))
|
||||
{
|
||||
LogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",
|
||||
this->GetTxid().ToString());
|
||||
this->GetHash().ToString());
|
||||
address = CNoDestination();
|
||||
}
|
||||
|
||||
@@ -1401,7 +1401,7 @@ void CWalletTx::GetAccountAmounts(const string& strAccount, CAmount& nReceived,
|
||||
|
||||
bool CWalletTx::WriteToDisk(CWalletDB *pwalletdb)
|
||||
{
|
||||
return pwalletdb->WriteTx(GetTxid(), *this);
|
||||
return pwalletdb->WriteTx(GetHash(), *this);
|
||||
}
|
||||
|
||||
void CWallet::WitnessNoteCommitment(std::vector<uint256> commitments,
|
||||
@@ -1520,7 +1520,7 @@ void CWallet::ReacceptWalletTransactions()
|
||||
{
|
||||
const uint256& wtxid = item.first;
|
||||
CWalletTx& wtx = item.second;
|
||||
assert(wtx.GetTxid() == wtxid);
|
||||
assert(wtx.GetHash() == wtxid);
|
||||
|
||||
int nDepth = wtx.GetDepthInMainChain();
|
||||
|
||||
@@ -1545,7 +1545,7 @@ bool CWalletTx::RelayWalletTransaction()
|
||||
if (!IsCoinBase())
|
||||
{
|
||||
if (GetDepthInMainChain() == 0) {
|
||||
LogPrintf("Relaying wtx %s\n", GetTxid().ToString());
|
||||
LogPrintf("Relaying wtx %s\n", GetHash().ToString());
|
||||
RelayTransaction((CTransaction)*this);
|
||||
return true;
|
||||
}
|
||||
@@ -1558,7 +1558,7 @@ set<uint256> CWalletTx::GetConflicts() const
|
||||
set<uint256> result;
|
||||
if (pwallet != NULL)
|
||||
{
|
||||
uint256 myHash = GetTxid();
|
||||
uint256 myHash = GetHash();
|
||||
result = pwallet->GetConflicts(myHash);
|
||||
result.erase(myHash);
|
||||
}
|
||||
@@ -1656,7 +1656,7 @@ CAmount CWalletTx::GetAvailableCredit(bool fUseCache) const
|
||||
return nAvailableCreditCached;
|
||||
|
||||
CAmount nCredit = 0;
|
||||
uint256 hashTx = GetTxid();
|
||||
uint256 hashTx = GetHash();
|
||||
for (unsigned int i = 0; i < vout.size(); i++)
|
||||
{
|
||||
if (!pwallet->IsSpent(hashTx, i))
|
||||
@@ -1702,7 +1702,7 @@ CAmount CWalletTx::GetAvailableWatchOnlyCredit(const bool& fUseCache) const
|
||||
CAmount nCredit = 0;
|
||||
for (unsigned int i = 0; i < vout.size(); i++)
|
||||
{
|
||||
if (!pwallet->IsSpent(GetTxid(), i))
|
||||
if (!pwallet->IsSpent(GetHash(), i))
|
||||
{
|
||||
const CTxOut &txout = vout[i];
|
||||
nCredit += pwallet->GetCredit(txout, ISMINE_WATCH_ONLY);
|
||||
@@ -1771,7 +1771,7 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
|
||||
{
|
||||
CWalletTx& wtx = *item.second;
|
||||
if (wtx.RelayWalletTransaction())
|
||||
result.push_back(wtx.GetTxid());
|
||||
result.push_back(wtx.GetHash());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -2307,7 +2307,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
|
||||
// Note how the sequence number is set to max()-1 so that the
|
||||
// nLockTime set above actually works.
|
||||
BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins)
|
||||
txNew.vin.push_back(CTxIn(coin.first->GetTxid(),coin.second,CScript(),
|
||||
txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(),
|
||||
std::numeric_limits<unsigned int>::max()-1));
|
||||
|
||||
// Sign
|
||||
@@ -2395,7 +2395,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
|
||||
{
|
||||
CWalletTx &coin = mapWallet[txin.prevout.hash];
|
||||
coin.BindWallet(this);
|
||||
NotifyTransactionChanged(this, coin.GetTxid(), CT_UPDATED);
|
||||
NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED);
|
||||
}
|
||||
|
||||
if (fFileBacked)
|
||||
@@ -2403,7 +2403,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
|
||||
}
|
||||
|
||||
// Track how many getdata requests our transaction gets
|
||||
mapRequestCount[wtxNew.GetTxid()] = 0;
|
||||
mapRequestCount[wtxNew.GetHash()] = 0;
|
||||
|
||||
if (fBroadcastTransactions)
|
||||
{
|
||||
@@ -3134,7 +3134,7 @@ int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const
|
||||
// Make sure the merkle branch connects to this block
|
||||
if (!fMerkleVerified)
|
||||
{
|
||||
if (CBlock::CheckMerkleBranch(GetTxid(), vMerkleBranch, nIndex) != pindex->hashMerkleRoot)
|
||||
if (CBlock::CheckMerkleBranch(GetHash(), vMerkleBranch, nIndex) != pindex->hashMerkleRoot)
|
||||
return 0;
|
||||
fMerkleVerified = true;
|
||||
}
|
||||
@@ -3147,7 +3147,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
int nResult = GetDepthInMainChainINTERNAL(pindexRet);
|
||||
if (nResult == 0 && !mempool.exists(GetTxid()))
|
||||
if (nResult == 0 && !mempool.exists(GetHash()))
|
||||
return -1; // Not in chain, not in mempool
|
||||
|
||||
return nResult;
|
||||
|
||||
Reference in New Issue
Block a user