This PR is a follow-up to fix review comments and a bugfix from #28385
The PR
-
Updated
DisconnectedBlockTransactions’sMAX_DISCONNECTED_TX_POOLfrom kb to bytes. -
Moved
DisconnectedBlockTransactionsimplementation code tokernel/disconnected_transactions.cpp. -
AddTransactionsFromBlocknow assume duplicate transactions are not passed by asserting after inserting each transaction toiters_by_txid. -
Included a Bug fix: In the current master we are underestimating the memory usage of
DisconnectedBlockTransactions.- When adding and subtracting
cachedInnerUsagewe callRecursiveDynamicUsagewithCTransactionwhich invokes thisRecursiveDynamicUsage(const CTransaction& tx)version ofRecursiveDynamicUsage, the output of that call only account for the memory usage of the inputs and outputs of theCTransaction, this omits the memory usage of theCTransactionobject and the control block. - This PR fixes this bug by calling
RecursiveDynamicUsagewithCTransactionRefwhen adding and subtractingcachedInnerUsagewhich invokesRecursiveDynamicUsage(const std::shared_ptr<X>& p)version ofRecursiveDynamicUsagethe output of the calculation accounts for theCTransactionobject, the control blocks, inputs and outputs memory usage. - see comment
- When adding and subtracting
-
Added test for DisconnectedBlockTransactions memory limit.