Changeset View
Changeset View
Standalone View
Standalone View
src/txdb.cpp
Show All 33 Lines | |||||
namespace { | namespace { | ||||
struct CoinEntry { | struct CoinEntry { | ||||
COutPoint *outpoint; | COutPoint *outpoint; | ||||
char key; | char key; | ||||
explicit CoinEntry(const COutPoint *ptr) | explicit CoinEntry(const COutPoint *ptr) | ||||
: outpoint(const_cast<COutPoint *>(ptr)), key(DB_COIN) {} | : outpoint(const_cast<COutPoint *>(ptr)), key(DB_COIN) {} | ||||
template <typename Stream> void Serialize(Stream &s) const { | SERIALIZE_METHODS(CoinEntry, obj) { | ||||
s << key; | TxId id = obj.outpoint->GetTxId(); | ||||
s << outpoint->GetTxId(); | uint32_t n = obj.outpoint->GetN(); | ||||
s << VARINT(outpoint->GetN()); | READWRITE(obj.key, id, n); | ||||
} | SER_READ(obj, *obj.outpoint = COutPoint(id, n)); | ||||
template <typename Stream> void Unserialize(Stream &s) { | |||||
s >> key; | |||||
TxId id; | |||||
s >> id; | |||||
uint32_t n = 0; | |||||
s >> VARINT(n); | |||||
*outpoint = COutPoint(id, n); | |||||
} | } | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
CCoinsViewDB::CCoinsViewDB(fs::path ldb_path, size_t nCacheSize, bool fMemory, | CCoinsViewDB::CCoinsViewDB(fs::path ldb_path, size_t nCacheSize, bool fMemory, | ||||
bool fWipe) | bool fWipe) | ||||
: db(ldb_path, nCacheSize, fMemory, fWipe, true) {} | : db(ldb_path, nCacheSize, fMemory, fWipe, true) {} | ||||
▲ Show 20 Lines • Show All 502 Lines • Show Last 20 Lines |