Satoshis

Satoshis

5.6k Downloads

Bug on download of blockchain and with concurrency

lusid opened this issue ยท 2 comments

commented

Awesome plugin! Unfortunately, I haven't actually seen it modify my player's money amount yet (but I can see the transaction in the log). I had it set to 2 confirms, and it blew right past that and never triggered the add in the check() routine.

I tried to correct for it by deleting the blockchain file and letting it redownload (with the same wallet file in place). But it throws this (I'm guessing right around the time it gets to my transaction):

05:47:12 [INFO] Chain download 98% done with 4657 blocks to go, block date Mar 27, 2013 5:53:30 AM
05:47:13 [INFO] Chain download 99% done with 2328 blocks to go, block date Apr 9, 2013 11:25:59 PM
05:47:14 [SEVERE] java.lang.IllegalStateException
05:47:14 [SEVERE] at com.google.common.base.Preconditions.checkState(Preconditions.java:129)
05:47:14 [SEVERE] at com.google.bitcoin.core.Wallet.addWalletTransaction(Wallet.java:1543)
05:47:14 [SEVERE] at com.google.bitcoin.core.Wallet.processTxFromBestChain(Wallet.java:1250)
05:47:14 [SEVERE] at com.google.bitcoin.core.Wallet.receive(Wallet.java:1115)
05:47:14 [SEVERE] at com.google.bitcoin.core.Wallet.receiveFromBlock(Wallet.java:1034)
05:47:14 [SEVERE] at com.google.bitcoin.core.AbstractBlockChain.sendTransactionsToListener(AbstractBlockChain.java:643)
05:47:14 [SEVERE] at com.google.bitcoin.core.AbstractBlockChain.connectBlock(AbstractBlockChain.java:412)
05:47:14 [SEVERE] at com.google.bitcoin.core.AbstractBlockChain.add(AbstractBlockChain.java:360)
05:47:14 [SEVERE] at com.google.bitcoin.core.AbstractBlockChain.add(AbstractBlockChain.java:248)
05:47:14 [SEVERE] at com.google.bitcoin.core.Peer.endFilteredBlock(Peer.java:753)
05:47:14 [SEVERE] at com.google.bitcoin.core.Peer.processMessage(Peer.java:258)
05:47:14 [SEVERE] at com.google.bitcoin.core.Peer.access$400(Peer.java:48)
05:47:14 [SEVERE] at com.google.bitcoin.core.Peer$PeerHandler.messageReceived(Peer.java:237)
05:47:14 [SEVERE] at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88)
05:47:14 [SEVERE] at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
05:47:14 [SEVERE] at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
05:47:14 [SEVERE] at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
05:47:14 [SEVERE] at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
05:47:14 [SEVERE] at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536)
05:47:14 [SEVERE] at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:485)
05:47:14 [SEVERE] at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
05:47:14 [SEVERE] at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
05:47:14 [SEVERE] at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555)
05:47:14 [SEVERE] at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
05:47:14 [SEVERE] at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
05:47:14 [SEVERE] at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
05:47:14 [SEVERE] at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
05:47:14 [SEVERE] at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
05:47:14 [SEVERE] at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
05:47:14 [SEVERE] at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
05:47:14 [SEVERE] at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
05:47:14 [SEVERE] at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
05:47:14 [SEVERE] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
05:47:14 [SEVERE] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
05:47:14 [SEVERE] at java.lang.Thread.run(Thread.java:722)

As a separate issue, totally not compatible with ProtocolLib, which I have loaded for Orebfuscator. If I have them both enabled, I get this at boot:

05:51:19 [INFO] [Satoshis] Checking for 2 confirmations every 60 seconds.
05:51:19 [INFO] [Satoshis] Adding 0 old transactions to the check pool!
05:51:19 [SEVERE] Error occurred while enabling Satoshis v1.0 (Is it up to date?)
java.lang.SecurityException: sealing violation: package com.google.common.util.concurrent is sealed
at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:388)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:417)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
at org.bukkit.plugin.java.JavaPluginLoader.getClassByName0(JavaPluginLoader.java:300)
at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:76)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.google.bitcoin.core.Wallet.(Wallet.java:88)
at com.google.bitcoin.store.WalletExtensionSerializer.newWallet(WalletExtensionSerializer.java:39)
at com.google.bitcoin.store.WalletProtobufSerializer.readWallet(WalletProtobufSerializer.java:334)
at com.google.bitcoin.core.Wallet.loadFromFileStream(Wallet.java:797)
at com.google.bitcoin.core.Wallet.loadFromFile(Wallet.java:718)
at me.meta1203.plugins.satoshis.bitcoin.BitcoinAPI.(BitcoinAPI.java:28)
at me.meta1203.plugins.satoshis.Satoshis.onEnable(Satoshis.java:80)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
at org.bukkit.craftbukkit.v1_5_R2.CraftServer.loadPlugin(CraftServer.java:282)
at org.bukkit.craftbukkit.v1_5_R2.CraftServer.enablePlugins(CraftServer.java:264)
at org.bukkit.craftbukkit.v1_5_R2.CraftServer.(CraftServer.java:218)
at net.minecraft.server.v1_5_R2.PlayerList.(PlayerList.java:55)
at net.minecraft.server.v1_5_R2.DedicatedPlayerList.(SourceFile:11)
at net.minecraft.server.v1_5_R2.DedicatedServer.init(DedicatedServer.java:105)
at net.minecraft.server.v1_5_R2.MinecraftServer.run(MinecraftServer.java:381)
at net.minecraft.server.v1_5_R2.ThreadServerApplication.run(SourceFile:573)

Hope this helps in someway. If I'm doing something totally wrong, that would be helpful as well. Keep it up. ๐Ÿ‘

commented

Devil's advocate is fine by me. Whatever it takes in the hopes I might be able to use it! :-D

The second error was created with only ProtocolLib and Satoshis installed after removing all of the plugin created files from the Satoshis folder, so in that particular instance, it didn't detect anything because it generated a new wallet. I wanted to start completely clean for that so I could ensure that it really was a conflict between those two plugins.

As for the first error, yes, definitely. The first time I tried it, everything seemed great... it was showing the transaction in the info screen and the number of confirmations it had, but /money showed 0.0 MTC. A /syscheck reported there was more Satoshi than MTC. I let it get up to 11 confirmations before I decided I must have done something wrong and decided to remove the block chain and the temp file in the hopes that it would pick it back up the second time around. That is when the first error appeared. It is just odd because almost every wallet I've ever used works in this manner... as long as I don't remove the wallet file, it should see it when it is downloading, correct?

To add to it, I know it broke on my transaction because the one time I got the server to actually keep running past the error, it showed the transaction in the info screen again like last time, only it had 0 confirmations (like it broke down after seeing a known address the first time in the blockchain).

commented

Hate to play devils advocate here, but are you POSITIVE that 2 confirmations were done AND Satoshis received them? I would try again using TestNet3, and try waiting for a long time.

As for the ProtocolLib, it looks like you are loading the plugin twice, or something is causing the wallet to be invoked more than once. Check your plugins, and if you're sure that this isn't happening, then I'll look deeper.