mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 11:15:51 +00:00
KeyBag, TransactionBag: Rename parameters pubkey to pubKey, pubkeyHash to pubKeyHash.
This commit is contained in:
parent
01daaf5815
commit
53908d8939
@ -27,13 +27,13 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface TransactionBag {
|
public interface TransactionBag {
|
||||||
/** Returns true if this wallet contains a public key which hashes to the given hash. */
|
/** Returns true if this wallet contains a public key which hashes to the given hash. */
|
||||||
boolean isPubKeyHashMine(byte[] pubkeyHash);
|
boolean isPubKeyHashMine(byte[] pubKeyHash);
|
||||||
|
|
||||||
/** Returns true if this wallet is watching transactions for outputs with the script. */
|
/** Returns true if this wallet is watching transactions for outputs with the script. */
|
||||||
boolean isWatchedScript(Script script);
|
boolean isWatchedScript(Script script);
|
||||||
|
|
||||||
/** Returns true if this wallet contains a keypair with the given public key. */
|
/** Returns true if this wallet contains a keypair with the given public key. */
|
||||||
boolean isPubKeyMine(byte[] pubkey);
|
boolean isPubKeyMine(byte[] pubKey);
|
||||||
|
|
||||||
/** Returns true if this wallet knows the script corresponding to the given hash. */
|
/** Returns true if this wallet knows the script corresponding to the given hash. */
|
||||||
boolean isPayToScriptHashMine(byte[] payToScriptHash);
|
boolean isPayToScriptHashMine(byte[] payToScriptHash);
|
||||||
|
@ -63,14 +63,14 @@ public class DecryptingKeyBag implements KeyBag {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ECKey findKeyFromPubHash(byte[] pubkeyHash) {
|
public ECKey findKeyFromPubHash(byte[] pubKeyHash) {
|
||||||
return maybeDecrypt(target.findKeyFromPubHash(pubkeyHash));
|
return maybeDecrypt(target.findKeyFromPubHash(pubKeyHash));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ECKey findKeyFromPubKey(byte[] pubkey) {
|
public ECKey findKeyFromPubKey(byte[] pubKey) {
|
||||||
return maybeDecrypt(target.findKeyFromPubKey(pubkey));
|
return maybeDecrypt(target.findKeyFromPubKey(pubKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -32,7 +32,7 @@ public interface KeyBag {
|
|||||||
* @return ECKey object or null if no such key was found.
|
* @return ECKey object or null if no such key was found.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
ECKey findKeyFromPubHash(byte[] pubkeyHash);
|
ECKey findKeyFromPubHash(byte[] pubKeyHash);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locates a keypair from the keychain given the raw public key bytes.
|
* Locates a keypair from the keychain given the raw public key bytes.
|
||||||
@ -40,7 +40,7 @@ public interface KeyBag {
|
|||||||
* @return ECKey or null if no such key was found.
|
* @return ECKey or null if no such key was found.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
ECKey findKeyFromPubKey(byte[] pubkey);
|
ECKey findKeyFromPubKey(byte[] pubKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locates a redeem data (redeem script and keys) from the keychain given the hash of the script.
|
* Locates a redeem data (redeem script and keys) from the keychain given the hash of the script.
|
||||||
|
@ -388,25 +388,25 @@ public class KeyChainGroup implements KeyBag {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ECKey findKeyFromPubHash(byte[] pubkeyHash) {
|
public ECKey findKeyFromPubHash(byte[] pubKeyHash) {
|
||||||
ECKey result;
|
ECKey result;
|
||||||
if ((result = basic.findKeyFromPubHash(pubkeyHash)) != null)
|
if ((result = basic.findKeyFromPubHash(pubKeyHash)) != null)
|
||||||
return result;
|
return result;
|
||||||
for (DeterministicKeyChain chain : chains) {
|
for (DeterministicKeyChain chain : chains) {
|
||||||
if ((result = chain.findKeyFromPubHash(pubkeyHash)) != null)
|
if ((result = chain.findKeyFromPubHash(pubKeyHash)) != null)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the DeterministicKeys as used, if they match the pubkeyHash
|
* Mark the DeterministicKeys as used, if they match the pubKeyHash
|
||||||
* See {@link DeterministicKeyChain#markKeyAsUsed(DeterministicKey)} for more info on this.
|
* See {@link DeterministicKeyChain#markKeyAsUsed(DeterministicKey)} for more info on this.
|
||||||
*/
|
*/
|
||||||
public void markPubKeyHashAsUsed(byte[] pubkeyHash) {
|
public void markPubKeyHashAsUsed(byte[] pubKeyHash) {
|
||||||
for (DeterministicKeyChain chain : chains) {
|
for (DeterministicKeyChain chain : chains) {
|
||||||
DeterministicKey key;
|
DeterministicKey key;
|
||||||
if ((key = chain.markPubHashAsUsed(pubkeyHash)) != null) {
|
if ((key = chain.markPubHashAsUsed(pubKeyHash)) != null) {
|
||||||
maybeMarkCurrentKeyAsUsed(key);
|
maybeMarkCurrentKeyAsUsed(key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -449,12 +449,12 @@ public class KeyChainGroup implements KeyBag {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ECKey findKeyFromPubKey(byte[] pubkey) {
|
public ECKey findKeyFromPubKey(byte[] pubKey) {
|
||||||
ECKey result;
|
ECKey result;
|
||||||
if ((result = basic.findKeyFromPubKey(pubkey)) != null)
|
if ((result = basic.findKeyFromPubKey(pubKey)) != null)
|
||||||
return result;
|
return result;
|
||||||
for (DeterministicKeyChain chain : chains) {
|
for (DeterministicKeyChain chain : chains) {
|
||||||
if ((result = chain.findKeyFromPubKey(pubkey)) != null)
|
if ((result = chain.findKeyFromPubKey(pubKey)) != null)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -997,10 +997,10 @@ public class Wallet extends BaseTaggableObject
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ECKey findKeyFromPubHash(byte[] pubkeyHash) {
|
public ECKey findKeyFromPubHash(byte[] pubKeyHash) {
|
||||||
keyChainGroupLock.lock();
|
keyChainGroupLock.lock();
|
||||||
try {
|
try {
|
||||||
return keyChainGroup.findKeyFromPubHash(pubkeyHash);
|
return keyChainGroup.findKeyFromPubHash(pubKeyHash);
|
||||||
} finally {
|
} finally {
|
||||||
keyChainGroupLock.unlock();
|
keyChainGroupLock.unlock();
|
||||||
}
|
}
|
||||||
@ -1028,8 +1028,8 @@ public class Wallet extends BaseTaggableObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPubKeyHashMine(byte[] pubkeyHash) {
|
public boolean isPubKeyHashMine(byte[] pubKeyHash) {
|
||||||
return findKeyFromPubHash(pubkeyHash) != null;
|
return findKeyFromPubHash(pubKeyHash) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1060,18 +1060,18 @@ public class Wallet extends BaseTaggableObject
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ECKey findKeyFromPubKey(byte[] pubkey) {
|
public ECKey findKeyFromPubKey(byte[] pubKey) {
|
||||||
keyChainGroupLock.lock();
|
keyChainGroupLock.lock();
|
||||||
try {
|
try {
|
||||||
return keyChainGroup.findKeyFromPubKey(pubkey);
|
return keyChainGroup.findKeyFromPubKey(pubKey);
|
||||||
} finally {
|
} finally {
|
||||||
keyChainGroupLock.unlock();
|
keyChainGroupLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPubKeyMine(byte[] pubkey) {
|
public boolean isPubKeyMine(byte[] pubKey) {
|
||||||
return findKeyFromPubKey(pubkey) != null;
|
return findKeyFromPubKey(pubKey) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,12 +64,12 @@ public class GenerateLowSTests {
|
|||||||
final ECKey key = new ECKey(secureRandom);
|
final ECKey key = new ECKey(secureRandom);
|
||||||
final KeyBag bag = new KeyBag() {
|
final KeyBag bag = new KeyBag() {
|
||||||
@Override
|
@Override
|
||||||
public ECKey findKeyFromPubHash(byte[] pubkeyHash) {
|
public ECKey findKeyFromPubHash(byte[] pubKeyHash) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ECKey findKeyFromPubKey(byte[] pubkey) {
|
public ECKey findKeyFromPubKey(byte[] pubKey) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user