cashu-feni icon indicating copy to clipboard operation
cashu-feni copied to clipboard

outputs constructed when doing split can tell mint the intended payment amount vs change

Open elnosh opened this issue 1 year ago • 0 comments

When sending from wallet, the way outputs are constructed in the request for /split they could be telling the mint which is the intended payment amount vs which is the change.

Code in wallet constructing output

	total := SumProofs(proofs)
	frstAmt := total - amount
	scndAmt := amount
	frstOutputs := mint.AmountSplit(frstAmt)
	scndOutputs := mint.AmountSplit(scndAmt)
	amounts := append(frstOutputs, scndOutputs...)

So if user has a balance of 100 and tries a send 20 the output amounts when requesting a split to the mint could look like [16, 64, 4, 16]

Describe the solution you'd like Maybe sort the outputs slice before sending request to mint.

elnosh avatar Sep 29 '23 22:09 elnosh