Skip to content

Commit

Permalink
Broadcast Bob's name and version via hsd
Browse files Browse the repository at this point in the history
  • Loading branch information
Falci committed Apr 18, 2022
1 parent de90b37 commit e9dac79
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/background/node/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Address from 'hsd/lib/primitives/address';
const blake2b = require('bcrypto/lib/blake2b');
const secp256k1 = require('bcrypto/lib/secp256k1');
const {safeEqual} = require('bcrypto/lib/safe');
import pkg from 'hsd/lib/pkg';
import pkg from '../../../package.json';
import { prefixHash } from '../../db/names';
import { get, put } from '../db/service';
import {dispatchToMainWindow} from "../../mainWindow";
Expand All @@ -32,6 +32,7 @@ import {
} from "../../ducks/nodeReducer";

const Network = require('hsd/lib/protocol/network');
const { USER_AGENT: HSD_AGENT } = require('hsd/lib/net/common')

const MIN_FEE = new BigNumber(0.01);
const DEFAULT_BLOCK_TIME = 10 * 60 * 1000;
Expand Down Expand Up @@ -199,6 +200,7 @@ export class NodeService extends EventEmitter {
const Node = spv ? SPVNode : FullNode;

this.hsd = new Node({
agent: this.getAgent(),
config: true,
argv: true,
env: true,
Expand Down Expand Up @@ -542,6 +544,13 @@ export class NodeService extends EventEmitter {
return this._execRPC('sendrawclaim', [base64]);
}

getAgent() {
const { name, version } = pkg;
const BOB_AGENT = `${name}:${version}/`;

return `${HSD_AGENT}${BOB_AGENT}`
}

async _ensureStarted() {
if (!this.client)
throw new Error('No client.');
Expand Down

0 comments on commit e9dac79

Please sign in to comment.