Skip to content

Commit

Permalink
refactor: remove raiden support (#1824)
Browse files Browse the repository at this point in the history
Closes #1516.

BREAKING CHANGE: removes raiden support & p2p packet fields
  • Loading branch information
sangaman authored Aug 19, 2020
1 parent 0ee525d commit 9afe7d1
Show file tree
Hide file tree
Showing 56 changed files with 361 additions and 2,912 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Describe your issue here.

* version of `xud`:
* which operating system (`uname -a` on *Nix):
* version of `btcd`, `bitcoind`, `ltcd`, `litecoind`, `geth`, `parity`, `raiden`, `lnd` or other chain backend:
* version of `btcd`, `bitcoind`, `ltcd`, `litecoind`, `geth`, `parity`, `connext`, `lnd` or other chain backend:
* any other relevant environment details:

### Steps to reproduce
Expand Down
18 changes: 0 additions & 18 deletions bin/xud
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ const { argv } = require('yargs')
type: 'string',
alias: 'x',
},
'debug.raidenDirectChannelChecks': {
describe: 'Whether to require direct channels for raiden payments',
type: 'boolean',
default: undefined,
},
'http.port': {
describe: 'Port to listen for http requests',
type: 'number',
Expand Down Expand Up @@ -163,19 +158,6 @@ const { argv } = require('yargs')
describe: 'Port that Tor\'s exposed SOCKS5 proxy is listening on.',
type: 'number',
},
'raiden.disable': {
describe: 'Disable raiden integration',
type: 'boolean',
default: undefined,
},
'raiden.keystorepath': {
describe: 'Path containing keystore dir',
type: 'string',
},
'raiden.port': {
describe: 'Port for raiden REST service',
type: 'number',
},
'connext.disable': {
describe: 'Disable Connext integration',
type: 'boolean',
Expand Down
4 changes: 0 additions & 4 deletions bin/xud-backup
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ const { argv } = require('yargs')
describe: 'Port for the lnd gRPC interface',
type: 'number',
},
'raiden.dbpath': {
describe: 'Path to the database of Raiden',
type: 'string',
},
});

// delete non-config keys from argv
Expand Down
31 changes: 2 additions & 29 deletions docs/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions lib/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { LndClientConfig } from './lndclient/types';
import { Level } from './Logger';
import { OrderBookThresholds } from './orderbook/types';
import { PoolConfig } from './p2p/types';
import { RaidenClientConfig } from './raidenclient/types';
import { ConnextClientConfig } from './connextclient/types';
import { deepMerge } from './utils/utils';

