Merge pull request #1934 from filecoin-project/bugs/return-on-error-#1611

fix unhandled nil return
This commit is contained in:
Whyrusleeping 2020-06-05 12:26:27 -07:00 committed by GitHub
commit 9f4ac4f4f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,22 +58,26 @@ func (pm *Manager) waitForPaychCreateMsg(ctx context.Context, mcid cid.Cid) {
mwait, err := pm.state.StateWaitMsg(ctx, mcid)
if err != nil {
log.Errorf("wait msg: %w", err)
return
}
if mwait.Receipt.ExitCode != 0 {
log.Errorf("payment channel creation failed (exit code %d)", mwait.Receipt.ExitCode)
return
}
var decodedReturn init_.ExecReturn
err = decodedReturn.UnmarshalCBOR(bytes.NewReader(mwait.Receipt.Return))
if err != nil {
log.Error(err)
return
}
paychaddr := decodedReturn.RobustAddress
ci, err := pm.loadOutboundChannelInfo(ctx, paychaddr)
if err != nil {
log.Errorf("loading channel info: %w", err)
return
}
if err := pm.store.trackChannel(ci); err != nil {