add balance to accounts
- Comment on lines +67 to +71
This hack should not be required in future networks which ensure the account exists before creating identity.
- Comment on lines +137 to +151
currentUd
is here more like "latest created UD", so the last Universal Dividend created before the membership. But when an identity becomes member, the first UD it's able to claim is the next.In Duniter it is handled in
OnNewMembershipHandler
wherefirst_eligible_ud
is set topallet_universal_dividend::init_first_eligible_ud()
which is the index of the next UD to be created:- 1 at the beginning when no UD was created
- 2 after the first UD creation
- 3 after the second UD creation
- ...
- Comment on lines +707 to +709
I am not sure how it would work if a batch was large enough to have multiple UDs in it. Maybe the last UD would be selected even if it was created after the block we are currently looking at.
Example:
block 0 1 2 3 4 5 6 7 8 9 ud 1 2 3 4 mship ↑ batch | | | | | altbt | | | | |
the second batch has:
- block 2 and 3
- membership creation
- ud 1 creation
And
getLastUniversalDividendOrFail
would return ud 1 which is indeed the last created UD at bock 3.But the alternative batch (
altbt
) has:- block 3 and 4
- membership creation
- ud 2 creation
So
getLastUniversalDividendOrFail
would return ud 2 which comes after membership creation. In this case, it would give a UD created in the future.
[edit]
I'm not sure about what I'm writing. Maybe I'm confused about
universalDividend
andudReeval
which are lists when at most a single element can be in it.[edit2]
Keep in mind that
collectDataFromEvents
is run inctx.blocks.forEach((block) => {
loop, and can contain multiple blocks in the context. So what you should be doing is:- look into
data.universalDividend
first and see if there is a UD with block number lower than the one you are looking at - look into the database with a
where
constraint on the blocknumber
Pourquoi est-ce que ça a disparu ?
C'est nécessaire pour afficher l'historique du nombre de membres par exemple :
C'est cassé sur ton instance.