Permalink
Browse files

Fix random signing failure.

Resolves #716
  • Loading branch information...
nopara73 committed Nov 2, 2018
1 parent 52621a6 commit e951d6576b0b1f48aa28be8aa462da8ead1349a7
Showing with 11 additions and 6 deletions.
  1. +11 −6 WalletWasabi/Services/CcjClient.cs
@@ -325,12 +325,17 @@ private async Task TryProcessRoundStateAsync(long ongoingRoundId)
throw new NotSupportedException("Coordinator did not add enough value to our outputs in the coinjoin.");
}
var builder = Network.CreateTransactionBuilder();
var signedCoinJoin = builder
.ContinueToBuild(unsignedCoinJoin)
.AddKeys(ongoingRound.CoinsRegistered.Select(x => x.Secret = x.Secret ?? KeyManager.GetSecrets(OnePiece, x.ScriptPubKey).Single()).ToArray())
.AddCoins(ongoingRound.CoinsRegistered.Select(x => x.GetCoin()))
.BuildTransaction(true);
var signedCoinJoin = unsignedCoinJoin.Clone();
signedCoinJoin.Sign(ongoingRound.CoinsRegistered.Select(x => x.Secret = x.Secret ?? KeyManager.GetSecrets(OnePiece, x.ScriptPubKey).Single()).ToArray(), ongoingRound.CoinsRegistered.Select(x => x.GetCoin()).ToArray());
// Old way of signing, which randomly fails! https://github.com/zkSNACKs/WalletWasabi/issues/716#issuecomment-435498906
// Must be fixed in NBitcoin.
//var builder = Network.CreateTransactionBuilder();
//var signedCoinJoin = builder
// .ContinueToBuild(unsignedCoinJoin)
// .AddKeys(ongoingRound.CoinsRegistered.Select(x => x.Secret = x.Secret ?? KeyManager.GetSecrets(OnePiece, x.ScriptPubKey).Single()).ToArray())
// .AddCoins(ongoingRound.CoinsRegistered.Select(x => x.GetCoin()))
// .BuildTransaction(true);
var myDic = new Dictionary<int, WitScript>();

0 comments on commit e951d65

Please sign in to comment.