bitcoin/src/index/disktxpos.h
MarcoFalke fa4f388fc9
refactor: Use fixed size ints over (un)signed ints for serialized values
Bitcoin Core already assumes that 'unsigned int' means uint32_t and
'signed int' means int32_t. See src/compat/assumptions.h. Also, any
serialized integral value must be of a fixed size.

So make the fixed size explicit in this documenting refactor, which does
not change the behavior on any platform.
2025-10-30 17:51:38 +01:00

27 lines
724 B
C

// Copyright (c) 2019-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_INDEX_DISKTXPOS_H
#define BITCOIN_INDEX_DISKTXPOS_H
#include <flatfile.h>
#include <serialize.h>
struct CDiskTxPos : public FlatFilePos
{
uint32_t nTxOffset{0}; // after header
SERIALIZE_METHODS(CDiskTxPos, obj)
{
READWRITE(AsBase<FlatFilePos>(obj), VARINT(obj.nTxOffset));
}
CDiskTxPos(const FlatFilePos& blockIn, uint32_t nTxOffsetIn) : FlatFilePos{blockIn.nFile, blockIn.nPos}, nTxOffset{nTxOffsetIn} {
}
CDiskTxPos() = default;
};
#endif // BITCOIN_INDEX_DISKTXPOS_H