Ok, here is the unit tests that fails

public class BitcoinJTest {
    private File rootDirectory = new File(".");
    private NetworkParameters params = TestNet3Params.get();
    private String walletFileName = "RaspberryWallet_" +
params.getPaymentProtocolId();

    @Test
    void testWalletAppKit() {
        File walletFile = getWalletFile();
        if (walletFile.exists()) walletFile.delete();
        assertFalse(walletFile.exists());

        WalletAppKit kit = new WalletAppKit(params, rootDirectory,
walletFileName) {
            @Override
            protected void onSetupCompleted() {
                Logger.info("Bitcoin setup complete");
                assertFalse(walletFile.exists()); //AssertionFailedError
            }
        };

        kit.setAutoSave(false);
        kit.startAsync().awaitRunning();


    }

    public File getWalletFile() {
        return new File(rootDirectory, walletFileName + ".wallet");
    }
}

Exception in thread " STARTING" org.opentest4j.AssertionFailedError:
expected: <false> but was: <true>
        at 
io.raspberrywallet.manager.bitcoin.BitcoinJTest$1.onSetupCompleted(BitcoinJTest.java:28)


What can I do with Wallet without WalletAppKit? How can I embed it into
WalletAppKit? Or just how can I sync it?




sob., 20 paź 2018 o 21:49 Andreas Schildbach <andr...@schildbach.de>
napisał(a):

> Can you write a unit test for this? Bitcoinj shouldn't persist a wallet
> at all unless instructed.
>
> Maybe try using the Wallet class without WalletAppKit?
>
>
> On 19/10/2018 23.05, Stanislaw Baranski wrote:
> > Hello,
> > Thanks for the answer. I tried with wallet() .encryp/.decrypt, but there
> > is a problem. I can not prevent the BitcoinJ from saving the decrypted
> > wallet.
> >
> > Even if I set
> >
> > kit.setAutoSave(false)
> >
> > the .wallet file is still saved.
> > I would like to save it only when it's encrypted like
> >
> > bitcoin.kit.wallet().encrypt(keyCrypter, key);
> > bitcoin.kit.wallet().saveToFile(bitcoin.getWalletFile());
> >
> > Is it possible ?
> >
> >
> > On Wed, Oct 17, 2018 at 12:20 AM Andreas Schildbach
> > <andr...@schildbach.de <mailto:andr...@schildbach.de>> wrote:
> >
> >     Yes, you either could encrypt the keys (and keep the decryption key
> just
> >     in memory). Or you could use a read-only wallet that only has the
> public
> >     keys to begin with.
> >
> >
> >     On 15/10/2018 12.27, Stanislaw Baranski wrote:
> >     > Hello,
> >     > I'm creating the physical wallet (similar to Ledger Nano S), and I
> >     want
> >     > to store private key in my own way. I don't want the BitcoinJ to
> store
> >     > the private key in .wallet file. Is there some way to configure the
> >     > library so it keep the private key in-memory and lost it after the
> >     > session ? I would like to restore/import the private key after some
> >     > process of authorization (button, pin, 2FA etc.).
> >     >
> >     > Or maybe should I take use of wallet().encrypt() and
> >     wallet().encrypt()
> >     > is it safer ?
> >     >
> >     > --
> >     > You received this message because you are subscribed to the Google
> >     > Groups "bitcoinj" group.
> >     > To unsubscribe from this group and stop receiving emails from it,
> send
> >     > an email to bitcoinj+unsubscr...@googlegroups.com
> >     <mailto:bitcoinj%2bunsubscr...@googlegroups.com>
> >     > <mailto:bitcoinj+unsubscr...@googlegroups.com
> >     <mailto:bitcoinj%2bunsubscr...@googlegroups.com>>.
> >     > For more options, visit https://groups.google.com/d/optout.
> >
> >
> >     --
> >     You received this message because you are subscribed to a topic in
> >     the Google Groups "bitcoinj" group.
> >     To unsubscribe from this topic, visit
> >     https://groups.google.com/d/topic/bitcoinj/eCRiK0RBdjw/unsubscribe.
> >     To unsubscribe from this group and all its topics, send an email to
> >     bitcoinj+unsubscr...@googlegroups.com
> >     <mailto:bitcoinj%2bunsubscr...@googlegroups.com>.
> >     For more options, visit https://groups.google.com/d/optout.
> >
> > --
> >
> > Stanisław Barański
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "bitcoinj" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to bitcoinj+unsubscr...@googlegroups.com
> > <mailto:bitcoinj+unsubscr...@googlegroups.com>.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "bitcoinj" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/bitcoinj/eCRiK0RBdjw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> bitcoinj+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Best Regards,
Stanislaw Baranski

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bitcoinj+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to