Does Database Transaction affects database manipulation inside a function?

If I have a stack like:

1. Database Transaction
1.1 Custom Function
1.1.1 Get Record <with lock>
1.1.2 Edit Record

the transaction declared outside the function will do the work as expected?