From 76b5c8b145cea0c0b4f3849938c3411848dde9f7 Mon Sep 17 00:00:00 2001 From: shannonwells Date: Fri, 5 Jun 2020 10:59:28 -0700 Subject: [PATCH 1/2] fix unhandled nil return --- paychmgr/simple.go | 1 + 1 file changed, 1 insertion(+) diff --git a/paychmgr/simple.go b/paychmgr/simple.go index ff537d425..65ab856e1 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -58,6 +58,7 @@ 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 { From e4bed4d9636e51edb229fc2b981f10f39c95ee02 Mon Sep 17 00:00:00 2001 From: shannonwells Date: Fri, 5 Jun 2020 11:06:42 -0700 Subject: [PATCH 2/2] return on all err conditions --- paychmgr/simple.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 65ab856e1..24a662a50 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -63,18 +63,21 @@ func (pm *Manager) waitForPaychCreateMsg(ctx context.Context, mcid cid.Cid) { 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 {