We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 35e85b3 commit 246136eCopy full SHA for 246136e
lib/db/DB.ts
@@ -166,13 +166,20 @@ class DB {
166
SwapDeal.sync(),
167
]);
168
169
- if (shouldInitDb) {
+ if (initDb) {
170
// initialize database with the seed nodes for the configured network
171
const nodes = defaultNodes(network);
172
if (nodes) {
173
- await Node.bulkCreate(nodes);
+ const existingNodes = await Models.Node(this.sequelize).findAll();
174
+ const newNodes = nodes.filter(node => (!existingNodes.find(n => (n.nodePubKey === node.nodePubKey))));
175
+
176
+ if (newNodes.length > 0) {
177
+ await Node.bulkCreate(newNodes);
178
+ }
179
}
180
181
182
+ if (shouldInitDb) {
183
// initialize database with the default currencies for the configured network
184
const currencies = defaultCurrencies(network);
185
if (currencies) {
0 commit comments