I am also facing this issue. Can you tell how to fix this issue ? 

On Saturday, May 13, 2017 at 8:15:16 PM UTC+5:30, Andreas Schildbach wrote:
>
> Yes, using ESTIMATED_SPENDABLE your balance should behave more like you 
> expect. Just beware that you can only spend confirmed coins (as long as 
> you're using the default CoinSelector). 
>
>
> On 05/12/2017 06:53 PM, Ajit Soman wrote: 
> > Hi Oscar, 
> > 
> > I am using this: wallet.getBalance(BalanceType.AVAILABLE_SPENDABLE) to 
> > get balance. 
> > 
> > I am facing this issue in 1 out of 10 transactions . i did a transaction 
> > right now it works fine. i am unable to figure out what is the issue. 
> > 
> > On Friday, May 12, 2017 at 6:32:50 PM UTC+5:30, Oscar Guindzberg wrote: 
> > 
> >     Hi, 
> > 
> >     wallet.getBalance() returns the confirmed balance 
> >     You can use 
> >     wallet.getBalance(Wallet.BalanceType.ESTIMATED) 
> >     to get the unconfirmed balance. 
> > 
> >     Oscar 
> > 
> >     On Thu, May 11, 2017 at 2:04 PM, Ajit Soman <ajitd...@gmail.com> 
> wrote: 
> >     > Hi , 
> >     > 
> >     > Initially my wallet has 2 BTC . I did a transaction of 1 BTC to a 
> >     wallet 
> >     > address . Transaction was successful i got a transaction hash now 
> >     when i 
> >     > check my wallet balance it shows 0 BTC . After getting more than 1 
> >     > confirmation i got my actual wallet balance i.e 1 BTC. Here is my 
> >     > bitcoinTransaction code: 
> >     > 
> >     > public String createTransaction(TransactionParams 
> >     transactionparams) throws 
> >     > Exception { // TransactionParams is a entity 
> >     > String transactionHash = null; 
> >     > Wallet wallet = null; 
> >     > 
> >     > Address receiverAddress; 
> >     > Context.propagate(new Context(netparams.getNetworkParameters())); 
> // 
> >     > netparams is a util through which we are getting testnet3 or 
> mainnet 
> >     > depending upon environment 
> >     > receiverAddress = new Address(netparams.getNetworkParameters(), 
> >     > transactionparams.getReceiverAddress()); 
> >     > String amount = 
> >     > String.valueOf(transactionparams.getTransactionTradeAmount()); 
> >     > System.out.println("Address " + 
> >     transactionparams.getReceiverAddress()); 
> >     > 
> >     > final File walletFile = new File(configuration.getWalletLocation() 
> >     + "/" + 
> >     > transactionparams.getWalletId() + ".dat"); 
> >     > wallet = (Wallet) 
> >     > 
> >     
> walletStoreService.getWalletMap().get(transactionparams.getWalletId()); 
> >     // 
> >     > walletStoreService that has information about wallet object 
> >     > 
> >     > if (walletFile.exists()) { 
> >     > Coin btcCoin = Coin.parseCoin(amount); 
> >     > Wallet.SendRequest.DEFAULT_FEE_PER_KB = Coin.ZERO; 
> >     > 
> >     > SendRequest request = SendRequest.to(receiverAddress, btcCoin); 
> >     > request.ensureMinRequiredFee = false; 
> >     > request.fee = Coin.valueOf(10000); 
> >     > request.feePerKb = Coin.ZERO; 
> >     > request.changeAddress = wallet.currentReceiveAddress(); // one of 
> >     my friend 
> >     > think this line is making this issue 
> >     > 
> >     > Transaction transaction = wallet.sendCoinsOffline(request); 
> >     > TransactionPoolManager.addTransaction(transaction); // 
> >     addTransaction is a 
> >     > method in TransactioPoolManager service 
> >     > walletStoreService.saveWallet(wallet); // saves the wallet object 
> >     > transactionHash = request.tx.getHashAsString(); 
> >     >                         return transactionHash; 
> >     > } else { 
> >     > throw new FileNotFoundException("Wallet not found"); 
> >     > } 
> >     > } 
> >     > 
> >     > 
> >     > addTransaction method in TransactioPoolManager service: 
> >     > 
> >     > private static Vector<Entry> transactionPool; 
> >     > 
> >     > public static void addTransaction(Transaction tx) { 
> >     > if (find(tx) != null) { 
> >     > return; 
> >     > } 
> >     > for (Map.Entry<String, Wallet> entry : 
> >     > walletStoreService.getWalletMap().entrySet()) { 
> >     > if (entry.getValue().isPendingTransactionRelevant(tx)) { 
> >     > transactionPool.add(new Entry(entry.getKey(), tx)); 
> >     > break; 
> >     > } 
> >     > } 
> >     > } 
> >     > 
> >     > Thanks in advance 
> >     > 
> >     > -- 
> >     > 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 bitcoinj+u...@googlegroups.com. 
> >     > For more options, visit https://groups.google.com/d/optout 
> >     <https://groups.google.com/d/optout>. 
> > 
> > 
> > 
> >     -- 
> >     Oscar Guindzberg 
> > 
> > -- 
> > 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 bitcoinj+u...@googlegroups.com <javascript:> 
> > <mailto:bitcoinj+u...@googlegroups.com <javascript:>>. 
> > 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 bitcoinj+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to