Wallet: Hide Wallet(Context, KeyChainGroup) constructor.

This commit is contained in:
Andreas Schildbach 2016-02-29 22:58:49 +01:00
parent b3583d5d7d
commit 7ad2da9ab1
2 changed files with 4 additions and 6 deletions

View File

@ -267,9 +267,7 @@ public class Wallet extends BaseTaggableObject
this(Context.getOrCreate(params), keyChainGroup);
}
// TODO: When this class moves to the Wallet package, along with the protobuf serializer, then hide this.
/** For internal use only. */
public Wallet(Context context, KeyChainGroup keyChainGroup) {
private Wallet(Context context, KeyChainGroup keyChainGroup) {
this.context = context;
this.params = context.getParams();
this.keyChainGroup = checkNotNull(keyChainGroup);

View File

@ -68,17 +68,17 @@ public class BloomFilterTest {
@Test
public void walletTest() throws Exception {
NetworkParameters params = MainNetParams.get();
Context context = new Context(params);
Context.propagate(new Context(params));
DumpedPrivateKey privKey = DumpedPrivateKey.fromBase58(params, "5Kg1gnAjaLfKiwhhPpGS3QfRg2m6awQvaj98JCZBZQ5SuS2F15C");
Address addr = privKey.getKey().toAddress(params);
assertTrue(addr.toString().equals("17Wx1GQfyPTNWpQMHrTwRSMTCAonSiZx9e"));
KeyChainGroup group = new KeyChainGroup(params);
// Add a random key which happens to have been used in a recent generation
group.importKeys(ECKey.fromPublicOnly(privKey.getKey().getPubKeyPoint()), ECKey.fromPublicOnly(HEX.decode("03cb219f69f1b49468bd563239a86667e74a06fcba69ac50a08a5cbc42a5808e99")));
Wallet wallet = new Wallet(context, group);
Wallet wallet = new Wallet(params, group);
wallet.commitTx(new Transaction(params, HEX.decode("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0d038754030114062f503253482fffffffff01c05e559500000000232103cb219f69f1b49468bd563239a86667e74a06fcba69ac50a08a5cbc42a5808e99ac00000000")));
// We should have 2 per pubkey, and one for the pay-2-pubkey output we have