Here are the changes to the LitecoinParams that will resolve the error in the OP:
diff --git a/core/src/main/java/org/litecoin/LitecoinParams.java b/core/src/main/java/org/litecoin/LitecoinParams.java
index c33b770..1bf631a 100644
--- a/core/src/main/java/org/litecoin/LitecoinParams.java
+++ b/core/src/main/java/org/litecoin/LitecoinParams.java
@@ -38,7 +38,7 @@ public class LitecoinParams extends NetworkParameters {
id = "org.litecoin.production";
proofOfWorkLimit = Utils.decodeCompactBits(0x1e0fffffL);
addressHeader = 15;
- acceptableAddressCodes = new int[] { 48 };
+ acceptableAddressCodes = new int[] { 15 };
port = 12622;
packetMagic = 0xfbc0b6dbL;
dumpedPrivateKeyHeader = 128 + addressHeader;
@@ -54,15 +54,15 @@ public class LitecoinParams extends NetworkParameters {
try {
// A script containing the difficulty bits and the following message:
//
- // "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"
+ // "Irish universities fail to make list of top 100 institutions"
byte[] bytes = Hex.decode
- ("0497269736820756e69766572736974696573206661696c20746f206d616b65206c697374206f6620746f702031303020696e737469747574696f6e73");
+ ("04ffff001d01043c497269736820756e69766572736974696573206661696c20746f206d616b65206c697374206f6620746f702031303020696e737469747574696f6e73");
t.addInput(new TransactionInput(this, t, bytes));
ByteArrayOutputStream scriptPubKeyBytes = new ByteArrayOutputStream();
Script.writeBytes(scriptPubKeyBytes, Hex.decode
("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9"));
scriptPubKeyBytes.write(ScriptOpCodes.OP_CHECKSIG);
- t.addOutput(new TransactionOutput(this, t, Utils.toNanoCoins(50, 0), scriptPubKeyBytes.toByteArray()));
+ t.addOutput(new TransactionOutput(this, t, Utils.toNanoCoins(25, 0), scriptPubKeyBytes.toByteArray()));
} catch (Exception e) {
// Cannot happen.
throw new RuntimeException(e);
However, there is still another exception:
04-26 21:17:53.514 2633-2692/de.schildbach.wallet_ltc E/AndroidRuntime﹕ FATAL EXCEPTION: PeerGroup
java.lang.RuntimeException: java.io.IOException: pipe failed: EMFILE (Too many open files)
at com.google.bitcoin.net.NioClientManager.<init>(NioClientManager.java:85)
at com.google.bitcoin.core.PeerGroup.<init>(PeerGroup.java:207)
at com.google.bitcoin.core.PeerGroup.<init>(PeerGroup.java:199)
at org.litecoin.LitcoinPeerDBDiscovery$PeerGroupWrapper.<init>(LitcoinPeerDBDiscovery.java:75)
at org.litecoin.LitcoinPeerDBDiscovery$PeerGroupWrapper.<init>(LitcoinPeerDBDiscovery.java:71)
at org.litecoin.LitcoinPeerDBDiscovery.<init>(LitcoinPeerDBDiscovery.java:86)
at de.schildbach.wallet.service.BlockchainServiceImpl$3$1.getPeers(BlockchainServiceImpl.java:425)
at com.google.bitcoin.core.PeerGroup.discoverPeers(PeerGroup.java:502)
at com.google.bitcoin.core.PeerGroup.connectToAnyPeer(PeerGroup.java:556)
at com.google.bitcoin.core.PeerGroup.run(PeerGroup.java:534)
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$1.run(AbstractExecutionThreadService.java:52)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.io.IOException: pipe failed: EMFILE (Too many open files)
at java.nio.SelectorImpl.<init>(SelectorImpl.java:99)
at java.nio.SelectorProviderImpl.openSelector(SelectorProviderImpl.java:41)
at com.google.bitcoin.net.NioClientManager.<init>(NioClientManager.java:83)
at com.google.bitcoin.core.PeerGroup.<init>(PeerGroup.java:207)
at com.google.bitcoin.core.PeerGroup.<init>(PeerGroup.java:199)
at org.litecoin.LitcoinPeerDBDiscovery$PeerGroupWrapper.<init>(LitcoinPeerDBDiscovery.java:75)
at org.litecoin.LitcoinPeerDBDiscovery$PeerGroupWrapper.<init>(LitcoinPeerDBDiscovery.java:71)
at org.litecoin.LitcoinPeerDBDiscovery.<init>(LitcoinPeerDBDiscovery.java:86)
at de.schildbach.wallet.service.BlockchainServiceImpl$3$1.getPeers(BlockchainServiceImpl.java:425)
at com.google.bitcoin.core.PeerGroup.discoverPeers(PeerGroup.java:502)
at com.google.bitcoin.core.PeerGroup.connectToAnyPeer(PeerGroup.java:556)
at com.google.bitcoin.core.PeerGroup.run(PeerGroup.java:534)
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$1.run(AbstractExecutionThreadService.java:52)
at java.lang.Thread.run(Thread.java:856)
Caused by: libcore.io.ErrnoException: pipe failed: EMFILE (Too many open files)
at libcore.io.Posix.pipe(Native Method)
at libcore.io.ForwardingOs.pipe(ForwardingOs.java:94)
at java.nio.SelectorImpl.<init>(SelectorImpl.java:92)
at java.nio.SelectorProviderImpl.openSelector(SelectorProviderImpl.java:41)
at com.google.bitcoin.net.NioClientManager.<init>(NioClientManager.java:83)
at com.google.bitcoin.core.PeerGroup.<init>(PeerGroup.java:207)
at com.google.bitcoin.core.PeerGroup.<init>(PeerGroup.java:199)
at org.litecoin.LitcoinPeerDBDiscovery$PeerGroupWrapper.<init>(LitcoinPeerDBDiscovery.java:75)
at org.litecoin.LitcoinPeerDBDiscovery$PeerGroupWrapper.<init>(LitcoinPeerDBDiscovery.java:71)
at org.litecoin.LitcoinPeerDBDiscovery.<init>(LitcoinPeerDBDiscovery.java:86)
at de.schildbach.wallet.service.BlockchainServiceImpl$3$1.getPeers(BlockchainServiceImpl.java:425)
at com.google.bitcoin.core.PeerGroup.discoverPeers(PeerGroup.java:502)
at com.google.bitcoin.core.PeerGroup.connectToAnyPeer(PeerGroup.java:556)
at com.google.bitcoin.core.PeerGroup.run(PeerGroup.java:534)
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$1.run(AbstractExecutionThreadService.java:52)
at java.lang.Thread.run(Thread.java:856)
This error is a result of some changes the Litecoin Dev Team made to the bitcoin code. I also had this problem when I imported their PeerDBDiscovery class into one of my android apps. Catching this RuntimeException does not solve the problem, but locks up the app. This error does not happen immediately, but after a period of time. Perhaps the pipes are not being closed?
At this time, I don't have a solution for it, except to remove it and use DnsDiscovery instead.