This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 456
Redesign accounts ledger #544
Comments
Added task list to issue description. |
#457 should be done first. |
81 tasks
karmacoma
added a commit
that referenced
this issue
Nov 25, 2017
Redesign accounts ledger - Closes #544
11 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Belongs to: #449
Task List:
Schema Changes
Create new table
accounts
for store of immutable data about accounts, should contains following fields:"transaction_id" VARCHAR(20) NOT NULL REFERENCES transactions(id) ON DELETE CASCADE
- That reference transaction that created account, so when that transaction is deleted due to rollback - account will be also deleted"public_key_transaction_id" VARCHAR(20) DEFAULT NULL REFERENCES transactions(transaction_id) ON DELETE SET NULL
- That references transaction that createdpublic_key
"public_key" BYTEA DEFAULT NULL
"address" VARCHAR(22) NOT NULL UNIQUE PRIMARY KEY
- Here we have some issue because real address can be max 21 chars, but we already have 22 chars addresses - to research"balance" BIGINT DEFAULT 0
Remove old tables:
mem_accounts
,mem_accounts2*
mem_accounts2delegates
withdelegates
tablemem_accounts2multisignatures
withmultisignature_master
tablemem_accounts2multisignatures.keysgroup
to bemultisignature_member
table, with relations tomultisignature_master.public_key
usingmaster_public_key
Create new view,
accounts_list
to provide abstraction forGET
requestsAdd
public_key
field to following tables:second_signature
,votes
,multisignature_master
multisignature_member
,dapps
,intransfer
,outtransfer
- so we can do easy joins with them onpublic_key
, ensure proper foreign keys (alsodelegates
table need to be reviewed)Propagate
accounts
table from blockchain dataTrigger changes or additions
public_key
to NULL whenpublic_key_transaction_id
is set toNULL
transactions
table that will maintain state ofaccounts
table fields -AFTER INSERT
public_key
field if it's NULL, update balance-(fee+amount)
+amount
second_public_key
if it'sNULL
// skipped - we will try to use existing signature tabletransactions
table that will maintain state ofaccounts
table in case of rollback -BEFORE DELETE
or maybeAFTER DELETE
(to research)+(fee+amount)
, scantransactions
table if-amount
Code Changes
dbSave
functions to be aware of new schemaapply*
,undo*
, etc. that affects balances only, transaction types should be preserveddelegates_update_on_block
and dependent functions such asdelegates_voters_balance_update
(rounds rewrite thing) to benefit fromaccounts
table - should be easy and fast to generate changes from current round transactions and merge them withaccounts.balance
Tests:
Adjust tests
Write new tests
The text was updated successfully, but these errors were encountered: