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

Use bytes to represent memo text #259

Merged
merged 13 commits into from
Dec 13, 2019
4 changes: 4 additions & 0 deletions src/main/java/org/stellar/sdk/ManageDataOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class ManageDataOperation extends Operation {
private ManageDataOperation(String name, byte[] value) {
this.name = checkNotNull(name, "name cannot be null");
this.value = value;

if (new XdrString(this.name).getBytes().length > 64) {
throw new IllegalArgumentException("name cannot exceed 64 bytes");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems to be unrelated to the rest of this change. The rest of this change is specifically about memo text, but this change is to do with manage data operations. It seems out of scope and like it belongs in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if I separated this change in a new PR it would depend on this branch because it requires XdrString. Lets keep both changes in the same PR for now. It shouldn't be too burdensome to review the extra changes

}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/stellar/sdk/SetOptionsOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ private SetOptionsOperation(String inflationDestination, Integer clearFlags, Int
this.homeDomain = homeDomain;
this.signer = signer;
this.signerWeight = signerWeight;

if (new XdrString(this.homeDomain).getBytes().length > 32) {
throw new IllegalArgumentException("home domain cannot exceed 32 bytes");
}

}

/**
Expand Down