I don't think this is possible with the current SendRequest API. As you noted, the "emptyWallet" flag is very specialized.
It would be great to replace the emptyWallet flag by a recipientPaysFee field. Though in your of multiple outputs, behaviour would be a bit fluffy. Should it deduct the fee from all outputs or just one? Should it deduct weighted by output amount? Anyway, in your case I'd probably look into the emptyWallet code path (mainly Wallet.adjustOutputDownwardsForFee()) and implement something similar. On 05/15/2016 02:44 AM, Michael Bumann wrote: > Hey, > > I am trying to spent the total amount that is in the wallet and send it > evenly to multiple/n outputs. > > If I understand the code correctly the SendRequest#emptyWallet option > supports only one output (basically it removes all outputs and changes > the value of the first output to the maximum amount.) > > How would I best calculated a fee for the transaction with n outputs and > get inputs without adding a change output? > > This is some basic code trying to use a normal SendRequest: > https://gist.github.com/bumi/6d58f86e2c88a89bc79107f6e741690a > > Do I have to implement a custom completeTX() method? Does anybody have > any hints? > > Thanks a lot! > Michael > > -- > You received this message because you are subscribed to the Google > Groups "bitcoinj" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "bitcoinj" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
