Fix to the PrivateKeys example. Thanks to recallfx for the patch.

This commit is contained in:
Mike Hearn 2014-06-02 21:49:59 +08:00
parent 4e568354be
commit 60e70bd79e

View File

@ -39,9 +39,10 @@ public class PrivateKeys {
NetworkParameters params = MainNetParams.get();
try {
// Decode the private key from Satoshis Base58 variant. If 51 characters long then it's from Bitcoins
// dumpprivkey command and includes a version byte and checksum. Otherwise assume it's a raw key.
// dumpprivkey command and includes a version byte and checksum, or if 52 characters long then it has
// compressed pub key. Otherwise assume it's a raw key.
ECKey key;
if (args[0].length() == 51) {
if (args[0].length() == 51 || args[0].length() == 52) {
DumpedPrivateKey dumpedPrivateKey = new DumpedPrivateKey(params, args[0]);
key = dumpedPrivateKey.getKey();
} else {