Expand Down Expand Up @@ -55,13 +54,9 @@ class Config {
public rpc: { disable: boolean, host: string, port: number };
public http: { host: string, port: number };
public lnd: { [currency: string]: LndClientConfig | undefined } = {};
public raiden: RaidenClientConfig;
public connext: ConnextClientConfig;
public orderthresholds: OrderBookThresholds;
public webproxy: { port: number, disable: boolean };
public debug: {
raidenDirectChannelChecks: boolean,
};
public instanceid = 0;
/** Whether to intialize a new database with default values. */
public initdb = true;
Expand All @@ -85,27 +80,23 @@ class Config {
constructor() {
const platform = os.platform();
let lndDefaultDatadir: string;
let raidenDefaultKeystorePath: string;
switch (platform) {
case 'win32': { // windows
const homeDir = process.env.LOCALAPPDATA!;
this.xudir = path.join(homeDir, 'Xud');
lndDefaultDatadir = path.join(homeDir, 'Lnd');
raidenDefaultKeystorePath = path.join(homeDir, 'Ethereum');
break;
}
case 'darwin': { // mac
const homeDir = process.env.HOME!;
this.xudir = path.join(homeDir, '.xud');
lndDefaultDatadir = path.join(homeDir, 'Library', 'Application Support', 'Lnd');
raidenDefaultKeystorePath = path.join(homeDir, 'Library', 'Ethereum');
break;
}
default: { // linux
const homeDir = process.env.HOME!;
this.xudir = path.join(homeDir, '.xud');
lndDefaultDatadir = path.join(homeDir, '.lnd');
raidenDefaultKeystorePath = path.join(homeDir, '.ethereum');
break;
}
}
Expand Down Expand Up @@ -141,9 +132,6 @@ class Config {
disable: true,
port: 8080,
};
this.debug = {
raidenDirectChannelChecks: true,
};
// TODO: add dynamic max/min price limits
this.orderthresholds = {
minQuantity: 0, // 0 = disabled
Expand All @@ -166,12 +154,6 @@ class Config {
nomacaroons: false,
cltvdelta: 576,
};
this.raiden = {
disable: false,
host: 'localhost',
port: 5001,
keystorepath: raidenDefaultKeystorePath,
};
this.connext = {
disable: false,
host: 'localhost',
Expand Down
3 changes: 0 additions & 3 deletions lib/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export enum Context {
P2P = 'P2P',
OrderBook = 'ORDERBOOK',
Lnd = 'LND',
Raiden = 'RAIDEN',
Connext = 'CONNEXT',
Swaps = 'SWAPS',
Http = 'HTTP',
Expand All @@ -45,7 +44,6 @@ type Loggers = {
p2p: Logger,
orderbook: Logger,
lnd: Logger,
raiden: Logger,
connext: Logger,
swaps: Logger,
http: Logger,
Expand Down Expand Up @@ -121,7 +119,6 @@ class Logger {
p2p: new Logger({ ...object, context: Context.P2P }),
orderbook: new Logger({ ...object, context: Context.OrderBook }),
lnd: new Logger({ ...object, context: Context.Lnd }),
raiden: new Logger({ ...object, context: Context.Raiden }),
connext: new Logger({ ...object, context: Context.Connext }),
swaps: new Logger({ ...object, context: Context.Swaps }),
http: new Logger({ ...object, context: Context.Http }),
Expand Down
5 changes: 1 addition & 4 deletions lib/Xud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ class Xud extends EventEmitter {
shutdown: this.beginShutdown,
});

if (
this.swapClientManager.raidenClient?.isOperational() ||
this.swapClientManager.connextClient?.isOperational()
) {
if (this.swapClientManager.connextClient?.isOperational()) {
this.httpServer = new HttpServer(loggers.http, this.service);
await this.httpServer.listen(
this.config.http.port,
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/addcurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const builder = (argv: Argv) => argv
.positional('swap_client', {
description: 'the payment channel network client for swaps',
type: 'string',
choices: ['Lnd', 'Raiden', 'Connext'],
choices: ['Lnd', 'Connext'],
})
.option('decimal_places', {
description: 'the places to the right of the decimal point of the smallest subunit (e.g. satoshi)',
Expand Down
8 changes: 0 additions & 8 deletions lib/cli/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ const formatOutput = (response: CreateNodeResponse.AsObject) => {
walletInitializedMessage += response.initializedLndsList.join(', ');
}

if (response.initializedRaiden) {
if (!walletInitializedMessage.endsWith(' ')) {
walletInitializedMessage += ', ';
}

walletInitializedMessage += 'ERC20(ETH)';
}

console.log(walletInitializedMessage);

console.log(`
Expand Down
3 changes: 1 addition & 2 deletions lib/cli/commands/listpeers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ ${address}`,
`inbound: ${peer.inbound}\
\nversion: ${peer.xudVersion}\
\ntime connected: ${peer.secondsConnected.toString()} seconds\
\n${formatLndPubKeys(peer.lndPubKeysMap)}\
${peer.raidenAddress ? `\nraiden address: ${shorten(peer.raidenAddress)}` : ''}`,
\n${formatLndPubKeys(peer.lndPubKeysMap)}`,
];
formattedPeers.push(details);
});
Expand Down
24 changes: 1 addition & 23 deletions lib/cli/commands/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { RestoreNodeRequest, RestoreNodeResponse } from '../../proto/xudrpc_pb';
import { callback, loadXudInitClient } from '../command';
import { getDefaultCertPath, waitForCert } from '../utils';

export const command = 'restore [backup_directory] [raiden_database_path]';
export const command = 'restore [backup_directory]';

export const describe = 'restore an xud instance from seed';

Expand All @@ -18,10 +18,6 @@ export const builder = {
uses the default directory if unspecified`,
type: 'string',
},
raiden_database_path: {
description: 'The path to the database of Raiden ("23_log.db")',
type: 'string',
},
};

const exitWithError = (message: string) => {
Expand All @@ -36,14 +32,6 @@ const formatOutput = (response: RestoreNodeResponse.AsObject) => {
walletRestoredMessage += response.restoredLndsList.join(', ');
}

if (response.restoredRaiden) {
if (!walletRestoredMessage.endsWith(' ')) {
walletRestoredMessage += ', ';
}

walletRestoredMessage += 'ERC20(ETH)';
}

console.log(walletRestoredMessage);
};

Expand Down Expand Up @@ -88,16 +76,6 @@ export const handler = async (argv: Arguments<any>) => {
case 'xud':
request.setXudDatabase(fileContent);
break;

case 'raiden':
request.setRaidenDatabase(fileContent);

if (argv.raiden_database_path) {
request.setRaidenDatabasePath(argv.raiden_database_path);
} else {
exitWithError('Raiden database path not specified');
}
break;
}

resolve();
Expand Down
5 changes: 2 additions & 3 deletions lib/constants/enums.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** An enumeration of payment channel network clients that support token swaps. */
export enum SwapClientType {
Lnd,
Raiden,
Connext,
Lnd = 0,
Connext = 2,
}

export enum OrderingDirection {
Expand Down
1 change: 0 additions & 1 deletion lib/constants/errorCodesPrefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export default {
P2P: '2',
ORDERBOOK: '3',
LND: '4',
RAIDEN: '5',
SERVICE: '6',
SWAPS: '7',
CONNEXT: '8',
Expand Down
Loading

0 comments on commit 9afe7d1

Please sign in to comment.