Commit dc60674c authored by bitcoinj-sv's avatar bitcoinj-sv

wait for one

only sv seeders
BIP44 for the keys
parent 42c8322c
...@@ -44,7 +44,7 @@ public class TransactionBroadcast { ...@@ -44,7 +44,7 @@ public class TransactionBroadcast {
private final PeerGroup peerGroup; private final PeerGroup peerGroup;
private final Transaction tx; private final Transaction tx;
private int minConnections; private int minConnections;
private int numWaitingFor; private final int numWaitingFor = 1;
/** Used for shuffling the peers before broadcast: unit tests can replace this to make themselves deterministic. */ /** Used for shuffling the peers before broadcast: unit tests can replace this to make themselves deterministic. */
@VisibleForTesting @VisibleForTesting
...@@ -149,7 +149,6 @@ public class TransactionBroadcast { ...@@ -149,7 +149,6 @@ public class TransactionBroadcast {
// to skip the inv here - we wouldn't send invs anyway. // to skip the inv here - we wouldn't send invs anyway.
int numConnected = peers.size(); int numConnected = peers.size();
int numToBroadcastTo = numConnected; int numToBroadcastTo = numConnected;
numWaitingFor = 2;
Collections.shuffle(peers, random); Collections.shuffle(peers, random);
peers = peers.subList(0, numToBroadcastTo); peers = peers.subList(0, numToBroadcastTo);
log.info("broadcastTransaction: We have {} peers, adding {} to the memory pool", numConnected, tx.getHashAsString()); log.info("broadcastTransaction: We have {} peers, adding {} to the memory pool", numConnected, tx.getHashAsString());
......
...@@ -73,9 +73,9 @@ public class MainNetParams extends AbstractBitcoinNetParams { ...@@ -73,9 +73,9 @@ public class MainNetParams extends AbstractBitcoinNetParams {
checkpoints.put(556767, Sha256Hash.wrap("000000000000000001d956714215d96ffc00e0afda4cd0a96c96f8d802b1662b")); checkpoints.put(556767, Sha256Hash.wrap("000000000000000001d956714215d96ffc00e0afda4cd0a96c96f8d802b1662b"));
dnsSeeds = new String[] { dnsSeeds = new String[] {
"seed.bitcoinsv.io", // Bitcoin SV seeder "seed.bitcoinsv.io",
"btccash-seeder.bitcoinunlimited.info", // BU backed seeder "seed.cascharia.com",
"seeder.criptolayer.net",// criptolayer.net "seed.satoshisvision.network"
}; };
httpSeeds = null; /* new HttpDiscovery.Details[] { httpSeeds = null; /* new HttpDiscovery.Details[] {
// Andreas Schildbach // Andreas Schildbach
......
...@@ -58,11 +58,8 @@ public class TestNet3Params extends AbstractBitcoinNetParams { ...@@ -58,11 +58,8 @@ public class TestNet3Params extends AbstractBitcoinNetParams {
alertSigningKey = Utils.HEX.decode("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a"); alertSigningKey = Utils.HEX.decode("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
dnsSeeds = new String[] { dnsSeeds = new String[] {
"testnet-seed.bitcoin.jonasschnelli.ch", // Jonas Schnelli "testnet-seed.bitcoinsv.io",
"testnet-seed.bluematt.me", // Matt Corallo "testnet-seed.cascharia.com"
"testnet-seed.bitcoin.petertodd.org", // Peter Todd
"testnet-seed.bitcoin.schildbach.de", // Andreas Schildbach
"bitcoin-testnet.bloqseeds.net", // Bloq
}; };
addrSeeds = null; addrSeeds = null;
bip32HeaderPub = 0x043587CF; bip32HeaderPub = 0x043587CF;
......
...@@ -104,6 +104,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain { ...@@ -104,6 +104,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
private DeterministicHierarchy hierarchy; private DeterministicHierarchy hierarchy;
@Nullable private DeterministicKey rootKey; @Nullable private DeterministicKey rootKey;
@Nullable private DeterministicSeed seed; @Nullable private DeterministicSeed seed;
@Nullable private final ImmutableList<ChildNumber> accountPath;
// Paths through the key tree. External keys are ones that are communicated to other parties. Internal keys are // Paths through the key tree. External keys are ones that are communicated to other parties. Internal keys are
// keys created for change addresses, coinbases, mixing, etc - anything that isn't communicated. The distinction // keys created for change addresses, coinbases, mixing, etc - anything that isn't communicated. The distinction
...@@ -306,7 +307,46 @@ public class DeterministicKeyChain implements EncryptableKeyChain { ...@@ -306,7 +307,46 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
* if the starting seed is the same. * if the starting seed is the same.
*/ */
protected DeterministicKeyChain(DeterministicSeed seed) { protected DeterministicKeyChain(DeterministicSeed seed) {
this(seed, null); this(seed, null, ACCOUNT_ZERO_PATH);
}
/**
* For use in {@link KeyChainFactory} during deserialization.
*/
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter) {
this(seed, crypter, ACCOUNT_ZERO_PATH);
}
/**
* Creates a deterministic key chain starting from the given seed. This deterministic Key chain
* will follow the account path defined.
*/
public DeterministicKeyChain(DeterministicSeed seed, ImmutableList<ChildNumber> accountPath) {
this(seed, null, accountPath);
}
/**
* Creates a deterministic key chain with an encrypted deterministic seed using the provided account path.
* Using {@link KeyCrypter KeyCrypter} to decrypt.
*/
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter,
ImmutableList<ChildNumber> accountPath) {
this.accountPath = accountPath;
this.seed = seed;
basicKeyChain = new BasicKeyChain(crypter);
if (!seed.isEncrypted()) {
rootKey = HDKeyDerivation.createMasterPrivateKey(checkNotNull(seed.getSeedBytes()));
rootKey.setCreationTimeSeconds(seed.getCreationTimeSeconds());
basicKeyChain.importKey(rootKey);
hierarchy = new DeterministicHierarchy(rootKey);
for (int i = 1; i <= getAccountPath().size(); i++) {
basicKeyChain.importKey(hierarchy.get(getAccountPath().subList(0, i), false, true));
}
initializeHierarchyUnencrypted(rootKey);
}
// Else...
// We can't initialize ourselves with just an encrypted seed, so we expected deserialization code to do the
// rest of the setup (loading the root key).
} }
/** /**
...@@ -317,6 +357,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain { ...@@ -317,6 +357,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
public DeterministicKeyChain(DeterministicKey watchingKey) { public DeterministicKeyChain(DeterministicKey watchingKey) {
checkArgument(watchingKey.isPubKeyOnly(), "Private subtrees not currently supported: if you got this key from DKC.getWatchingKey() then use .dropPrivate().dropParent() on it first."); checkArgument(watchingKey.isPubKeyOnly(), "Private subtrees not currently supported: if you got this key from DKC.getWatchingKey() then use .dropPrivate().dropParent() on it first.");
checkArgument(watchingKey.getPath().size() == getAccountPath().size(), "You can only watch an account key currently"); checkArgument(watchingKey.getPath().size() == getAccountPath().size(), "You can only watch an account key currently");
this.accountPath = watchingKey.getPath();
basicKeyChain = new BasicKeyChain(); basicKeyChain = new BasicKeyChain();
this.seed = null; this.seed = null;
rootKey = null; rootKey = null;
...@@ -351,27 +392,6 @@ public class DeterministicKeyChain implements EncryptableKeyChain { ...@@ -351,27 +392,6 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
return new DeterministicKeyChain(accountKey); return new DeterministicKeyChain(accountKey);
} }
/**
* For use in {@link KeyChainFactory} during deserialization.
*/
protected DeterministicKeyChain(DeterministicSeed seed, @Nullable KeyCrypter crypter) {
this.seed = seed;
basicKeyChain = new BasicKeyChain(crypter);
if (!seed.isEncrypted()) {
rootKey = HDKeyDerivation.createMasterPrivateKey(checkNotNull(seed.getSeedBytes()));
rootKey.setCreationTimeSeconds(seed.getCreationTimeSeconds());
addToBasicChain(rootKey);
hierarchy = new DeterministicHierarchy(rootKey);
for (int i = 1; i <= getAccountPath().size(); i++) {
addToBasicChain(hierarchy.get(getAccountPath().subList(0, i), false, true));
}
initializeHierarchyUnencrypted(rootKey);
}
// Else...
// We can't initialize ourselves with just an encrypted seed, so we expected deserialization code to do the
// rest of the setup (loading the root key).
}
/** /**
* For use in encryption when {@link #toEncrypted(KeyCrypter, KeyParameter)} is called, so that * For use in encryption when {@link #toEncrypted(KeyCrypter, KeyParameter)} is called, so that
* subclasses can override that method and create an instance of the right class. * subclasses can override that method and create an instance of the right class.
...@@ -385,6 +405,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain { ...@@ -385,6 +405,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
checkArgument(!chain.rootKey.isEncrypted(), "Chain already encrypted"); checkArgument(!chain.rootKey.isEncrypted(), "Chain already encrypted");
this.accountPath = chain.getAccountPath();
this.issuedExternalKeys = chain.issuedExternalKeys; this.issuedExternalKeys = chain.issuedExternalKeys;
this.issuedInternalKeys = chain.issuedInternalKeys; this.issuedInternalKeys = chain.issuedInternalKeys;
...@@ -420,6 +442,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain { ...@@ -420,6 +442,8 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
/** Override in subclasses to use a different account derivation path */ /** Override in subclasses to use a different account derivation path */
protected ImmutableList<ChildNumber> getAccountPath() { protected ImmutableList<ChildNumber> getAccountPath() {
if (accountPath != null)
return accountPath;
return ACCOUNT_ZERO_PATH; return ACCOUNT_ZERO_PATH;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment