In BitcoinJ, do I need to run downloadBlockChain() again after adding a new key?

0

I added a Wallet instance to PeerGroup instance and executed downloadBlockChain() method. Now if I add a key(s) to that wallet, do I have to execute downloadBlockChain() again to get a current balance including a new key or will it show a right balance automatically, assuming the new key has some balance?

alex3181

Posted 2015-01-02T18:43:18.620

Reputation: 1

Answers

1

Yes. You must call clearTransactions(0) on the Wallet, followed by downloadBlockChain() on the PeerGroup.

BitcoinJ is a thin client, meaning it doesn't download transactions for addresses that aren't in its wallet.

https://bitcoinj.github.io/working-with-the-wallet#replaying-the-chain

Nick ODell

Posted 2015-01-02T18:43:18.620

Reputation: 26 536