I have a JavaWebApp wich uses bitcoinj 0.13.2 for sending bitcoins from a wallet to a particular address in a
TimerTask. When the job starts, every minute I send 10000 satoshis to the address. The fee of the transaction is 1000 satoshis. Transaction confirmations are 0.
The problem is that I randomly get
InsufficientMoneyException , although there are a lot more funds than 11000 available in the wallet , wich are needed for the transactions.
For example I have successfuly completed 1 job for 30 minutes after that i start another to a different address and on the third transaction i got the exception. Even if the fee is more than 1000 or confirmations set > 0, I can't understand how balance like: 0.10720419 BTC (10720419 satoshis) can be exhausted with two transactions for 10000 satoshis(i tried even with wallet which have balance of 9.43673481 BTC (943673481 satoshis) and it has been exhausted with several transactions too)?
When the transaction is complete everything is normal and the available balance is correct, so i can start another transaction but that can take a lot more time than a minute. I can't understand the reason why so many coins are reserved(unavailable).
If its due confirmations or fees, is there any workaround so transaction per minute goal can be achieved?
I use TestNet3 for testing
walletKit.wallet().sendCoins(walletKit.peerGroup(), to, Coin.valueOf(amount)) for sending coins.
Before transaction that trigger the exception, previous one are in kind of stuck state - it appears only in sender tx history and stuck on 0 notifications for like 1-2 hours. When it receive 1 confirmation it appears on the receiver wallet tx history with 0 confirmation and with other create date(time).Tx.ID is same. I cant understand the reason for this behavior !? At the moment in wallets tx history i got :
sender: date - 10/27/2015 11:35 amount - 0.0001 fee - 0.00001 conf - 3 tx.id:8eee2f5e92edc0ba8ab656e9364646507158fa91f74364815c7b36ecac7fdd69;
receiver: 10/27/2015 13:52 amount - 0.0001 fee - 0.00001 conf - 0 tx.id:8eee2f5e92edc0ba8ab656e9364646507158fa91f74364815c7b36ecac7fdd69.
I am new in bitcoinj and bitcoins at all but that seems very unusual and i really want to figure out the reason for this behavior !?