-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: consider non-denominated coins in mixing progress calc (#249)
* fix: consider non-denominated coins in mixing progress calc * tests: add coinjoin-unmixed.wallet * tests: fix context
- Loading branch information
1 parent
5c96255
commit e8f0dae
Showing
5 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
core/src/test/java/org/bitcoinj/wallet/CoinJoinExtensionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.bitcoinj.wallet; | ||
|
||
import org.bitcoinj.core.Coin; | ||
import org.bitcoinj.core.Context; | ||
import org.bitcoinj.params.TestNet3Params; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class CoinJoinExtensionTest { | ||
|
||
@Test public void emptyWalletProgressTest() { | ||
new Context(TestNet3Params.get()); | ||
try (InputStream is = getClass().getResourceAsStream("coinjoin-unmixed.wallet")) { | ||
WalletEx wallet = (WalletEx) new WalletProtobufSerializer().readWallet(is); | ||
assertEquals(Coin.valueOf(99999628), wallet.getBalance(Wallet.BalanceType.ESTIMATED)); | ||
|
||
assertEquals(0.00, wallet.getCoinJoin().getMixingProgress(), 0.001); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} catch (UnreadableWalletException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
Binary file not shown.