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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to