4

I'm using bitcoinj from a Scala application... and when I start it, I always get the following errors:

[error] o.b.c.Context - Performing thread fixup: you are accessing bitcoinj via a thread that has not had any context set on it.
[error] o.b.c.Context - This error has been corrected for, but doing this makes your app less robust.
[error] o.b.c.Context - You should use Context.propagate() or a ContextPropagatingThreadFactory.
[error] o.b.c.Context - Please refer to the user guide for more information about this.

To send/receive bitcoins I just use class WalletAppKit as described in github:

...

// init
val walletAppKit = new WalletAppKit(...)
walletAppKit.startAsync
walletAppKit.awaitingRunning
walletAppKit.wallet.addEventListener(new WalletListener) 

...

// send coin
val req = Wallet.SendRequest.to(new Address(params, coinAddress), Coin.valueOf(toNanoCoins(amount)))
req.aesKey = wallet.getKeyCrypter.deriveKey(secret)
wallet.sendCoins(req)

...

// listener
class WalletListener extends org.bitcoinj.core.AbstractWalletEventListener {

  override def onCoinsReceived(
    wallet: Wallet,
    transaction: Transaction,
    prevBalance: Coin,
    newBalance: Coin
  ) {
    ...
  }
}

Where should I use Context.propagate to fix this error?

j3d
  • 197
  • 5

0 Answers0