aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.h b/src/main.h
index 1af781f45c..4286880c9f 100644
--- a/src/main.h
+++ b/src/main.h
@@ -652,14 +652,25 @@ class CTxOutCompressor
{
private:
CTxOut &txout;
+
public:
+ static uint64 CompressAmount(uint64 nAmount);
+ static uint64 DecompressAmount(uint64 nAmount);
+
CTxOutCompressor(CTxOut &txoutIn) : txout(txoutIn) { }
- IMPLEMENT_SERIALIZE(
- READWRITE(VARINT(txout.nValue));
+ IMPLEMENT_SERIALIZE(({
+ if (!fRead) {
+ uint64 nVal = CompressAmount(txout.nValue);
+ READWRITE(VARINT(nVal));
+ } else {
+ uint64 nVal = 0;
+ READWRITE(VARINT(nVal));
+ txout.nValue = DecompressAmount(nVal);
+ }
CScriptCompressor cscript(REF(txout.scriptPubKey));
READWRITE(cscript);
- )
+ });)
};