Skip to content

Commit

Permalink
Add default channel acceptor
Browse files Browse the repository at this point in the history
- Implemented a default channel acceptor script for the channel acceptor in 'channel_acceptor.go'. If no accept script is provided, the default script is set to "continue".
- Updated 'cln_plugin.go' to include a new DefaultChannelAcceptorScript variable with an empty string default value.
- Updated the handleGetManifest function to include DefaultChannelAcceptorScript as a default for the 'channelAcceptScript' field.
  • Loading branch information
lndev committed Jul 13, 2023
1 parent 2c42a48 commit 901703b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cln_plugin/channel_acceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ func channelAcceptor(acceptScript string, method string, openChannel json.RawMes
reject, _ := json.Marshal(struct {
Result string `json:"result"`
}{Result: "reject"})
accept, _ := json.Marshal(struct {
Result string `json:"result"`
}{Result: "continue"})

if acceptScript == "" {
return accept, nil
}

sd := starlark.StringDict{
"method": starlark.String(method),
Expand Down
4 changes: 3 additions & 1 deletion cln_plugin/cln_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const (
)

var (
DefaultSubscriberTimeout = "1m"
DefaultSubscriberTimeout = "1m"
DefaultChannelAcceptorScript = ""
)

const (
Expand Down Expand Up @@ -259,6 +260,7 @@ func (c *ClnPlugin) handleGetManifest(request *Request) {
Name: channelAcceptScript,
Type: "string",
Description: "starlark script for channel acceptor.",
Default: &DefaultChannelAcceptorScript,
},
},
RpcMethods: []*RpcMethod{
Expand Down

0 comments on commit 901703b

Please sign in to comment.