Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Whirlpool
whirlpool-client-cli
Commits
47b23235
Commit
47b23235
authored
Oct 17, 2020
by
zeroleak
Browse files
reformat "mixing threads" command output
parent
38b629fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
5 deletions
+49
-5
src/main/java/com/samourai/whirlpool/cli/run/CliStatusInteractiveOrchestrator.java
...i/whirlpool/cli/run/CliStatusInteractiveOrchestrator.java
+46
-4
src/main/java/com/samourai/whirlpool/cli/run/CliStatusOrchestrator.java
...com/samourai/whirlpool/cli/run/CliStatusOrchestrator.java
+3
-1
No files found.
src/main/java/com/samourai/whirlpool/cli/run/CliStatusInteractiveOrchestrator.java
View file @
47b23235
package
com.samourai.whirlpool.cli.run
;
import
com.samourai.wallet.api.backend.beans.UnspentOutput
;
import
com.samourai.wallet.util.AbstractOrchestrator
;
import
com.samourai.whirlpool.cli.config.CliConfig
;
import
com.samourai.whirlpool.cli.exception.NoSessionWalletException
;
...
...
@@ -7,9 +8,7 @@ import com.samourai.whirlpool.cli.services.CliWalletService;
import
com.samourai.whirlpool.cli.utils.CliUtils
;
import
com.samourai.whirlpool.client.utils.ClientUtils
;
import
com.samourai.whirlpool.client.wallet.WhirlpoolWallet
;
import
com.samourai.whirlpool.client.wallet.beans.MixingState
;
import
com.samourai.whirlpool.client.wallet.beans.WhirlpoolAccount
;
import
com.samourai.whirlpool.client.wallet.beans.WhirlpoolUtxo
;
import
com.samourai.whirlpool.client.wallet.beans.*
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.stream.Collectors
;
...
...
@@ -69,11 +68,54 @@ public class CliStatusInteractiveOrchestrator extends AbstractOrchestrator {
MixingState
mixingState
=
whirlpoolWallet
.
getMixingState
();
log
.
info
(
"⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿"
);
log
.
info
(
"⣿ MIXING THREADS:"
);
String
lineFormat
=
"| %8s | %25s | %8s | %10s | %10s | %8s | %68s | %14s | %8s | %8s |\n"
;
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
String
.
format
(
lineFormat
,
"THREAD"
,
"STATUS"
,
"SINCE"
,
"ACCOUNT"
,
"BALANCE"
,
"CONFIRMS"
,
"UTXO"
,
"PATH"
,
"POOL"
,
"MIXS"
));
int
i
=
0
;
long
now
=
System
.
currentTimeMillis
();
for
(
WhirlpoolUtxo
whirlpoolUtxo
:
mixingState
.
getUtxosMixing
())
{
log
.
info
(
"⣿ Thread #"
+
(
i
+
1
)
+
": MIXING "
+
whirlpoolUtxo
.
toString
());
MixProgress
mixProgress
=
whirlpoolUtxo
.
getUtxoState
().
getMixProgress
();
String
progress
=
mixProgress
!=
null
?
mixProgress
.
toString
()
:
""
;
String
since
=
mixProgress
!=
null
?
((
now
-
mixProgress
.
getSince
())
/
1000
)
+
"s"
:
""
;
UnspentOutput
o
=
whirlpoolUtxo
.
getUtxo
();
String
utxo
=
o
.
tx_hash
+
":"
+
o
.
tx_output_n
;
int
mixsTargetMin
=
cliConfig
.
getMix
().
getMixsTarget
();
int
mixsTargetOrDefault
=
whirlpoolUtxo
.
getMixsTargetOrDefault
(
mixsTargetMin
);
sb
.
append
(
String
.
format
(
lineFormat
,
"#"
+
(
i
+
1
),
progress
,
since
,
whirlpoolUtxo
.
getAccount
().
name
(),
ClientUtils
.
satToBtc
(
o
.
value
),
o
.
confirmations
,
utxo
,
o
.
getPath
(),
whirlpoolUtxo
.
getPoolId
()
!=
null
?
whirlpoolUtxo
.
getPoolId
()
:
"-"
,
whirlpoolUtxo
.
getMixsDone
()
+
"/"
+
(
mixsTargetOrDefault
==
WhirlpoolUtxoConfig
.
MIXS_TARGET_UNLIMITED
?
"∞"
:
mixsTargetOrDefault
)));
i
++;
}
log
.
info
(
"\n"
+
sb
.
toString
());
}
catch
(
NoSessionWalletException
e
)
{
System
.
out
.
print
(
"⣿ Wallet CLOSED\r"
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/samourai/whirlpool/cli/run/CliStatusOrchestrator.java
View file @
47b23235
...
...
@@ -86,7 +86,9 @@ public class CliStatusOrchestrator extends AbstractOrchestrator {
+
mixingState
.
getNbQueuedLiquidity
()
+
"), total "
+
balanceTotal
+
"btc. Commands: [T]hreads, [D]eposit("
+
"btc. Commands: [T]hreads("
+
mixingState
.
getNbMixing
()
+
"), [D]eposit("
+
nbDeposit
+
"), [P]remix("
+
nbPremix
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment