Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txnbuild: more unit tests for FromXDR methods #1558

Merged
merged 1 commit into from
Aug 6, 2019

Conversation

poliha
Copy link
Contributor

@poliha poliha commented Aug 2, 2019

This PR adds unit tests for the FromXDR methods implemented by txnbuild operations.
It covers tests for the following operations

  • SetOptions
  • ChangeTrust
  • AllowTrust
  • AccountMerge
  • Inflation
  • ManageData
  • BumpSequence

The test case for checking if the same xdr is returned if we build and encode will be added when #1448 is fixed.

Closes #1329

@poliha poliha added the txnbuild 2nd-generation transaction build library for Go SDK label Aug 2, 2019
Copy link
Member

@ire-and-curses ire-and-curses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -70,7 +70,7 @@ func memoFromXDR(memo xdr.Memo) (Memo, error) {
newMemo = MemoHash(value)
memoCreated = ok
case xdr.MemoTypeMemoReturn:
value, ok := memo.GetHash()
value, ok := memo.GetRetHash()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's awesome that these tests found this bug!

@@ -160,7 +160,7 @@ func (so *SetOptions) handleClearFlagsXDR(flags *xdr.Uint32) {
if flags != nil {
for _, f := range []AccountFlag{AuthRequired, AuthRevocable, AuthImmutable} {
if f&AccountFlag(*flags) != 0 {
so.SetFlags = append(so.SetFlags, f)
so.ClearFlags = append(so.ClearFlags, f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another one I'm glad you caught! 👍

@poliha poliha merged commit 5357697 into release-horizonclient-v1.4.0 Aug 6, 2019
@poliha poliha deleted the parse-xdr-tests branch August 6, 2019 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
txnbuild 2nd-generation transaction build library for Go SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants