mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-14 16:50:17 +02:00
scripted-diff: various renames for per-utxo consistency
Thanks to John Newberry for pointing these out. -BEGIN VERIFY SCRIPT- sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h -END VERIFY SCRIPT-
This commit is contained in:
20
src/txdb.cpp
20
src/txdb.cpp
@@ -27,10 +27,10 @@ static const char DB_LAST_BLOCK = 'l';
|
||||
|
||||
namespace {
|
||||
|
||||
struct CoinsEntry {
|
||||
struct CoinEntry {
|
||||
COutPoint* outpoint;
|
||||
char key;
|
||||
CoinsEntry(const COutPoint* ptr) : outpoint(const_cast<COutPoint*>(ptr)), key(DB_COIN) {}
|
||||
CoinEntry(const COutPoint* ptr) : outpoint(const_cast<COutPoint*>(ptr)), key(DB_COIN) {}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize(Stream &s) const {
|
||||
@@ -53,12 +53,12 @@ CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(Get
|
||||
{
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::GetCoins(const COutPoint &outpoint, Coin &coin) const {
|
||||
return db.Read(CoinsEntry(&outpoint), coin);
|
||||
bool CCoinsViewDB::GetCoin(const COutPoint &outpoint, Coin &coin) const {
|
||||
return db.Read(CoinEntry(&outpoint), coin);
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::HaveCoins(const COutPoint &outpoint) const {
|
||||
return db.Exists(CoinsEntry(&outpoint));
|
||||
bool CCoinsViewDB::HaveCoin(const COutPoint &outpoint) const {
|
||||
return db.Exists(CoinEntry(&outpoint));
|
||||
}
|
||||
|
||||
uint256 CCoinsViewDB::GetBestBlock() const {
|
||||
@@ -74,8 +74,8 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) {
|
||||
size_t changed = 0;
|
||||
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) {
|
||||
if (it->second.flags & CCoinsCacheEntry::DIRTY) {
|
||||
CoinsEntry entry(&it->first);
|
||||
if (it->second.coin.IsPruned())
|
||||
CoinEntry entry(&it->first);
|
||||
if (it->second.coin.IsSpent())
|
||||
batch.Erase(entry);
|
||||
else
|
||||
batch.Write(entry, it->second.coin);
|
||||
@@ -130,7 +130,7 @@ CCoinsViewCursor *CCoinsViewDB::Cursor() const
|
||||
i->pcursor->Seek(DB_COIN);
|
||||
// Cache key of first record
|
||||
if (i->pcursor->Valid()) {
|
||||
CoinsEntry entry(&i->keyTmp.second);
|
||||
CoinEntry entry(&i->keyTmp.second);
|
||||
i->pcursor->GetKey(entry);
|
||||
i->keyTmp.first = entry.key;
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ bool CCoinsViewDBCursor::Valid() const
|
||||
void CCoinsViewDBCursor::Next()
|
||||
{
|
||||
pcursor->Next();
|
||||
CoinsEntry entry(&keyTmp.second);
|
||||
CoinEntry entry(&keyTmp.second);
|
||||
if (!pcursor->Valid() || !pcursor->GetKey(entry)) {
|
||||
keyTmp.first = 0; // Invalidate cached key after last record so that Valid() and GetKey() return false
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user