More controlled zip alice and requestnode
MODIFY
WalletWasabi/WabiSabi/Client/DependencyGraphResolver.cs
WalletWasabi/WabiSabi/Client/DependencyGraphResolver.cs
@@ -27,8 +27,10 @@ namespace WalletWasabi.WabiSabi.Client
public async Task<List<(Money Amount, Credential[] AmounCreds, Credential[] VsizeCreds)>> ResolveAsync(IEnumerable<AliceClient> aliceClients, BobClient bobClient, CancellationToken cancellationToken)
{
+ var aliceNodePairs = PairAliceClientAndRequestNodes(aliceClients, Graph);
+
// Set the result for the inputs.
- foreach ((var aliceClient, var node) in Enumerable.Zip(aliceClients, Graph.Inputs))
+ foreach ((var aliceClient, var node) in aliceNodePairs)
{
foreach ((var edge, var credential) in Enumerable.Zip(Graph.OutEdges(node, CredentialType.Amount).Where(edge => edge.Value > 0), aliceClient.RealAmountCredentials))
{
@@ -98,5 +100,17 @@ namespace WalletWasabi.WabiSabi.Client
return outputs;
}
+
+ private IEnumerable<(AliceClient AliceClient, RequestNode Node)> PairAliceClientAndRequestNodes(IEnumerable<AliceClient> aliceClients, DependencyGraph graph)
+ {
+ var inputNodes = graph.Inputs;
+
+ if (aliceClients.Count() != inputNodes.Count)
+ {
+ throw new InvalidOperationException("Graph vs Alice inputs mismatch");
+ }
+
+ return aliceClients.OrderBy(alice => alice.Coin.Amount).Zip(inputNodes.OrderBy(node => node.Values[(int)CredentialType.Amount]));
+ }
}
}

More controlled zip alice and requestnode