File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ class Coin
59
59
template <typename Stream>
60
60
void Serialize (Stream &s) const {
61
61
assert (!IsSpent ());
62
- uint32_t code = nHeight * 2 + fCoinBase ;
62
+ uint32_t code = nHeight * uint32_t { 2 } + fCoinBase ;
63
63
::Serialize (s, VARINT(code));
64
64
::Serialize (s, Using<TxOutCompression>(out));
65
65
}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ struct TxInUndoFormatter
24
24
{
25
25
template <typename Stream>
26
26
void Ser (Stream &s, const Coin& txout) {
27
- ::Serialize (s, VARINT(txout.nHeight * 2 + ( txout.fCoinBase ? 1u : 0u ) ));
27
+ ::Serialize (s, VARINT(txout.nHeight * uint32_t { 2 } + txout.fCoinBase ));
28
28
if (txout.nHeight > 0 ) {
29
29
// Required to maintain compatibility with older undo format.
30
30
::Serialize (s, (unsigned char )0);
@@ -34,9 +34,9 @@ struct TxInUndoFormatter
34
34
35
35
template <typename Stream>
36
36
void Unser (Stream &s, Coin& txout) {
37
- unsigned int nCode = 0 ;
37
+ uint32_t nCode = 0 ;
38
38
::Unserialize (s, VARINT(nCode));
39
- txout.nHeight = nCode / 2 ;
39
+ txout.nHeight = nCode >> 1 ;
40
40
txout.fCoinBase = nCode & 1 ;
41
41
if (txout.nHeight > 0 ) {
42
42
// Old versions stored the version number for the last spend of
You can’t perform that action at this time.
0 commit comments