mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-23 00:34:21 +01:00
Add default channel acceptor
- 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.
This commit is contained in:
@@ -12,6 +12,13 @@ func channelAcceptor(acceptScript string, method string, openChannel json.RawMes
|
|||||||
reject, _ := json.Marshal(struct {
|
reject, _ := json.Marshal(struct {
|
||||||
Result string `json:"result"`
|
Result string `json:"result"`
|
||||||
}{Result: "reject"})
|
}{Result: "reject"})
|
||||||
|
accept, _ := json.Marshal(struct {
|
||||||
|
Result string `json:"result"`
|
||||||
|
}{Result: "continue"})
|
||||||
|
|
||||||
|
if acceptScript == "" {
|
||||||
|
return accept, nil
|
||||||
|
}
|
||||||
|
|
||||||
sd := starlark.StringDict{
|
sd := starlark.StringDict{
|
||||||
"method": starlark.String(method),
|
"method": starlark.String(method),
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
DefaultSubscriberTimeout = "1m"
|
DefaultSubscriberTimeout = "1m"
|
||||||
|
DefaultChannelAcceptorScript = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -259,6 +260,7 @@ func (c *ClnPlugin) handleGetManifest(request *Request) {
|
|||||||
Name: channelAcceptScript,
|
Name: channelAcceptScript,
|
||||||
Type: "string",
|
Type: "string",
|
||||||
Description: "starlark script for channel acceptor.",
|
Description: "starlark script for channel acceptor.",
|
||||||
|
Default: &DefaultChannelAcceptorScript,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RpcMethods: []*RpcMethod{
|
RpcMethods: []*RpcMethod{
|
||||||
|
|||||||
Reference in New Issue
Block a user