mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-03 07:21:21 -07:00
serialization: do not write optional fields with default value
This commit is contained in:
parent
5f98b46d58
commit
b595583f3d
@ -89,6 +89,8 @@ public: \
|
|||||||
|
|
||||||
#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \
|
#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \
|
||||||
do { \
|
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)) \
|
if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \
|
||||||
epee::serialize_default(this_ref.variable, default_value); \
|
epee::serialize_default(this_ref.variable, default_value); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
@ -169,7 +169,7 @@ class TransferTest():
|
|||||||
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
|
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
|
||||||
assert e.double_spend_seen == False
|
assert e.double_spend_seen == False
|
||||||
assert e.confirmations == 0
|
assert not 'confirmations' in e or e.confirmations == 0
|
||||||
|
|
||||||
running_balances[0] -= 1000000000000 + fee
|
running_balances[0] -= 1000000000000 + fee
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ class TransferTest():
|
|||||||
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
assert e.subaddr_indices == [{'major': 0, 'minor': 0}]
|
||||||
assert e.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW'
|
assert e.address == '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW'
|
||||||
assert e.double_spend_seen == False
|
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.amount == amount
|
||||||
assert e.fee == fee
|
assert e.fee == fee
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user