mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-19 05:33:44 +01:00
BlockStore: remove getParams()
from the hierarchy
Nothing in bitcoinj is using this method and applications should not be getting their `NetworkParameters` from their storage layer.
This commit is contained in:
parent
99f6860ceb
commit
cc901ee863
@ -17,7 +17,6 @@
|
||||
package org.bitcoinj.store;
|
||||
|
||||
import org.bitcoinj.core.BlockChain;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
import org.bitcoinj.base.Sha256Hash;
|
||||
import org.bitcoinj.core.StoredBlock;
|
||||
|
||||
@ -60,10 +59,4 @@ public interface BlockStore {
|
||||
|
||||
/** Closes the store. */
|
||||
void close() throws BlockStoreException;
|
||||
|
||||
/**
|
||||
* Get the {@link NetworkParameters} of this store.
|
||||
* @return The network params.
|
||||
*/
|
||||
NetworkParameters getParams();
|
||||
}
|
||||
|
@ -36,16 +36,13 @@ public class MemoryBlockStore implements BlockStore {
|
||||
}
|
||||
};
|
||||
private StoredBlock chainHead;
|
||||
private NetworkParameters params;
|
||||
|
||||
public MemoryBlockStore(NetworkParameters params) {
|
||||
// Insert the genesis block.
|
||||
try {
|
||||
Block genesisHeader = params.getGenesisBlock().cloneAsHeader();
|
||||
StoredBlock storedGenesis = new StoredBlock(genesisHeader, genesisHeader.getWork(), 0);
|
||||
put(storedGenesis);
|
||||
setChainHead(storedGenesis);
|
||||
this.params = params;
|
||||
} catch (BlockStoreException | VerificationException e) {
|
||||
throw new RuntimeException(e); // Cannot happen.
|
||||
}
|
||||
@ -80,9 +77,4 @@ public class MemoryBlockStore implements BlockStore {
|
||||
public void close() {
|
||||
blockMap = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkParameters getParams() {
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
@ -411,11 +411,6 @@ public class MemoryFullPrunedBlockStore implements FullPrunedBlockStore {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkParameters getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Network network() {
|
||||
return params.network();
|
||||
|
@ -309,11 +309,6 @@ public class SPVBlockStore implements BlockStore {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkParameters getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
protected static final int RECORD_SIZE = 32 /* hash */ + StoredBlock.COMPACT_SERIALIZED_SIZE;
|
||||
|
||||
// File format:
|
||||
|
Loading…
Reference in New Issue
Block a user