core/query: make annotated output's txid truly omittable #544

Merged
merged 2 commits into from Feb 17, 2017

Projects

None yet

3 participants

@jeffomatic
Member
jeffomatic commented Feb 17, 2017 edited

AnnotatedOutput'd TransactionID field is a bc.Hash, which does not have
a zero-value that will trigger the omitempty directive when serialized
to JSON. We use pointers instead to get the desired behavior.

This commit is a stopgap measure to prevent some weird behavior in the
Node SDK; namely, transaction output objects are currently returned as
strings of zeros. In the future, we can re-evaluate the API spec and decide
whether we should allow the transaction ID field to be empty in any context.

@jeffomatic jeffomatic core/query: make annotated output's txid truly omittable
AnnotatedOutput'd TransactionID field is a bc.Hash, which does not have
a zero-value that will trigger the omitempty directive when serialized
JSON. We use pointers instead to get the desired behavior.

Among other things, this prevents a tx ID of all zeros from appearing
in response objects in the Node SDK.
4f21cb3
@jeffomatic
Member

PTAL

@kr
kr approved these changes Feb 17, 2017 View changes
@kr
Member
kr commented Feb 17, 2017

LGTM

@jeffomatic jeffomatic poke wercker
b17035f
@chainbot chainbot merged commit 80c1e9e into main Feb 17, 2017

3 checks passed

licence/cla Contributor License Agreement is signed.
Details
wercker/cored Wercker pipeline passed
Details
wercker/java Wercker pipeline passed
Details
@chainbot chainbot deleted the fix-blank-txid-annotation branch Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment