mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
pyln-client: revert old/new comparisons for getroute, listchannels, listnodes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
b6aa9510a9
commit
50cb810bd0
@ -816,31 +816,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
"exclude": exclude,
|
||||
"maxhops": maxhops
|
||||
}
|
||||
|
||||
# This is a hack to make sure old and new routines return the same result.
|
||||
e1 = None
|
||||
ret1 = None
|
||||
err = None
|
||||
try:
|
||||
ret1 = self.call("getroute", payload)
|
||||
except RpcError as e:
|
||||
err = e
|
||||
e1 = e.error
|
||||
e2 = None
|
||||
ret2 = None
|
||||
try:
|
||||
ret2 = self.call("getrouteold", payload)
|
||||
except RpcError as e:
|
||||
e2 = e.error
|
||||
|
||||
print("new getroute: {} exception {}".format(ret1, e1))
|
||||
print("old getroute: {} exception {}".format(ret2, e2))
|
||||
assert ret1 == ret2
|
||||
assert e1 == e2
|
||||
|
||||
if err is not None:
|
||||
raise err
|
||||
return ret1
|
||||
return self.call("getroute", payload)
|
||||
|
||||
def help(self, command=None):
|
||||
"""
|
||||
@ -876,50 +852,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
"short_channel_id": short_channel_id,
|
||||
"source": source
|
||||
}
|
||||
|
||||
|
||||
# This is a hack to make sure old and new routines return the same result.
|
||||
e1 = None
|
||||
ret1 = None
|
||||
err = None
|
||||
try:
|
||||
ret1 = self.call("listchannels", payload)
|
||||
except RpcError as e:
|
||||
err = e
|
||||
e1 = e.error
|
||||
e2 = None
|
||||
ret2 = None
|
||||
try:
|
||||
ret2 = self.call("listchannelsold", payload)
|
||||
except RpcError as e:
|
||||
e2 = e.error
|
||||
|
||||
print("new listchannels: {} exception {}".format(ret1, e1))
|
||||
print("old listchannels: {} exception {}".format(ret2, e2))
|
||||
# gossipd only marks a channel enabled again when channeld says to;
|
||||
# our new code just requires a reconnection. So check that
|
||||
# separately
|
||||
if ret1:
|
||||
assert len(ret1['channels']) == len(ret2['channels'])
|
||||
for i in range(len(ret1['channels'])):
|
||||
if ret1['channels'][i]['active'] and not ret2['channels'][i]['active']:
|
||||
ret2['channels'][i]['active'] = True
|
||||
|
||||
def chan_key(c):
|
||||
return c['source'] + c['destination']
|
||||
|
||||
# Order is arbitrary
|
||||
if ret1:
|
||||
ret1['channels'].sort(key=chan_key)
|
||||
if ret2:
|
||||
ret2['channels'].sort(key=chan_key)
|
||||
|
||||
assert ret1 == ret2
|
||||
assert e1 == e2
|
||||
|
||||
if err is not None:
|
||||
raise err
|
||||
return ret1
|
||||
return self.call("listchannels", payload)
|
||||
|
||||
def listconfigs(self, config=None):
|
||||
"""List this node's config.
|
||||
@ -979,40 +912,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
||||
payload = {
|
||||
"id": node_id
|
||||
}
|
||||
|
||||
# This is a hack to make sure old and new routines return the same result.
|
||||
e1 = None
|
||||
ret1 = None
|
||||
err = None
|
||||
try:
|
||||
ret1 = self.call("listnodes", payload)
|
||||
except RpcError as e:
|
||||
err = e
|
||||
e1 = e.error
|
||||
e2 = None
|
||||
ret2 = None
|
||||
try:
|
||||
ret2 = self.call("listnodesold", payload)
|
||||
except RpcError as e:
|
||||
e2 = e.error
|
||||
|
||||
print("new listnodes: {} exception {}".format(ret1, e1))
|
||||
print("old listnodes: {} exception {}".format(ret2, e2))
|
||||
|
||||
# Order is arbitrary
|
||||
def node_key(n):
|
||||
return n['nodeid']
|
||||
|
||||
if ret1:
|
||||
ret1['nodes'].sort(key=node_key)
|
||||
if ret2:
|
||||
ret2['nodes'].sort(key=node_key)
|
||||
assert ret1 == ret2
|
||||
assert e1 == e2
|
||||
|
||||
if err is not None:
|
||||
raise err
|
||||
return ret1
|
||||
return self.call("listnodes", payload)
|
||||
|
||||
def listpays(self, bolt11=None, payment_hash=None):
|
||||
"""
|
||||
|
@ -777,9 +777,6 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams):
|
||||
amt = 10**8 // 2
|
||||
sticky_inv = l1.rpc.invoice(amt, '2', 'sticky')
|
||||
route = l4.rpc.getroute(l1.info['id'], amt, 1)['route']
|
||||
route2 = l4.rpc.getrouteold(l1.info['id'], amt, 1)['route']
|
||||
|
||||
assert(route == route2)
|
||||
l4.rpc.sendpay(route, sticky_inv['payment_hash'])
|
||||
l1.daemon.wait_for_log('dev_disconnect: -WIRE_UPDATE_FULFILL_HTLC')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user