bitcoin-rpc-client icon indicating copy to clipboard operation
bitcoin-rpc-client copied to clipboard

Error on BitcoinJSONRPCClient.getDifficulty()

Open henriquetft opened this issue 5 years ago • 0 comments

Sometimes it throws the following exception:

Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to java.math.BigDecimal
	at wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient.getDifficulty(BitcoinJSONRPCClient.java:1005)
	

It occurs because bitcoin core not always return a decimal number from "getdifficulty" operation and the response parser delivers the number as a Long in this case, but BitcoinJSONRPCClient.getDifficult tries to convert it to BigDecimal

henriquetft avatar May 13 '20 23:05 henriquetft