-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
this issue is the 11 bug in issue 53: #53
- (to to) func (manager *htlcManager) getPath(msgData string) (path interface{}, err error) shoud have a document: the main flow,and how to use the returned value.
obd/tracker/service/htlc_service.go
Lines 40 to 83 in 5829315
| func (manager *htlcManager) getPath(obdClient *ObdNode, msgData string) (path interface{}, err error) { | |
| manager.mu.Lock() | |
| defer manager.mu.Unlock() | |
| log.Println("getPath", msgData) | |
| if tool.CheckIsString(&msgData) == false { | |
| return "", errors.New("wrong inputData") | |
| } | |
| pathRequest := &bean.HtlcPathRequest{} | |
| err = json.Unmarshal([]byte(msgData), pathRequest) | |
| if err != nil { | |
| return "", err | |
| } | |
| if tool.CheckIsString(&pathRequest.RealPayerPeerId) == false { | |
| return "", errors.New("wrong realPayerPeerId") | |
| } | |
| if tool.CheckIsString(&pathRequest.PayeePeerId) == false { | |
| return "", errors.New("wrong SendeePeerId") | |
| } | |
| if pathRequest.Amount < tool.GetOmniDustBtc() { | |
| return "", errors.New("wrong amount") | |
| } | |
| manager.createChannelNetwork(pathRequest.RealPayerPeerId, pathRequest.PayeePeerId, pathRequest.PropertyId, pathRequest.Amount, nil, true) | |
| resultIndex := manager.getPathIndex() | |
| retNode := make(map[string]interface{}) | |
| retNode["senderPeerId"] = pathRequest.RealPayerPeerId | |
| retNode["h"] = pathRequest.H | |
| retNode["amount"] = pathRequest.Amount | |
| retNode["path"] = "" | |
| if resultIndex != -1 { | |
| splitArr := strings.Split(manager.openList[resultIndex].ChannelIds, ",") | |
| path := "" | |
| for i := len(splitArr) - 1; i > -1; i-- { | |
| path += splitArr[i] + "," | |
| } | |
| path = strings.TrimSuffix(path, ",") | |
| retNode["path"] = path | |
| } | |
| log.Println("return path info", retNode) | |
| return retNode, nil | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation