ssbc / ssb-ebt

secure scuttlebutt replication with epidemic-broadcast-trees
MIT License
18 stars 10 forks source link

Should detect when remote peer does not support EBT RPCs #57

Closed staltz closed 3 years ago

staltz commented 3 years ago

When the remote peer does not support ssb-ebt RPCs, it gets a networkError that looks like this:

ssb-js

rpc.ebt.replicate exception: {
  message: 'method:ebt,replicate is not in list of allowed methods',
  name: 'Error',
  stack: 'Error: method:ebt,replicate is not in list of allowed methods\n' +
    '    at Function.perms.pre (/home/node/.npm-global/lib/node_modules/ssb-room/node_modules/muxrpc/permissions.js:88:14)\n' +
    ...
    ...

go-ssb

rpc.ebt.replicate exception: {
  name: 'Error',
  message: 'muxrpc: no such command: ebt.replicate',
  stack: ''
}

In this line https://github.com/ssbc/ssb-ebt/blob/b9a7f8b097d41c7f7b33eef9167e517953e06923/index.js#L110 we could treat those two special cases, by picking networkError.message and checking if the message matches, and if it does, we could print a more human readable message to console.warn like this:

peer @FEEDID.ed25519 does not support EBT RPCs

In the other cases, we just pass the networkError down to detectSeverity