Skip to content

Commit

Permalink
ensure blockchain path exists when creating offline node
Browse files Browse the repository at this point in the history
  • Loading branch information
devhawk committed Dec 29, 2020
1 parent b370543 commit 3ab5aba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/neo3/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static Uri GetUri(this ExpressConsensusNode node)
=> new Uri($"http://localhost:{node.RpcPort}");

static string ROOT_PATH => Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.DoNotVerify),
"Neo-Express", "blockchain-nodes");

static string GetBlockchainPath(this ExpressWalletAccount account)
Expand Down Expand Up @@ -189,6 +189,10 @@ public static Node.IExpressNode GetExpressNode(this ExpressChain chain, bool off

node = chain.ConsensusNodes[0];
var folder = node.GetBlockchainPath();
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}
return new Node.OfflineNode(RocksDbStore.Open(folder), node.Wallet, chain, offlineTrace);
}
}
Expand Down

0 comments on commit 3ab5aba

Please sign in to comment.