You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this callback, a manual lookup of a user/bank (i.e an association) is performed using a combination of iterators that access the plugin's internal map. This sort of lookup of an association is repeated numerous times throughout the plugin code.
Instead, I think I can create an external function that lives in accounting.cpp that does this lookup, and replace the manual lookups in validate_cb () and similar callbacks with calls to this new external function. This new external function can return an address of the association in the plugin's internal map or NULL on failure, and validate_cb () can either continue on with its job validation using this address, or reject the job on failure (because it can't find the association passed in).
The other small improvement that comes with using this new external function is reading the different validation steps in the callback become a little easier to read, i.e bank_it->second.active == 0 becomes association->active == 0 since we don't have to use an iterator here in the callback.
This callback could also use some improvements to its comments and function description.
The text was updated successfully, but these errors were encountered:
In this callback, a manual lookup of a user/bank (i.e an association) is performed using a combination of iterators that access the plugin's internal map. This sort of lookup of an association is repeated numerous times throughout the plugin code.
Instead, I think I can create an external function that lives in
accounting.cpp
that does this lookup, and replace the manual lookups invalidate_cb ()
and similar callbacks with calls to this new external function. This new external function can return an address of the association in the plugin's internal map orNULL
on failure, andvalidate_cb ()
can either continue on with its job validation using this address, or reject the job on failure (because it can't find the association passed in).The other small improvement that comes with using this new external function is reading the different validation steps in the callback become a little easier to read, i.e
bank_it->second.active == 0
becomesassociation->active == 0
since we don't have to use an iterator here in the callback.This callback could also use some improvements to its comments and function description.
The text was updated successfully, but these errors were encountered: