Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: correctly clear entity variables

...

Code Block
  rule pico_child_deleted {
    select when information child_deleted
    pre {
      child_id = event:attr("id");
      owner_id = ent:owners.filter(function(v){v{"pico_id"}==child_id}).keys()[0];
    }
    if owner_id then noop();
    fired {
      clear ent:owners{owner_id} := null;
    }
  }


Account ruleset

The account ruleset must react to these events, as described below:

...

Code Block
  rule owner_nonce_used {
    select when owner nonce_used
             or pico intent_to_orphan
    if ent:exp then schedule:remove(ent:exp);
    always {
      raise owner event "nonce_cleanup"
    }
  }
  rule owner_nonce_cleanup {
    select when owner nonce_cleanup
    always {
      clear ent:code;
:= null;      clear ent:nonce;
:= null;      clear ent:exp := null;
    }
  }

Notice that nonce cleanup will occur whenever the nonce has been used (successfully or otherwise), when the owner pico is about to be deleted, or when the five minutes have elapsed without either of those events happening. If applicable the scheduled event will be removed.

...