fix sendtest (when change would be dust, it won't generate it)
MODIFY
HiddenWallet.Tests/SendTests.cs
HiddenWallet.Tests/SendTests.cs
@@ -55,6 +55,7 @@ namespace HiddenWallet.Tests
#region Basic
+ Debug.WriteLine((await walletJob.GetUnusedScriptPubKeysAsync(AddressType.Pay2PublicKeyHash, account, HdPathType.Receive)).FirstOrDefault().GetDestinationAddress(Network.TestNet).ToString());
var receive = (await walletJob.GetUnusedScriptPubKeysAsync(AddressType.Pay2WitnessPublicKeyHash, account, HdPathType.Receive)).FirstOrDefault();
var getBalanceResult = await walletJob.GetBalanceAsync(account);
@@ -67,13 +68,16 @@ namespace HiddenWallet.Tests
Assert.Empty(res.FailingReason);
Assert.Equal(receive, res.ActiveOutput.ScriptPubKey);
Assert.Equal(amountToSend, res.ActiveOutput.Value);
+ if (res.SpentCoins.Sum(x => x.Amount as Money) - res.ActiveOutput.Value == res.Fee) // this happens when change is too small
+ {
Assert.NotNull(res.ChangeOutput);
Assert.Contains(res.Transaction.Outputs, x => x.Value == res.ChangeOutput.Value);
+ Debug.WriteLine($"Change Output: {res.ChangeOutput.Value.ToString(false, true)} {res.ChangeOutput.ScriptPubKey.GetDestinationAddress(network)}");
+ }
Debug.WriteLine($"Fee: {res.Fee}");
Debug.WriteLine($"FeePercentOfSent: {res.FeePercentOfSent} %");
Debug.WriteLine($"SpendsUnconfirmed: {res.SpendsUnconfirmed}");
Debug.WriteLine($"Active Output: {res.ActiveOutput.Value.ToString(false, true)} {res.ActiveOutput.ScriptPubKey.GetDestinationAddress(network)}");
- Debug.WriteLine($"Change Output: {res.ChangeOutput.Value.ToString(false, true)} {res.ChangeOutput.ScriptPubKey.GetDestinationAddress(network)}");
Debug.WriteLine($"TxId: {res.Transaction.GetHash()}");
var foundReceive = false;

fix sendtest (when change would be dust, it won't generate it)