connected_hook: allow hook to specify an error message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-04-16 09:41:48 +09:30
committed by Christian Decker
parent a314bc62fc
commit 7f7ad4f89f
5 changed files with 22 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ plugin = Plugin()
def on_connected(peer, plugin):
if peer['id'] in plugin.reject_ids:
print("{} is in reject list, disconnecting".format(peer['id']))
return {'result': 'disconnect'}
return {'result': 'disconnect', 'error_message': 'You are in reject list'}
print("{} is allowed".format(peer['id']))
return {'result': 'continue'}