fix: Always charge peer on strand

This commit is contained in:
Bart
2026-06-06 17:52:00 -04:00
parent 949887feb9
commit 2a73e11f51

View File

@@ -392,8 +392,14 @@ PeerImp::removeTxQueue(uint256 const& hash)
void
PeerImp::charge(Resource::Charge const& fee, std::string const& context)
{
if (!strand_.running_in_this_thread())
{
post(strand_, [self = shared_from_this(), fee, context]() { self->charge(fee, context); });
return;
}
if ((usage_.charge(fee, context) == Resource::Disposition::Drop) &&
usage_.disconnect(pJournal_) && strand_.running_in_this_thread())
usage_.disconnect(pJournal_))
{
// Sever the connection
overlay_.incPeerDisconnectCharges();