Merge pull request #9 from vincenzopalazzo/macros/check-forvalidity
plugin: check if the offer is valid
This commit is contained in:
commit
997ae766bf
|
@ -12,7 +12,7 @@ func OceanPay(cln *plugin.Plugin[*State], request map[string]any) (map[string]an
|
|||
cln.Log("debug", fmt.Sprintf("ocean-pay: %s", request))
|
||||
clnRequest := struct {
|
||||
Invstr string `mapstructure:"invstr"`
|
||||
Amount_msat string `mapstructure:"amount_msat"`
|
||||
Amount_msat any `mapstructure:"amount_msat"`
|
||||
}{}
|
||||
if err := json.Decode(request, &clnRequest); err != nil {
|
||||
return nil, err
|
||||
|
@ -35,6 +35,10 @@ func OceanPay(cln *plugin.Plugin[*State], request map[string]any) (map[string]an
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if !clnDecode.Valid {
|
||||
return nil, fmt.Errorf("invoice not valid")
|
||||
}
|
||||
|
||||
cln.Log("debug", fmt.Sprintf("decode offer: %s", invstrDecode))
|
||||
var payInvoice map[string]any
|
||||
var invoice string
|
||||
|
|
Loading…
Reference in New Issue