Commit b5b59406 authored by zeroleak's avatar zeroleak
Browse files

add PushTxAddressReuseException.adressReuseOutputIndexs

parent e05f9012
......@@ -216,7 +216,8 @@ public class BackendApi {
// address reuse
if (pushTxResponse.error != null && PushTxResponse.PushTxError.CODE_VIOLATION_STRICT_MODE_VOUTS.equals(pushTxResponse.error.code)) {
throw new PushTxAddressReuseException();
Collection<Integer> adressReuseOutputIndexs = (Collection<Integer>)pushTxResponse.error.message;
throw new PushTxAddressReuseException(adressReuseOutputIndexs);
}
// other error
......
package com.samourai.wallet.api.backend.beans;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
public class PushTxAddressReuseException extends Exception {
public PushTxAddressReuseException() {
super();
private List<Integer> adressReuseOutputIndexs;
public PushTxAddressReuseException(Collection<Integer> adressReuseOutputIndexs) {
super("Address reuse detected for outputs: "+ Arrays.toString(adressReuseOutputIndexs.toArray()));
this.adressReuseOutputIndexs = new LinkedList<>(adressReuseOutputIndexs);
}
public List<Integer> getAdressReuseOutputIndexs() {
return adressReuseOutputIndexs;
}
}
......@@ -16,6 +16,14 @@ public class PushTxResponse {
public Object message;
public String code;
@Override
public String toString() {
return "PushTxError{" +
"message=" + message +
", code='" + code + '\'' +
'}';
}
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment