@@ -541,6 +541,7 @@ namespace fc::storage::mpool {
541
541
[&](auto , auto bls, auto &cid, auto *smsg, auto *msg)
542
542
-> outcome::result<void > {
543
543
if (bls) {
544
+ std::lock_guard bls_cache_lock{bls_cache_mutex_};
544
545
if (auto sig{bls_cache.get (cid)}) {
545
546
mpool::add (pending, {*msg, *sig});
546
547
}
@@ -760,6 +761,7 @@ namespace fc::storage::mpool {
760
761
761
762
outcome::result<void > MessagePool::add (const SignedMessage &message) {
762
763
if (message.signature .isBls ()) {
764
+ std::lock_guard bls_cache_lock{bls_cache_mutex_};
763
765
bls_cache.insert (message.getCid (), message.signature );
764
766
}
765
767
OUTCOME_TRY (setCbor (ipld, message));
@@ -792,6 +794,7 @@ namespace fc::storage::mpool {
792
794
remove (msg->from , msg->nonce );
793
795
} else {
794
796
if (bls) {
797
+ std::lock_guard bls_cache_lock{bls_cache_mutex_};
795
798
if (auto sig{bls_cache.get (cid)}) {
796
799
OUTCOME_TRY (add ({*msg, *sig}));
797
800
}
@@ -833,9 +836,11 @@ namespace fc::storage::mpool {
833
836
if (!address.isId ()) {
834
837
return ERROR_TEXT (" Cannot resolve actor address to key address." );
835
838
}
839
+ std::unique_lock resloved_cache_lock{resolved_cache_mutex_};
836
840
if (auto resolved{resolved_cache_.get (address)}) {
837
841
return *resolved;
838
842
}
843
+ resloved_cache_lock.unlock ();
839
844
840
845
std::shared_lock head_lock (head_mutex_);
841
846
ChainEpoch height = head_->height ();
@@ -846,6 +851,7 @@ namespace fc::storage::mpool {
846
851
const auto maybe_resolved =
847
852
resolveKeyAtHeight (address, height - kChainFinality , ts_branch);
848
853
if (maybe_resolved) {
854
+ std::lock_guard resloved_cache_lock_guard{resolved_cache_mutex_};
849
855
resolved_cache_.insert (address, maybe_resolved.value ());
850
856
return maybe_resolved.value ();
851
857
}
0 commit comments