File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -231,9 +231,21 @@ void Sv2TemplateProvider::ThreadSv2ClientHandler(size_t client_id)
231231 std::shared_ptr client = m_connman->GetClientById (client_id);
232232 if (!client) return false ;
233233
234- // The node enforces a minimum of 2000, though not for IPC so we could go a bit
235- // lower, but let's not...
236- options.block_reserved_weight = 2000 + client->m_coinbase_tx_outputs_size * 4 ;
234+ // https://stratumprotocol.org/specification/07-Template-Distribution-Protocol#71-coinbaseoutputconstraints-client-server
235+ // Weight units reserved for block header, transaction count,
236+ // and various fixed and variable coinbase fields.
237+ const size_t block_reserved_floor{1198 };
238+ // Reserve a little more so that if the above calculation is
239+ // wrong or there's an implementation error, we don't produce
240+ // an invalid bock when the template is completely full.
241+ const size_t block_reserved_padding{400 };
242+
243+ // Bitcoin Core enforces a mimimum -blockreservedweight of 2000,
244+ // but via IPC we can go below that.
245+ options.block_reserved_weight = block_reserved_floor +
246+ block_reserved_padding +
247+ client->m_coinbase_tx_outputs_size * 4 ;
248+
237249 }
238250 return true ;
239251 };
You can’t perform that action at this time.
0 commit comments