serialization: prevent int overflow for big Coin::nHeight

This commit is contained in:
pierrenn
2020-03-26 07:48:48 +09:00
parent 97b0687501
commit e980214bc4
2 changed files with 4 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ public:
template<typename Stream>
void Serialize(Stream &s) const {
assert(!IsSpent());
uint32_t code = nHeight * 2 + fCoinBase;
uint32_t code = nHeight * uint32_t{2} + fCoinBase;
::Serialize(s, VARINT(code));
::Serialize(s, Using<TxOutCompression>(out));
}