kindelia / Kindelia

An efficient, secure cryptocomputer
https://kindelia.org/
609 stars 38 forks source link

refactor(node): remove more expect calls in node.rs #267

Closed dan-da closed 1 year ago

dan-da commented 1 year ago

Addresses #247 (more to come)

When combined with #265, all except 2 unwrap/expect are removed from node.rs. The remaining 2 expect occurrences are Mutex::lock().expect(), which I consider acceptable (necessary evil) for now.

This PR endeavors to keep the overall logic the same, except that:

node.rs

persistence.rs

util.rs

racs4 commented 1 year ago

Very good job. The code looks perfect

all except 2 unwrap/expect are removed from node.rs

But I think there are still more places causing panic like the HashMap accesses made in add_block, that are of the type: self.map[hash]

dan-da commented 1 year ago

But I think there are still more places causing panic like the HashMap accesses made in add_block, that are of the type: self.map[hash]

yeah, I've just been going after unwrap/expect until now. I intend to make another pass for array index stuff.

racs4 commented 1 year ago

I intend to make another pass for array index stuff.

That would be in another PR, correct?

dan-da commented 1 year ago

yes, in another PR I mean. trying to keep them as small/focused as I can so easier to review.