コード例 #1
0
 @Before
 public void setUp() throws Exception {
   BriefLogFormatter.initVerbose();
   Context ctx = new Context(params);
   myWatchedKey = new ECKey();
   myWallet = new Wallet(params);
   myKey = new ECKey();
   myKey.setCreationTimeSeconds(123456789L);
   myWallet.importKey(myKey);
   myAddress = myKey.toAddress(params);
   myWallet = new Wallet(params);
   myWallet.importKey(myKey);
   mScriptCreationTime = new Date().getTime() / 1000 - 1234;
   myWallet.addWatchedAddress(myWatchedKey.toAddress(params), mScriptCreationTime);
   myWallet.setDescription(WALLET_DESCRIPTION);
 }
コード例 #2
0
 @Test
 public void testKeys() throws Exception {
   for (int i = 0; i < 20; i++) {
     myKey = new ECKey();
     myAddress = myKey.toAddress(params);
     myWallet = new Wallet(params);
     myWallet.importKey(myKey);
     Wallet wallet1 = roundTrip(myWallet);
     assertArrayEquals(
         myKey.getPubKey(), wallet1.findKeyFromPubHash(myKey.getPubKeyHash()).getPubKey());
     assertArrayEquals(
         myKey.getPrivKeyBytes(),
         wallet1.findKeyFromPubHash(myKey.getPubKeyHash()).getPrivKeyBytes());
   }
 }