Skip to content

Commit 41aa5b7

Browse files
committed
Pack Coin more tightly
1 parent 97072d6 commit 41aa5b7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/coins.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030
class Coin
3131
{
3232
public:
33-
//! whether the containing transaction was a coinbase
34-
bool fCoinBase;
35-
3633
//! unspent transaction output
3734
CTxOut out;
3835

39-
//! at which height the containing transaction was included in the active block chain
40-
uint32_t nHeight;
36+
//! whether containing transaction was a coinbase
37+
unsigned int fCoinBase : 1;
38+
39+
//! at which height this containing transaction was included in the active block chain
40+
uint32_t nHeight : 31;
4141

42-
//! construct a Coin from a CTxOut and height/coinbase properties.
43-
Coin(CTxOut&& outIn, int nHeightIn, bool fCoinBaseIn) : fCoinBase(fCoinBaseIn), out(std::move(outIn)), nHeight(nHeightIn) {}
44-
Coin(const CTxOut& outIn, int nHeightIn, bool fCoinBaseIn) : fCoinBase(fCoinBaseIn), out(outIn), nHeight(nHeightIn) {}
42+
//! construct a Coin from a CTxOut and height/coinbase information.
43+
Coin(CTxOut&& outIn, int nHeightIn, bool fCoinBaseIn) : out(std::move(outIn)), fCoinBase(fCoinBaseIn), nHeight(nHeightIn) {}
44+
Coin(const CTxOut& outIn, int nHeightIn, bool fCoinBaseIn) : out(outIn), fCoinBase(fCoinBaseIn),nHeight(nHeightIn) {}
4545

4646
void Clear() {
4747
out.SetNull();

0 commit comments

Comments
 (0)