From 6ba8cd3facbb02d7ebd6a7351d20baa197d44a6e Mon Sep 17 00:00:00 2001 From: Eric Tu Date: Wed, 24 Mar 2021 10:24:01 -0400 Subject: [PATCH] Fix ExitCode handling when calling repay_partial_debt_in_priority_order --- vm/actor/src/builtin/miner/mod.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/vm/actor/src/builtin/miner/mod.rs b/vm/actor/src/builtin/miner/mod.rs index be59d3491b80..cd6dc57af497 100644 --- a/vm/actor/src/builtin/miner/mod.rs +++ b/vm/actor/src/builtin/miner/mod.rs @@ -2652,7 +2652,9 @@ impl Actor { rt.curr_epoch(), &rt.current_balance()?, ) - .map_err(|e| actor_error!(ErrIllegalState, "failed to repay penalty: {}", e))?; + .map_err(|e| { + e.downcast_default(ExitCode::ErrIllegalState, "failed to repay penalty") + })?; pledge_delta_total -= &penalty_from_vesting; let to_burn = penalty_from_vesting + penalty_from_balance; Ok((pledge_delta_total, to_burn)) @@ -3053,7 +3055,9 @@ where rt.curr_epoch(), &rt.current_balance()?, ) - .map_err(|e| actor_error!(ErrIllegalState, "failed to repay penalty: {}", e))?; + .map_err(|e| { + e.downcast_default(ExitCode::ErrIllegalState, "failed to repay penalty") + })?; penalty = &penalty_from_vesting + penalty_from_balance; pledge_delta -= penalty_from_vesting; @@ -3156,7 +3160,9 @@ where rt.curr_epoch(), &rt.current_balance()?, ) - .map_err(|e| actor_error!(ErrIllegalState, "failed to unlock penalty: {}", e))?; + .map_err(|e| { + e.downcast_default(ExitCode::ErrIllegalState, "failed to unlock penalty") + })?; penalty_total = &penalty_from_vesting + penalty_from_balance; pledge_delta_total -= penalty_from_vesting;