aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-12-04 21:19:04 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-01-26 18:37:30 +0000
commitb595583f3dde9d7a6ef4c6a30d38d541eb6c6cd9 (patch)
tree300faa07076bb5e57c3db667bb24c814213446a9
parentp2p: remove obsolete local time from TIMED_SYNC (diff)
downloadmonero-b595583f3dde9d7a6ef4c6a30d38d541eb6c6cd9.tar.xz
serialization: do not write optional fields with default value
-rw-r--r--contrib/epee/include/serialization/keyvalue_serialization.h2
-rwxr-xr-xtests/functional_tests/transfer.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/contrib/epee/include/serialization/keyvalue_serialization.h b/contrib/epee/include/serialization/keyvalue_serialization.h
index 78d294d05..fd343865c 100644
--- a/contrib/epee/include/serialization/keyvalue_serialization.h
+++ b/contrib/epee/include/serialization/keyvalue_serialization.h
@@ -89,6 +89,8 @@ public: \
#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \
do { \
+ if (is_store && this_ref.variable == default_value) \
+ break; \
if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \
epee::serialize_default(this_ref.variable, default_value); \
} while (0);
diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py
index 0c942f48b..3bed69b98 100755
--- a/tests/functional_tests/transfer.py
+++ b/tests/functional_tests/transfer.py
@@ -169,7 +169,7 @@ class TransferTest():
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
assert e.double_spend_seen == False
- assert e.confirmations == 0
+ assert not 'confirmations' in e or e.confirmations == 0
running_balances[0] -= 1000000000000 + fee
@@ -282,7 +282,7 @@ class TransferTest():
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
assert e.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW'
assert e.double_spend_seen == False
- assert e.confirmations == 0
+ assert not 'confirmations' in e or e.confirmations == 0
assert e.amount == amount
assert e.fee == fee