Validate AddressEntry.segwit

This commit is contained in:
Oscar Guindzberg 2020-10-05 15:08:19 -03:00
parent 4a2c0ad75a
commit 86ddd06e27
No known key found for this signature in database
GPG key ID: 209796BF2E1D4F75

View file

@ -97,6 +97,10 @@ public final class AddressEntry implements PersistablePayload {
Context context,
@Nullable String offerId,
boolean segwit) {
if (segwit && (!Context.AVAILABLE.equals(context) || offerId != null)) {
throw new IllegalArgumentException("Segwit addresses are only allowed for " +
"AVAILABLE entries without an offerId");
}
this.keyPair = keyPair;
this.context = context;
this.offerId = offerId;