Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cln: remove wumbo check because CLN >=v23.11 defaults to enabling it #269

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ test-misc-integration: test-bins
'Test_RestoreFromPassedCSV|'\
'Test_Recover_PassedSwap_BTC|'\
'Test_Recover_PassedSwap_LBTC|'\
'Test_Wumbo|'\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the wumbo test also used in a different place or can we remove the test completely from the tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't feel 100% comfortable removing wumbo_test.go too just in case it was used elsewhere. Pretty certain it is fine to remove it though.

'Test_ClnConfig|'\
'Test_ClnPluginConfigFile|'\
'Test_ClnPluginConfigFile_DoesNotExist|'\
Expand Down
31 changes: 1 addition & 30 deletions clightning/clightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"crypto/rand"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
log2 "log"
Expand All @@ -27,14 +26,6 @@ import (
"github.com/elementsproject/peerswap/wallet"
)

// ClnMaxPaymentSizeMsat is the max amount in msat that core-lightning will send
// in a single htlc if `large-channels` are not enabled. The amount is
// 2^32 msat.
//
// FIXME: This should be removed some time soon in cln and we can remove it here
// then also.
const ClnMaxPaymentSizeMsat uint64 = 4294967296

var methods = []peerswaprpcMethod{
//&ListNodes{}, we disable finding nodes with the featurebit for now, as you would only find clightning nodes
&ListPeers{},
Expand Down Expand Up @@ -166,27 +157,7 @@ func NewClightningClient(ctx context.Context) (*ClightningClient, <-chan interfa
// amount is larger than the `ClnMaxPaymentSizeMsat` if the option
// `--large-channels` is missing or set to false.
func (cl *ClightningClient) CanSpend(amtMsat uint64) error {
if amtMsat > ClnMaxPaymentSizeMsat {
var has_large_channel bool
cfg, err := cl.glightning.ListConfigs()
if err != nil {
return err
}
if _, ok := cfg["large-channels"]; ok {
// Found the config option, read field
var lc struct {
LargeChannels bool `json:"large-channels"`
}

jstring, _ := json.Marshal(cfg)
json.Unmarshal(jstring, &lc)
has_large_channel = lc.LargeChannels
}

if !has_large_channel {
return fmt.Errorf("swap amount is %d: need to enable option '--large-channels' to swap amounts larger than 2^32 msat", amtMsat)
}
}
// No need to check now that CLN >=v23.11 defaults to enabling wumbo
return nil
}

Expand Down
Loading