The CancelledKeyException isn't a bad sign. It just happens if some peer
remotely disconnects. PeerGroup will connect the next peer in place.
I don't see the code that actually observes the address. Can you show it?
On 06/11/2021 12.02, Dmitrii Pisarenko wrote:
Hi!
I want to write a piece of code that will observe a particular address.
I am using a local testnet, therefore the first step is to connect to it.
The testnet is created using docker-compose.yml:
version: '3'
services:
node:
image: ulamlabs/bitcoind-custom-regtest:latest
ports:
- "19001:19001"
- "19000:19000"
- "28332:28332"
Full docker-compose.yml file:
https://github.com/mentiflectax/minimal-crypto-exchange/blob/i16/docker-compose.yml
I wrote this:
final WalletAppKit kit = new WalletAppKit(netParams, new File("."),
"_minimalCryptoExchangeBtcWallet");
kit.connectToLocalHost();
kit.setAutoSave(true);
kit.startAsync();
kit.awaitRunning();
Full source code:
https://github.com/mentiflectax/minimal-crypto-exchange/blob/i16/process-engine/src/main/java/com/dpisarenko/minimalcryptoexchange/logic/btc/WalletObserver.java
After kit.awaitRunning(); I am getting the error
java.nio.channels.CancelledKeyException: null
at
java.base/sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:71)
at
java.base/sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:130)
at
java.base/java.nio.channels.SelectionKey.isWritable(SelectionKey.java:377)
at
org.bitcoinj.net.ConnectionHandler.handleKey(ConnectionHandler.java:244)
at
org.bitcoinj.net.NioClientManager.handleKey(NioClientManager.java:86)
at org.bitcoinj.net.NioClientManager.run(NioClientManager.java:122)
at
com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:66)
at
com.google.common.util.concurrent.Callables$4.run(Callables.java:119)
at
org.bitcoinj.utils.ContextPropagatingThreadFactory$1.run(ContextPropagatingThreadFactory.java:51)
at java.base/java.lang.Thread.run(Thread.java:830)
Entire log output is available here:
https://gist.github.com/mentiflectax/189713b44041047145f006b695948c9d
How can I fix this?
Thanks in advance
Dmitrii Pisarenko
P. S.: This question is also available on StackOverflow:
https://stackoverflow.com/questions/69764709/how-can-i-get-notified-when-money-has-been-sent-to-a-particular-bitcoin-address
--
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]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/bitcoinj/904f8072-e0a0-4945-a69a-ed131f287a24n%40googlegroups.com
<https://groups.google.com/d/msgid/bitcoinj/904f8072-e0a0-4945-a69a-ed131f287a24n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bitcoinj/b62af975-0a80-2ad5-9487-d8841e75501a%40schildbach.de.