I tried the code from https://github.com/uniquid/bitcoinj as i needed to try this pull request https://github.com/bitcoinj/bitcoinj/pull/1341
At Mycelium we are aiming to use BitcoinJ as one of the main part of our architecture but we need BIP44 implemented. Happy to contribute in the best way. I am wondering right now if it's not better to contribute on https://github.com/bitcoinj/bitcoinj/pull/1441 instead. But that might be slightly off topic here. Should we move this conversation elsewhere and focus on the bug ? *Nelson MELINA Software Development Engineer* *http://www.linkedin.com/in/nelsonmelina <http://www.linkedin.com/in/nelsonmelina> * On Sat, Sep 16, 2017 at 5:12 PM, Andreas Schildbach <[email protected]> wrote: > Sounds like a bug in bitcoinj. What bitcoinj version are you using? > > > On 09/15/2017 03:29 PM, NelsoN Melina wrote: > > In this code i receive an already signed transaction in the form of a > > byte array and i would like to broadcast it to the Bitcoin network. > > > > | > > | > > > > |overridefun onHandleIntent(intent:Intent?){ > > org.bitcoinj.core.Context.propagate(Constants.CONTEXT) > > if(intent !=null){ > > when(intent.action){ > > ACTION_BROADCAST_TRANSACTION ->{ > > initializeBlockchain(null,0) > > val transactionByteArray =intent.getByteArrayExtra("TX") > > val tx > > =Transaction(Constants.NETWORK_PARAMETERS,transactionByteArray) > > > > tx.getConfidence().setSource(TransactionConfidence.Source.SELF); > > tx.setPurpose(Transaction.Purpose.USER_PAYMENT); > > SpvModuleApplication.getWallet()!!.maybeCommitTx(tx) > > if(peerGroup !=null){ > > val > > transactionBroadcast:TransactionBroadcast=peerGroup!!. > broadcastTransaction(tx) > > val future > > :ListenableFuture<Transaction>=transactionBroadcast.future() > > > > future.get() > > ..........| > > > > | > > > > | > > > > Issue is that in my own code i already propagated the context but then > > internally in BitcoinJ it creates another thread when it has enough > > peers, and then broadcast the transaction from this thread, which fails > > as the Context is not propagated there. > > > > Any pointers as to what i am doing wrong ? > > > > Thanks. > > > > > > 09-14 15:14:52.867 8281-8330/com.m.s.test E/ExecutionList: > > RuntimeException while executing runnable > > org.bitcoinj.core.TransactionBroadcast$ > EnoughAvailablePeers@838ec24 > > with executor org.bitcoinj.utils.Threading$2@7b38d > > java.lang.IllegalStateException: missing context > > > > > > > > at org.bitcoinj.core.Context.get(Context.java:110) > > > > > > > > > > at > > org.bitcoinj.core.Transaction.getConfidence(Transaction. > java:1198) > > > > > > > > > > at > > org.bitcoinj.core.TransactionBroadcast$ > EnoughAvailablePeers.run(TransactionBroadcast.java:134) > > > > > > > > > > at org.bitcoinj.utils.Threading$ > 2.execute(Threading.java:141) > > > > > > > > > > at > > com.google.common.util.concurrent.ExecutionList. > executeListener(ExecutionList.java:156) > > > > > > > > > > at > > com.google.common.util.concurrent.ExecutionList. > execute(ExecutionList.java:145) > > > > > > > > > > at > > com.google.common.util.concurrent.AbstractFuture.set( > AbstractFuture.java:185) > > > > > > > > > > at > > com.google.common.util.concurrent.SettableFuture.set( > SettableFuture.java:53) > > > > > > > > > > at > > org.bitcoinj.core.PeerGroup$14.onPeerConnected(PeerGroup. > java:1938) > > > > > > > > > > at org.bitcoinj.core.PeerGroup$11.run(PeerGroup.java:1565) > > > > > > > > > > at > > org.bitcoinj.utils.Threading$UserThread.run(Threading.java: > 107) > > > > -- > > 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 a topic in the > Google Groups "bitcoinj" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/bitcoinj/ro3__Br8KLo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [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.
