Fix a bug in Base58 decoding. Refactor how it is handled and introduce a new DumpedPrivateKey class that can be used to load keys generated by the dumpprivkey RPC. Use a new VersionedChecksummedBytes class to share the code.

This commit is contained in:
Mike Hearn
2011-05-24 21:42:08 +00:00
parent ab7351ff78
commit 06c84c2c23
7 changed files with 177 additions and 70 deletions

View File

@@ -25,7 +25,8 @@ public class AddressTest {
static final NetworkParameters testParams = NetworkParameters.testNet();
static final NetworkParameters prodParams = NetworkParameters.prodNet();
@Test public void testStringification() throws Exception {
@Test
public void testStringification() throws Exception {
// Test a testnet address.
Address a = new Address(testParams, Hex.decode("fda79a24e50ff70ff42f7d89585da5bd19d9e5cc"));
assertEquals("n4eA2nbYqErp7H6jebchxAN59DmNpksexv", a.toString());
@@ -34,7 +35,8 @@ public class AddressTest {
assertEquals("17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL", b.toString());
}
@Test public void testDecoding() throws Exception {
@Test
public void testDecoding() throws Exception {
Address a = new Address(testParams, "n4eA2nbYqErp7H6jebchxAN59DmNpksexv");
assertEquals("fda79a24e50ff70ff42f7d89585da5bd19d9e5cc", Utils.bytesToHexString(a.getHash160()));