Skip to content

Commit

Permalink
Merge bitcoin#25438: refactor: remove unused methods in classes `CDBI…
Browse files Browse the repository at this point in the history
…terator,CDBWrapper,CCoinsViewDBCursor`

e4b4db5 refactor: remove unused method `CDBWrapper::CompactRange` (Sebastian Falbesoner)
fb38c6e refactor: remove unused methods `{CDBIterator,CCoinsViewDBCursor}::GetValueSize()` (Sebastian Falbesoner)

Pull request description:

  The `GetValueSize` methods haven't been used since the chainstate db cache has been switched from per-tx to per-txout model years ago (PR bitcoin#10195, commit d342424). The `CompactRange` is unused since the txindex migration code was removed (PR bitcoin#22626, commit bitcoin@fa20f81).

ACKs for top commit:
  fanquake:
    ACK e4b4db5
  furszy:
    re-ACK e4b4db5
  laanwj:
    Code review ACK e4b4db5

Tree-SHA512: 77da445fb70c744046263c6f2ddb05782b68e3d4b2ea604dd7c7dc73ce7c1f2d2b48ec68db4dcb03e35fc27488b99b0a420f6fa3d5b83d325c1708ed68e99e0a
  • Loading branch information
MacroFake authored and jagdeep sidhu committed Jun 27, 2022
1 parent e6b6518 commit e1fc0f6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion src/coins.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ class CCoinsViewCursor

virtual bool GetKey(COutPoint &key) const = 0;
virtual bool GetValue(Coin &coin) const = 0;
virtual unsigned int GetValueSize() const = 0;

virtual bool Valid() const = 0;
virtual void Next() = 0;
Expand Down
21 changes: 0 additions & 21 deletions src/dbwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ class CDBIterator
}
return true;
}

unsigned int GetValueSize() {
return piter->value().size();
}

};

class CDBWrapper
Expand Down Expand Up @@ -348,22 +343,6 @@ class CDBWrapper
pdb->GetApproximateSizes(&range, 1, &size);
return size;
}

/**
* Compact a certain range of keys in the database.
*/
template<typename K>
void CompactRange(const K& key_begin, const K& key_end) const
{
CDataStream ssKey1(SER_DISK, CLIENT_VERSION), ssKey2(SER_DISK, CLIENT_VERSION);
ssKey1.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
ssKey1 << key_begin;
ssKey2 << key_end;
leveldb::Slice slKey1((const char*)ssKey1.data(), ssKey1.size());
leveldb::Slice slKey2((const char*)ssKey2.data(), ssKey2.size());
pdb->CompactRange(&slKey1, &slKey2);
}
};
// SYSCOIN

Expand Down
6 changes: 0 additions & 6 deletions src/txdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ class CCoinsViewDBCursor: public CCoinsViewCursor

bool GetKey(COutPoint &key) const override;
bool GetValue(Coin &coin) const override;
unsigned int GetValueSize() const override;

bool Valid() const override;
void Next() override;
Expand Down Expand Up @@ -256,11 +255,6 @@ bool CCoinsViewDBCursor::GetValue(Coin &coin) const
return pcursor->GetValue(coin);
}

unsigned int CCoinsViewDBCursor::GetValueSize() const
{
return pcursor->GetValueSize();
}

bool CCoinsViewDBCursor::Valid() const
{
return keyTmp.first == DB_COIN;
Expand Down

0 comments on commit e1fc0f6

Please sign in to comment.