mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Wallet: Hide Wallet(Context, KeyChainGroup) constructor.
This commit is contained in:
parent
b3583d5d7d
commit
7ad2da9ab1
@ -267,9 +267,7 @@ public class Wallet extends BaseTaggableObject
|
|||||||
this(Context.getOrCreate(params), keyChainGroup);
|
this(Context.getOrCreate(params), keyChainGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: When this class moves to the Wallet package, along with the protobuf serializer, then hide this.
|
private Wallet(Context context, KeyChainGroup keyChainGroup) {
|
||||||
/** For internal use only. */
|
|
||||||
public Wallet(Context context, KeyChainGroup keyChainGroup) {
|
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.params = context.getParams();
|
this.params = context.getParams();
|
||||||
this.keyChainGroup = checkNotNull(keyChainGroup);
|
this.keyChainGroup = checkNotNull(keyChainGroup);
|
||||||
|
@ -68,17 +68,17 @@ public class BloomFilterTest {
|
|||||||
@Test
|
@Test
|
||||||
public void walletTest() throws Exception {
|
public void walletTest() throws Exception {
|
||||||
NetworkParameters params = MainNetParams.get();
|
NetworkParameters params = MainNetParams.get();
|
||||||
Context context = new Context(params);
|
Context.propagate(new Context(params));
|
||||||
|
|
||||||
DumpedPrivateKey privKey = DumpedPrivateKey.fromBase58(params, "5Kg1gnAjaLfKiwhhPpGS3QfRg2m6awQvaj98JCZBZQ5SuS2F15C");
|
DumpedPrivateKey privKey = DumpedPrivateKey.fromBase58(params, "5Kg1gnAjaLfKiwhhPpGS3QfRg2m6awQvaj98JCZBZQ5SuS2F15C");
|
||||||
|
|
||||||
Address addr = privKey.getKey().toAddress(params);
|
Address addr = privKey.getKey().toAddress(params);
|
||||||
assertTrue(addr.toString().equals("17Wx1GQfyPTNWpQMHrTwRSMTCAonSiZx9e"));
|
assertTrue(addr.toString().equals("17Wx1GQfyPTNWpQMHrTwRSMTCAonSiZx9e"));
|
||||||
|
|
||||||
KeyChainGroup group = new KeyChainGroup(params);
|
KeyChainGroup group = new KeyChainGroup(params);
|
||||||
// Add a random key which happens to have been used in a recent generation
|
// 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")));
|
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")));
|
wallet.commitTx(new Transaction(params, HEX.decode("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0d038754030114062f503253482fffffffff01c05e559500000000232103cb219f69f1b49468bd563239a86667e74a06fcba69ac50a08a5cbc42a5808e99ac00000000")));
|
||||||
|
|
||||||
// We should have 2 per pubkey, and one for the pay-2-pubkey output we have
|
// We should have 2 per pubkey, and one for the pay-2-pubkey output we have
|
||||||
|
Loading…
x
Reference in New Issue
Block a user