Allow using Web3Factory in-process Ganache with existing snapshot
This commit is contained in:
parent
ffd8349889
commit
d01837f42c
@ -47,9 +47,12 @@ export const web3Factory = {
|
|||||||
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
|
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
|
||||||
config.shouldThrowErrorsOnGanacheRPCResponse;
|
config.shouldThrowErrorsOnGanacheRPCResponse;
|
||||||
if (!_.isUndefined(config.ganacheDatabasePath)) {
|
if (!_.isUndefined(config.ganacheDatabasePath)) {
|
||||||
// Saving the snapshot to a local db. Ganache requires this directory to exist
|
const doesDatabaseAlreadyExist = fs.existsSync(config.ganacheDatabasePath);
|
||||||
|
if (!doesDatabaseAlreadyExist) {
|
||||||
|
// Working with local DB snapshot. Ganache requires this directory to exist
|
||||||
fs.mkdirSync(config.ganacheDatabasePath);
|
fs.mkdirSync(config.ganacheDatabasePath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
provider.addProvider(
|
provider.addProvider(
|
||||||
new GanacheSubprovider({
|
new GanacheSubprovider({
|
||||||
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
|
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user