@ -15,29 +15,7 @@ export const listPeerChannels = (req, res, next) => {
request . post ( options ) . then ( ( body ) => {
logger . log ( { selectedNode : req . session . selectedNode , level : 'INFO' , fileName : 'Channels' , msg : 'Peer Channels List Received' , data : body . channels } ) ;
return Promise . all ( body . channels ? . map ( ( channel ) => {
channel . to _us _msat = common . removeMSat ( channel . to _us _msat ) ;
channel . total _msat = common . removeMSat ( channel . total _msat ) ;
channel . to _them _msat = channel . total _msat - channel . to _us _msat ;
channel . last _tx _fee _msat = common . removeMSat ( channel . last _tx _fee _msat ) ;
channel . funding . local _funds _msat = common . removeMSat ( channel . funding . local _funds _msat ) ;
channel . funding . remote _funds _msat = common . removeMSat ( channel . funding . remote _funds _msat ) ;
channel . funding . pushed _msat = common . removeMSat ( channel . funding . pushed _msat ) ;
channel . min _to _us _msat = common . removeMSat ( channel . min _to _us _msat ) ;
channel . max _to _us _msat = common . removeMSat ( channel . max ) ;
channel . fee _base _msat = common . removeMSat ( channel . fee _base _msat ) ;
channel . dust _limit _msat = common . removeMSat ( channel . dust _limit _msat ) ;
channel . max _total _htlc _in _msat = common . removeMSat ( channel . max _total _htlc _in _msat ) ;
channel . their _reserve _msat = common . removeMSat ( channel . their _reserve _msat ) ;
channel . our _reserve _msat = common . removeMSat ( channel . our _reserve _msat ) ;
channel . spendable _msat = common . removeMSat ( channel . spendable _msat ) ;
channel . receivable _msat = common . removeMSat ( channel . receivable _msat ) ;
channel . minimum _htlc _in _msat = common . removeMSat ( channel . minimum _htlc _in _msat ) ;
channel . minimum _htlc _out _msat = common . removeMSat ( channel . minimum _htlc _out _msat ) ;
channel . maximum _htlc _out _msat = common . removeMSat ( channel . maximum _htlc _out _msat ) ;
channel . in _offered _msat = common . removeMSat ( channel . in _offered _msat ) ;
channel . in _fulfilled _msat = common . removeMSat ( channel . in _fulfilled _msat ) ;
channel . out _offered _msat = common . removeMSat ( channel . out _offered _msat ) ;
channel . out _fulfilled _msat = common . removeMSat ( channel . out _fulfilled _msat ) ;
channel . balancedness = ( channel . total _msat === 0 ) ? 1 : ( 1 - Math . abs ( ( channel . to _us _msat - ( channel . total _msat - channel . to _us _msat ) ) / channel . total _msat ) ) . toFixed ( 3 ) ;
return getAlias ( req . session . selectedNode , channel , 'peer_id' ) ;
} ) ) . then ( ( values ) => {
@ -112,11 +90,6 @@ export const listForwards = (req, res, next) => {
request . post ( options ) . then ( ( body ) => {
logger . log ( { selectedNode : req . session . selectedNode , level : 'DEBUG' , fileName : 'Channels' , msg : 'Forwarding History Received For Status ' + req . body . status , data : body } ) ;
body . forwards = ! body . forwards ? [ ] : ( req . body . status === 'failed' || req . body . status === 'local_failed' ) ? body . forwards . slice ( Math . max ( 0 , body . forwards . length - 1000 ) , Math . max ( 1000 , body . forwards . length ) ) . reverse ( ) : body . forwards . reverse ( ) ;
body . forwards . forEach ( ( forward ) => {
forward . in _msat = common . removeMSat ( forward . in _msat ) ;
forward . out _msat = common . removeMSat ( forward . out _msat ) ;
forward . fee _msat = common . removeMSat ( forward . fee _msat ) ;
} ) ;
res . status ( 200 ) . json ( body . forwards ) ;
} ) . catch ( ( errRes ) => {
const err = common . handleError ( errRes , 'Channels' , 'Forwarding History Error' , req . session . selectedNode ) ;
@ -134,13 +107,6 @@ export const funderUpdatePolicy = (req, res, next) => {
logger . log ( { selectedNode : req . session . selectedNode , level : 'DEBUG' , fileName : 'Channels' , msg : 'Funder Update Body' , data : options . body } ) ;
request . post ( options ) . then ( ( body ) => {
logger . log ( { selectedNode : req . session . selectedNode , level : 'INFO' , fileName : 'Channels' , msg : 'Funder Policy Received' , data : body } ) ;
body . min _their _funding _msat = common . removeMSat ( body . min _their _funding _msat ) ;
body . max _their _funding _msat = common . removeMSat ( body . max _their _funding _msat ) ;
body . per _channel _min _msat = common . removeMSat ( body . per _channel _min _msat ) ;
body . per _channel _max _msat = common . removeMSat ( body . per _channel _max _msat ) ;
body . reserve _tank _msat = common . removeMSat ( body . reserve _tank _msat ) ;
body . channel _fee _max _base _msat = common . removeMSat ( body . channel _fee _max _base _msat ) ;
body . lease _fee _base _msat = common . removeMSat ( body . lease _fee _base _msat ) ;
res . status ( 200 ) . json ( body ) ;
} ) . catch ( ( errRes ) => {
const err = common . handleError ( errRes , 'Channels' , 'Funder Policy Error' , req . session . selectedNode ) ;