novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

WalletTool peers.broadcastTransaction(t).get(); issue for continuous sending coins by a program #491

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Only modification done for walletTool is to change the main(String[] args)  
method as  executeWalletTool(String[] args)  method to accept calls  and called 
by another class as follows.
First time it is sending but second time it is waiting for ever when  
broadcasting(peers.broadcastTransaction(t).get();)

public class Operator {
    public   Operator()  {

    }
public void  sendFromSpecifiedWallet ()   {   

        String[] StrArray = new String[4];
        StrArray[0] = "--action=SEND";
        StrArray[1] = "--wallet=TestWallet2.Wallet";
        StrArray[2] = "--output=mmEYv7eQJTuENk9NzB8UCEevJ8pBhozFDi:0.2";
        StrArray[3] = "--output=mmEYv7eQJTuENk9NzB8UCEevJ8pBhozFDi:0.3";
        walletTool  WT =  new walletTool (); 

// Here I changed the main method of the walletTool  as the executeWalletTool  
method and sending the arguments as it is.  

        WT.executeWalletTool(StrArray);  (changed  main method)

    }

}

Next above method is being called by a another simple program as follows

public class UseWalletToolAndSend {

     public static void main(String[] args) throws Exception {

         Operator operate =  new Operator();
         operate .sendFromSpecifiedWallet () ;      // first call of send
          Thread.sleep(5000);
         operate .sendFromSpecifiedWallet () ;  // second call of send

    }
}.

This executes fine first call of send{operate .sendFromSpecifiedWallet () ;   
//   ;      // first call of send}
But   it waits for long in  line peers.broadcastTransaction(t).get(); in send 
method of walletToll when it comes to execute  second call of  send{ operate 
.sendFromSpecifiedWallet () ;   // second call of send}

Original issue reported on code.google.com by anura.ba...@gmail.com on 4 Dec 2013 at 2:26

GoogleCodeExporter commented 9 years ago
WalletTool isn't designed to be used like that, so it's not a surprise that it 
doesn't work. Why are you trying to do this? You should probably look at the 
documentation for WalletAppKit or read the getting started guide:

https://code.google.com/p/bitcoinj/wiki/GettingStarted

Original comment by hearn@google.com on 4 Dec 2013 at 10:08