Skip to content
Open
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
14 changes: 14 additions & 0 deletions client/rpcserver/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,20 @@ func handlePostBond(s *RPCServer, msg *msgjson.Message) *msgjson.ResponsePayload
exchCfg := exchInf[form.Addr]
if exchCfg == nil {
// Not already registered.
//
// form.Cert arrives as a JSON string - bwctl's optionalTextFiles
// pre-reads a cert filepath argument into the certificate's raw
// content before sending it, same as handleGetDEXConfig does
// above (which explicitly converts to []byte for this reason).
// core.PostBondForm.Cert is typed any, so it unmarshals as a Go
// string rather than []byte here, and core.parseCert then
// treats that string as a filepath and tries to re-read the PEM
// content as if it were a filename, which always fails. Convert
// to []byte here, matching handleGetDEXConfig, so parseCert
// takes its []byte branch instead.
if certStr, ok := form.Cert.(string); ok && certStr != "" {
form.Cert = []byte(certStr)
}
var err error
exchCfg, err = s.core.GetDEXConfig(form.Addr, form.Cert)
if err != nil {
Expand Down