• Andrea Gianarda's avatar
    In the call parameters, there are 2 ways of setting the from address · 2dc884fb
    Andrea Gianarda authored
    when initiating a call;
    - from header
    - account
    These 2 parameters are dependent from each other which makes tricky for
    the core to know exactly which account to use and the correct from
    address.
    In most scenarios, the from address is the account's identity address
    but it is not always the case such as in the case of a direct call.
    Moreover, the account cannot be always deduced in a straightforward
    matter such as if the core has no default account (but it is registered
    with one or more accounts) and the call parameters have not set one.
    
    The algorithm for choosing an account is the following:
    1) search in the call parameters
    2) get the default account
    3) look up for the best guessed account based on the from (if known) or
       to address
    
    The algorithm for known the from address is the following:
    1) look for the from header in the call parameters
    2) look up for the identity address of the account (if known)
    3) get the core primary account
    
    ...
    2dc884fb