|
1 | 1 | // Copyright 2019-2022 ChainSafe Systems
|
2 | 2 | // SPDX-License-Identifier: Apache-2.0, MIT
|
3 | 3 |
|
| 4 | +use anyhow::Context; |
4 | 5 | use std::convert::TryInto;
|
5 | 6 |
|
6 | 7 | use cid::Cid;
|
7 |
| -use fil_actors_runtime::{ActorDowncast, Array}; |
| 8 | +use fil_actors_runtime::Array; |
8 | 9 | use fvm_ipld_amt::Error as AmtError;
|
9 | 10 | use fvm_ipld_bitfield::BitField;
|
10 | 11 | use fvm_ipld_blockstore::Blockstore;
|
@@ -35,13 +36,13 @@ impl<'db, BS: Blockstore> BitFieldQueue<'db, BS> {
|
35 | 36 | let bitfield = self
|
36 | 37 | .amt
|
37 | 38 | .get(epoch)
|
38 |
| - .map_err(|e| e.downcast_wrap(format!("failed to lookup queue epoch {}", epoch)))? |
| 39 | + .with_context(|| format!("failed to lookup queue epoch {}", epoch))? |
39 | 40 | .cloned()
|
40 | 41 | .unwrap_or_default();
|
41 | 42 |
|
42 | 43 | self.amt
|
43 | 44 | .set(epoch, &bitfield | values)
|
44 |
| - .map_err(|e| e.downcast_wrap(format!("failed to set queue epoch {}", epoch)))?; |
| 45 | + .with_context(|| format!("failed to set queue epoch {}", epoch))?; |
45 | 46 |
|
46 | 47 | Ok(())
|
47 | 48 | }
|
@@ -73,11 +74,11 @@ impl<'db, BS: Blockstore> BitFieldQueue<'db, BS> {
|
73 | 74 |
|
74 | 75 | Ok(())
|
75 | 76 | })
|
76 |
| - .map_err(|e| e.downcast_wrap("failed to cut from bitfield queue"))?; |
| 77 | + .context("failed to cut from bitfield queue")?; |
77 | 78 |
|
78 | 79 | self.amt
|
79 | 80 | .batch_delete(epochs_to_remove, true)
|
80 |
| - .map_err(|e| e.downcast_wrap("failed to remove empty epochs from bitfield queue"))?; |
| 81 | + .context("failed to remove empty epochs from bitfield queue")?; |
81 | 82 |
|
82 | 83 | Ok(())
|
83 | 84 | }
|
|
0 commit comments