Commit 9a0eeeda authored by zeroleak's avatar zeroleak
Browse files

remove mixsTarget selection to increase mix privacy

parent a7223cf2
...@@ -75,8 +75,6 @@ Response: ...@@ -75,8 +75,6 @@ Response:
"progressLabel":"CONNECTING", "progressLabel":"CONNECTING",
"poolId":"0.01btc", "poolId":"0.01btc",
"priority":5, "priority":5,
"mixsTarget":null,
"mixsTargetOrDefault":1,
"mixsDone":0, "mixsDone":0,
"message":" - [MIX 1/1] ▮▮▮▮▮▯▯▯▯▯ (5/10) CONFIRMED_INPUT : joined a mix!", "message":" - [MIX 1/1] ▮▮▮▮▮▯▯▯▯▯ (5/10) CONFIRMED_INPUT : joined a mix!",
"error":null, "error":null,
...@@ -124,11 +122,9 @@ Parameters: ...@@ -124,11 +122,9 @@ Parameters:
Payload: Payload:
* poolId: id of pool to join * poolId: id of pool to join
* mixsTarget: mixs limit (0 for unlimited)
``` ```
{ {
poolId: "0.01btc", poolId: "0.01btc"
mixsTarget: 0
} }
``` ```
...@@ -139,15 +135,16 @@ Response: ...@@ -139,15 +135,16 @@ Response:
} }
``` ```
### Tx0 preview ```POST /rest/utxos/{hash}:{index}/tx0Preview``` ### Tx0 preview ```POST /rest/tx0/preview```
Parameters:
* hash, index: utxo to spend for tx0
Payload: Payload:
* inputs {hash, index} (mandatory): utxos to spend for tx0
* feeTarget (mandatory): fee target for tx0 * feeTarget (mandatory): fee target for tx0
* poolId (optional): override utxo's poolId * poolId (optional): override utxo's poolId
``` ```
{ {
inputs: [
{hash:"c7f456d5ff002faa89dadec01cc5eb98bb00fdefb92031890324ec127f9d1541", index:5}
],
feeTarget: "BLOCKS_4", feeTarget: "BLOCKS_4",
poolId: "0.01btc" poolId: "0.01btc"
} }
...@@ -157,23 +154,22 @@ Payload: ...@@ -157,23 +154,22 @@ Payload:
Response: Response:
``` ```
{ {
"txid":"aa079c0323349f4abf3fb793bf2ed1ce1e11c53cd22aeced3554872033bfa722"
} }
``` ```
### Tx0 ```POST /rest/utxos/{hash}:{index}/tx0``` ### Tx0 ```POST /rest/tx0```
Parameters:
* hash, index: utxo to spend for tx0
Payload: Payload:
* inputs {hash, index} (mandatory): utxos to spend for tx0
* feeTarget (mandatory): fee target for tx0 * feeTarget (mandatory): fee target for tx0
* poolId (optional): override utxo's poolId * poolId (optional): override utxo's poolId
* mixsTarget (optional): override utxo's mixsTarget
``` ```
{ {
inputs: [
{hash:"c7f456d5ff002faa89dadec01cc5eb98bb00fdefb92031890324ec127f9d1541", index:5}
],
feeTarget: "BLOCKS_4", feeTarget: "BLOCKS_4",
poolId: "0.01btc", poolId: "0.01btc"
mixsTarget: 3
} }
``` ```
......
...@@ -16,7 +16,6 @@ Default configuration is [../src/main/resources/application.properties]. ...@@ -16,7 +16,6 @@ Default configuration is [../src/main/resources/application.properties].
| cli.tor | false | Enable Tor | | cli.tor | false | Enable Tor |
| cli.dojo.enabled | false | Enable Dojo as wallet backend | | cli.dojo.enabled | false | Enable Dojo as wallet backend |
| cli.scode | - | SCODE for discount Whirlpool fees | | cli.scode | - | SCODE for discount Whirlpool fees |
| cli.mix.mixsTarget | 5 | Mixs limit per UTXO (0 for unlimited) |
| cli.mix.autoMix | true | Automatically (re)mix premix & postmix. When disabled, each utxo must be mixed manually. | | cli.mix.autoMix | true | Automatically (re)mix premix & postmix. When disabled, each utxo must be mixed manually. |
...@@ -88,7 +87,7 @@ You can configure your own cert: ...@@ -88,7 +87,7 @@ You can configure your own cert:
| cli.tx0MinConfirmations | 0 | Confirmations required for TX0 | | cli.tx0MinConfirmations | 0 | Confirmations required for TX0 |
| cli.mix.clients | 5 | Max simultaneous mixing clients | | cli.mix.clients | 5 | Max simultaneous mixing clients |
| cli.mix.clientsPerPool | 1 | Max simultaneous mixing clients per pool | | cli.mix.clientsPerPool | 1 | Max simultaneous mixing clients per pool |
| cli.mix.tx0MaxOutputs | 0 | Max premixs to create per TX0 (0 for unlimited) | | cli.mix.tx0MaxOutputs | 0 | Max premixs to create per TX0 (0 for max = 70) |
| cli.mix.clientDelay | 15 | Connecting delay (seconds) between each mixing client | | cli.mix.clientDelay | 15 | Connecting delay (seconds) between each mixing client |
| cli.mix.tx0Delay | 30 | Delay (seconds) between each tx0 (when --auto-tx0) | | cli.mix.tx0Delay | 30 | Delay (seconds) between each tx0 (when --auto-tx0) |
| cli.seedAppendPassphrase | *generated on --init* | Use passphrase as additional seed word (always true for wallets created with SW, may be false for external wallets imported into SW) | | cli.seedAppendPassphrase | *generated on --init* | Use passphrase as additional seed word (always true for wallets created with SW, may be false for external wallets imported into SW) |
......
...@@ -15,7 +15,7 @@ You can run CLI in loop mode on testnet to generate liquidity on testnet server: ...@@ -15,7 +15,7 @@ You can run CLI in loop mode on testnet to generate liquidity on testnet server:
- mix while possible - mix while possible
- consolidate wallet when PREMIX is empty and start again - consolidate wallet when PREMIX is empty and start again
``` ```
--clients=5 --auto-tx0=0.01btc --tx0-max-outputs=15 --mixs-target=100 --scode= --clients=5 --auto-tx0=0.01btc --tx0-max-outputs=15 --scode=
``` ```
Adjust mixing rate with ```cli.mix.clientDelay = 60``` Adjust mixing rate with ```cli.mix.clientDelay = 60```
......
...@@ -32,7 +32,6 @@ public class ApplicationArgs { ...@@ -32,7 +32,6 @@ public class ApplicationArgs {
private static final String ARG_API_KEY = "api-key"; private static final String ARG_API_KEY = "api-key";
public static final String ARG_INIT = "init"; public static final String ARG_INIT = "init";
private static final String ARG_AUTHENTICATE = "authenticate"; private static final String ARG_AUTHENTICATE = "authenticate";
private static final String ARG_MIXS_TARGET = "mixs-target";
private static final String ARG_DUMP_PAYLOAD = "dump-payload"; private static final String ARG_DUMP_PAYLOAD = "dump-payload";
private static final String ARG_RESYNC = "resync"; private static final String ARG_RESYNC = "resync";
...@@ -92,11 +91,6 @@ public class ApplicationArgs { ...@@ -92,11 +91,6 @@ public class ApplicationArgs {
cliConfig.setApiKey(value); cliConfig.setApiKey(value);
} }
valueInt = optionalInt(ARG_MIXS_TARGET);
if (valueInt != null) {
cliConfig.getMix().setMixsTarget(valueInt);
}
valueBool = optionalBoolean(ARG_RESYNC); valueBool = optionalBoolean(ARG_RESYNC);
if (valueBool != null) { if (valueBool != null) {
cliConfig.setResync(valueBool); cliConfig.setResync(valueBool);
......
...@@ -22,7 +22,7 @@ public class MixController extends AbstractRestController { ...@@ -22,7 +22,7 @@ public class MixController extends AbstractRestController {
checkHeaders(headers); checkHeaders(headers);
WhirlpoolWallet whirlpoolWallet = cliWalletService.getSessionWallet(); WhirlpoolWallet whirlpoolWallet = cliWalletService.getSessionWallet();
MixingState mixingState = whirlpoolWallet.getMixingState(); MixingState mixingState = whirlpoolWallet.getMixingState();
return new ApiWalletStateResponse(mixingState, whirlpoolWallet.getConfig().getMixsTarget()); return new ApiWalletStateResponse(mixingState);
} }
@RequestMapping(value = CliApiEndpoint.REST_MIX_START, method = RequestMethod.POST) @RequestMapping(value = CliApiEndpoint.REST_MIX_START, method = RequestMethod.POST)
......
...@@ -3,6 +3,7 @@ package com.samourai.whirlpool.cli.api.controllers.utxo; ...@@ -3,6 +3,7 @@ package com.samourai.whirlpool.cli.api.controllers.utxo;
import com.samourai.whirlpool.cli.api.controllers.AbstractRestController; import com.samourai.whirlpool.cli.api.controllers.AbstractRestController;
import com.samourai.whirlpool.cli.api.protocol.CliApiEndpoint; import com.samourai.whirlpool.cli.api.protocol.CliApiEndpoint;
import com.samourai.whirlpool.cli.api.protocol.beans.ApiUtxo; import com.samourai.whirlpool.cli.api.protocol.beans.ApiUtxo;
import com.samourai.whirlpool.cli.api.protocol.beans.ApiUtxoRef;
import com.samourai.whirlpool.cli.api.protocol.rest.*; import com.samourai.whirlpool.cli.api.protocol.rest.*;
import com.samourai.whirlpool.cli.services.CliWalletService; import com.samourai.whirlpool.cli.services.CliWalletService;
import com.samourai.whirlpool.client.exception.NotifiableException; import com.samourai.whirlpool.client.exception.NotifiableException;
...@@ -12,7 +13,8 @@ import com.samourai.whirlpool.client.tx0.Tx0Preview; ...@@ -12,7 +13,8 @@ import com.samourai.whirlpool.client.tx0.Tx0Preview;
import com.samourai.whirlpool.client.wallet.WhirlpoolWallet; import com.samourai.whirlpool.client.wallet.WhirlpoolWallet;
import com.samourai.whirlpool.client.wallet.beans.WhirlpoolUtxo; import com.samourai.whirlpool.client.wallet.beans.WhirlpoolUtxo;
import com.samourai.whirlpool.client.whirlpool.beans.Pool; import com.samourai.whirlpool.client.whirlpool.beans.Pool;
import java8.util.Lists; import java.util.LinkedList;
import java.util.List;
import javax.validation.Valid; import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
...@@ -32,6 +34,19 @@ public class UtxoController extends AbstractRestController { ...@@ -32,6 +34,19 @@ public class UtxoController extends AbstractRestController {
return whirlpoolUtxo; return whirlpoolUtxo;
} }
private List<WhirlpoolUtxo> findUtxos(ApiUtxoRef[] utxoRefs) throws Exception {
List<WhirlpoolUtxo> whirlpoolUtos = new LinkedList<>();
for (ApiUtxoRef utxoRef : utxoRefs) {
// find utxo
WhirlpoolUtxo whirlpoolUtxo = findUtxo(utxoRef.getHash(), utxoRef.getIndex());
if (whirlpoolUtxo == null) {
throw new NotifiableException("Utxo not found: " + utxoRef.toString());
}
whirlpoolUtos.add(whirlpoolUtxo);
}
return whirlpoolUtos;
}
@RequestMapping(value = CliApiEndpoint.REST_UTXO_CONFIGURE, method = RequestMethod.POST) @RequestMapping(value = CliApiEndpoint.REST_UTXO_CONFIGURE, method = RequestMethod.POST)
public ApiUtxo configureUtxo( public ApiUtxo configureUtxo(
@RequestHeader HttpHeaders headers, @RequestHeader HttpHeaders headers,
...@@ -48,25 +63,18 @@ public class UtxoController extends AbstractRestController { ...@@ -48,25 +63,18 @@ public class UtxoController extends AbstractRestController {
// configure pool // configure pool
whirlpoolWallet.setPool(whirlpoolUtxo, payload.poolId); whirlpoolWallet.setPool(whirlpoolUtxo, payload.poolId);
// configure mixsTarget ApiUtxo apiUtxo = new ApiUtxo(whirlpoolUtxo);
whirlpoolWallet.setMixsTarget(whirlpoolUtxo, payload.mixsTarget);
int mixsTargetMin = whirlpoolWallet.getConfig().getMixsTarget();
ApiUtxo apiUtxo = new ApiUtxo(whirlpoolUtxo, mixsTargetMin);
return apiUtxo; return apiUtxo;
} }
@RequestMapping(value = CliApiEndpoint.REST_UTXO_TX0_PREVIEW, method = RequestMethod.POST) @RequestMapping(value = CliApiEndpoint.REST_UTXO_TX0_PREVIEW, method = RequestMethod.POST)
public ApiTx0PreviewResponse tx0Preview( public ApiTx0PreviewResponse tx0Preview(
@RequestHeader HttpHeaders headers, @RequestHeader HttpHeaders headers, @Valid @RequestBody ApiTx0PreviewRequest payload)
@PathVariable("hash") String utxoHash,
@PathVariable("index") int utxoIndex,
@Valid @RequestBody ApiTx0PreviewRequest payload)
throws Exception { throws Exception {
checkHeaders(headers); checkHeaders(headers);
// find utxo // find utxo
WhirlpoolUtxo whirlpoolUtxo = findUtxo(utxoHash, utxoIndex); List<WhirlpoolUtxo> whirlpoolUtxos = findUtxos(payload.inputs);
WhirlpoolWallet whirlpoolWallet = cliWalletService.getSessionWallet(); WhirlpoolWallet whirlpoolWallet = cliWalletService.getSessionWallet();
Pool pool = whirlpoolWallet.getPoolSupplier().findPoolById(payload.poolId); Pool pool = whirlpoolWallet.getPoolSupplier().findPoolById(payload.poolId);
...@@ -77,28 +85,20 @@ public class UtxoController extends AbstractRestController { ...@@ -77,28 +85,20 @@ public class UtxoController extends AbstractRestController {
// tx0 preview // tx0 preview
Tx0Config tx0Config = whirlpoolWallet.getTx0Config(); Tx0Config tx0Config = whirlpoolWallet.getTx0Config();
Tx0Preview tx0Preview = Tx0Preview tx0Preview =
whirlpoolWallet.tx0Preview(Lists.of(whirlpoolUtxo), pool, tx0Config, payload.feeTarget); whirlpoolWallet.tx0Preview(whirlpoolUtxos, pool, tx0Config, payload.feeTarget);
return new ApiTx0PreviewResponse(tx0Preview); return new ApiTx0PreviewResponse(tx0Preview);
} }
@RequestMapping(value = CliApiEndpoint.REST_UTXO_TX0, method = RequestMethod.POST) @RequestMapping(value = CliApiEndpoint.REST_UTXO_TX0, method = RequestMethod.POST)
public ApiTx0Response tx0( public ApiTx0Response tx0(
@RequestHeader HttpHeaders headers, @RequestHeader HttpHeaders headers, @Valid @RequestBody ApiTx0Request payload)
@PathVariable("hash") String utxoHash,
@PathVariable("index") int utxoIndex,
@Valid @RequestBody ApiTx0Request payload)
throws Exception { throws Exception {
checkHeaders(headers); checkHeaders(headers);
// find utxo // find utxo
WhirlpoolUtxo whirlpoolUtxo = findUtxo(utxoHash, utxoIndex); List<WhirlpoolUtxo> whirlpoolUtxos = findUtxos(payload.inputs);
WhirlpoolWallet whirlpoolWallet = cliWalletService.getSessionWallet(); WhirlpoolWallet whirlpoolWallet = cliWalletService.getSessionWallet();
// override utxo settings
if (payload.mixsTarget != null && payload.mixsTarget > 0) {
whirlpoolWallet.setMixsTarget(whirlpoolUtxo, payload.mixsTarget);
}
Pool pool = whirlpoolWallet.getPoolSupplier().findPoolById(payload.poolId); Pool pool = whirlpoolWallet.getPoolSupplier().findPoolById(payload.poolId);
if (pool == null) { if (pool == null) {
throw new NotifiableException("poolId is not valid"); throw new NotifiableException("poolId is not valid");
...@@ -106,7 +106,7 @@ public class UtxoController extends AbstractRestController { ...@@ -106,7 +106,7 @@ public class UtxoController extends AbstractRestController {
// tx0 // tx0
Tx0Config tx0Config = whirlpoolWallet.getTx0Config(); Tx0Config tx0Config = whirlpoolWallet.getTx0Config();
Tx0 tx0 = whirlpoolWallet.tx0(Lists.of(whirlpoolUtxo), pool, payload.feeTarget, tx0Config); Tx0 tx0 = whirlpoolWallet.tx0(whirlpoolUtxos, pool, payload.feeTarget, tx0Config);
return new ApiTx0Response(tx0); return new ApiTx0Response(tx0);
} }
......
...@@ -21,9 +21,8 @@ public class CliApiEndpoint { ...@@ -21,9 +21,8 @@ public class CliApiEndpoint {
public static final String REST_UTXOS = REST_PREFIX + "utxos"; public static final String REST_UTXOS = REST_PREFIX + "utxos";
public static final String REST_UTXO_CONFIGURE = REST_PREFIX + "utxos/{hash}:{index}"; public static final String REST_UTXO_CONFIGURE = REST_PREFIX + "utxos/{hash}:{index}";
public static final String REST_UTXO_TX0 = REST_PREFIX + "utxos/{hash}:{index}/tx0"; public static final String REST_UTXO_TX0 = REST_PREFIX + "tx0";
public static final String REST_UTXO_TX0_PREVIEW = public static final String REST_UTXO_TX0_PREVIEW = REST_PREFIX + "tx0/preview";
REST_PREFIX + "utxos/{hash}:{index}/tx0Preview";
public static final String REST_UTXO_STARTMIX = REST_PREFIX + "utxos/{hash}:{index}/startMix"; public static final String REST_UTXO_STARTMIX = REST_PREFIX + "utxos/{hash}:{index}/startMix";
public static final String REST_UTXO_STOPMIX = REST_PREFIX + "utxos/{hash}:{index}/stopMix"; public static final String REST_UTXO_STOPMIX = REST_PREFIX + "utxos/{hash}:{index}/stopMix";
......
...@@ -30,7 +30,6 @@ public class ApiCliConfig { ...@@ -30,7 +30,6 @@ public class ApiCliConfig {
private static final String KEY_MIX_CLIENT_DELAY = "cli.mix.clientDelay"; private static final String KEY_MIX_CLIENT_DELAY = "cli.mix.clientDelay";
private static final String KEY_MIX_TX0_MAX_OUTPUTS = "cli.mix.tx0MaxOutputs"; private static final String KEY_MIX_TX0_MAX_OUTPUTS = "cli.mix.tx0MaxOutputs";
private static final String KEY_MIX_AUTO_MIX = "cli.mix.autoMix"; private static final String KEY_MIX_AUTO_MIX = "cli.mix.autoMix";
private static final String KEY_MIX_MIXS_TARGET = "cli.mix.mixsTarget";
public static final String KEY_API_HTTP_ENABLE = "cli.api.http-enable"; public static final String KEY_API_HTTP_ENABLE = "cli.api.http-enable";
public ApiCliConfig() {} public ApiCliConfig() {}
...@@ -128,7 +127,6 @@ public class ApiCliConfig { ...@@ -128,7 +127,6 @@ public class ApiCliConfig {
private Integer clientDelay; private Integer clientDelay;
private Integer tx0MaxOutputs; private Integer tx0MaxOutputs;
private Boolean autoMix; private Boolean autoMix;
private Integer mixsTarget;
public ApiMixConfig() {} public ApiMixConfig() {}
...@@ -137,7 +135,6 @@ public class ApiCliConfig { ...@@ -137,7 +135,6 @@ public class ApiCliConfig {
this.clientDelay = mixConfig.getClientDelay(); this.clientDelay = mixConfig.getClientDelay();
this.tx0MaxOutputs = mixConfig.getTx0MaxOutputs(); this.tx0MaxOutputs = mixConfig.getTx0MaxOutputs();
this.autoMix = mixConfig.isAutoMix(); this.autoMix = mixConfig.isAutoMix();
this.mixsTarget = mixConfig.getMixsTarget();
} }
public void toProperties(Properties props) throws NotifiableException { public void toProperties(Properties props) throws NotifiableException {
...@@ -162,12 +159,6 @@ public class ApiCliConfig { ...@@ -162,12 +159,6 @@ public class ApiCliConfig {
if (autoMix != null) { if (autoMix != null) {
props.put(KEY_MIX_AUTO_MIX, Boolean.toString(autoMix)); props.put(KEY_MIX_AUTO_MIX, Boolean.toString(autoMix));
} }
if (mixsTarget != null) {
if (mixsTarget < 1) {
throw new NotifiableException("mix.mixTargets should be > 0");
}
props.put(KEY_MIX_MIXS_TARGET, Integer.toString(mixsTarget));
}
} }
public Integer getClientsPerPool() { public Integer getClientsPerPool() {
...@@ -201,13 +192,5 @@ public class ApiCliConfig { ...@@ -201,13 +192,5 @@ public class ApiCliConfig {
public void setAutoMix(Boolean autoMix) { public void setAutoMix(Boolean autoMix) {
this.autoMix = autoMix; this.autoMix = autoMix;
} }
public Integer getMixsTarget() {
return mixsTarget;
}
public void setMixsTarget(Integer mixsTarget) {
this.mixsTarget = mixsTarget;
}
} }
} }
...@@ -18,14 +18,12 @@ public class ApiUtxo { ...@@ -18,14 +18,12 @@ public class ApiUtxo {
private MixableStatus mixableStatus; private MixableStatus mixableStatus;
private Integer progressPercent; private Integer progressPercent;
private String poolId; private String poolId;
private Integer mixsTarget;
private Integer mixsTargetOrDefault;
private int mixsDone; private int mixsDone;
private String message; private String message;
private String error; private String error;
private Long lastActivityElapsed; private Long lastActivityElapsed;
public ApiUtxo(WhirlpoolUtxo whirlpoolUtxo, int mixsTargetMin) { public ApiUtxo(WhirlpoolUtxo whirlpoolUtxo) {
UnspentOutput utxo = whirlpoolUtxo.getUtxo(); UnspentOutput utxo = whirlpoolUtxo.getUtxo();
this.hash = utxo.tx_hash; this.hash = utxo.tx_hash;
this.index = utxo.tx_output_n; this.index = utxo.tx_output_n;
...@@ -43,8 +41,6 @@ public class ApiUtxo { ...@@ -43,8 +41,6 @@ public class ApiUtxo {
this.progressPercent = this.progressPercent =
utxoState.getMixProgress() != null ? utxoState.getMixProgress().getProgressPercent() : null; utxoState.getMixProgress() != null ? utxoState.getMixProgress().getProgressPercent() : null;
this.poolId = whirlpoolUtxo.getPoolId(); this.poolId = whirlpoolUtxo.getPoolId();
this.mixsTarget = whirlpoolUtxo.getMixsTarget();
this.mixsTargetOrDefault = whirlpoolUtxo.getMixsTargetOrDefault(mixsTargetMin);
this.mixsDone = whirlpoolUtxo.getMixsDone(); this.mixsDone = whirlpoolUtxo.getMixsDone();
this.message = utxoState.getMessage(); this.message = utxoState.getMessage();
this.error = utxoState.getError(); this.error = utxoState.getError();
...@@ -102,14 +98,6 @@ public class ApiUtxo { ...@@ -102,14 +98,6 @@ public class ApiUtxo {
return poolId; return poolId;
} }
public Integer getMixsTarget() {
return mixsTarget;
}
public Integer getMixsTargetOrDefault() {
return mixsTargetOrDefault;
}
public int getMixsDone() { public int getMixsDone() {
return mixsDone; return mixsDone;
} }
......
package com.samourai.whirlpool.cli.api.protocol.beans;
public class ApiUtxoRef {
private String hash;
private int index;
public ApiUtxoRef(String hash, int index) {
this.hash = hash;
this.index = index;
}
public String getHash() {
return hash;
}
public int getIndex() {
return index;
}
}
...@@ -11,15 +11,12 @@ public class ApiWallet { ...@@ -11,15 +11,12 @@ public class ApiWallet {
private String zpub; private String zpub;
public ApiWallet( public ApiWallet(
Collection<WhirlpoolUtxo> whirlpoolUtxos, Collection<WhirlpoolUtxo> whirlpoolUtxos, String zpub, Comparator<WhirlpoolUtxo> comparator) {
String zpub,
Comparator<WhirlpoolUtxo> comparator,
int mixsTargetMin) {
this.utxos = this.utxos =
whirlpoolUtxos whirlpoolUtxos
.stream() .stream()
.sorted(comparator) .sorted(comparator)
.map(whirlpoolUtxo -> new ApiUtxo(whirlpoolUtxo, mixsTargetMin)) .map(whirlpoolUtxo -> new ApiUtxo(whirlpoolUtxo))
.collect(Collectors.toList()); .collect(Collectors.toList());
this.balance = this.balance =
whirlpoolUtxos.stream().mapToLong(whirlpoolUtxo -> whirlpoolUtxo.getUtxo().value).sum(); whirlpoolUtxos.stream().mapToLong(whirlpoolUtxo -> whirlpoolUtxo.getUtxo().value).sum();
......
package com.samourai.whirlpool.cli.api.protocol.rest; package com.samourai.whirlpool.cli.api.protocol.rest;
import com.samourai.whirlpool.cli.api.protocol.beans.ApiUtxoRef;
import com.samourai.whirlpool.client.wallet.beans.Tx0FeeTarget; import com.samourai.whirlpool.client.wallet.beans.Tx0FeeTarget;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
public class ApiTx0PreviewRequest { public class ApiTx0PreviewRequest {
@NotNull public ApiUtxoRef[] inputs;
@NotNull public Tx0FeeTarget feeTarget; @NotNull public Tx0FeeTarget feeTarget;
@NotNull public String poolId; @NotNull public String poolId;
......
package com.samourai.whirlpool.cli.api.protocol.rest; package com.samourai.whirlpool.cli.api.protocol.rest;
public class ApiTx0Request extends ApiTx0PreviewRequest { public class ApiTx0Request extends ApiTx0PreviewRequest {
public Integer mixsTarget;
public ApiTx0Request() {} public ApiTx0Request() {}
} }
...@@ -2,7 +2,6 @@ package com.samourai.whirlpool.cli.api.protocol.rest; ...@@ -2,7 +2,6 @@ package com.samourai.whirlpool.cli.api.protocol.rest;
public class ApiUtxoConfigureRequest { public class ApiUtxoConfigureRequest {
public String poolId; public String poolId;
public int mixsTarget;
public ApiUtxoConfigureRequest() {} public ApiUtxoConfigureRequest() {}
} }
...@@ -12,7 +12,7 @@ public class ApiWalletStateResponse { ...@@ -12,7 +12,7 @@ public class ApiWalletStateResponse {
private int nbQueued;