Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Jan 8, 2025
2 parents f9a5c03 + cb3bcb1 commit 4da190c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/P2P/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ export class OceanP2P extends EventEmitter {
// related: https://github.com/libp2p/go-libp2p-kad-dht/issues/323
async republishStoredDDOS() {
try {
if (!this.db) {
if (!this.db || !this.db.ddo) {
P2P_LOGGER.logMessage(
`republishStoredDDOS() attempt aborted because there is no database!`,
true
Expand Down
9 changes: 9 additions & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { C2DClusterType } from '../@types/C2D.js'
import { createFromPrivKey } from '@libp2p/peer-id-factory'
import { keys } from '@libp2p/crypto'
import {
computeCodebaseHash,
DEFAULT_RATE_LIMIT_PER_MINUTE,
ENVIRONMENT_VARIABLES,
EnvVariable,
Expand All @@ -30,6 +31,8 @@ import {
} from '../utils/address.js'
import { CONFIG_LOGGER } from './logging/common.js'
import { create256Hash } from './crypt.js'
import { fileURLToPath } from 'url'
import path from 'path'

// usefull for lazy loading and avoid boilerplate on other places
let previousConfiguration: OceanNodeConfig = null
Expand Down Expand Up @@ -501,6 +504,12 @@ export async function getConfiguration(
if (!previousConfiguration || forceReload) {
previousConfiguration = await getEnvConfig(isStartup)
}
if (!previousConfiguration.codeHash) {
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename.replace('utils/', ''))
previousConfiguration.codeHash = await computeCodebaseHash(__dirname)
}

return previousConfiguration
}

Expand Down

0 comments on commit 4da190c

Please sign in to comment.