When transaction stores, it updates the Checkpoint
of target account. This causes problem that target account can not know his/her latest checkpoint when he/her tries to make new tranaction.
For example, there are 3 account, a0
, a1
and a2
, each account has 1 BOS, and send payment transactions between each others.
souce |
description |
target |
a2 balance |
a2 checkpoint |
a0 |
tx0 sends 1 BOS |
a2 |
1 BOS -> 2 BOS |
chk0 |
.... |
|
|
|
|
a2 |
tx2 sends 1 BOS |
a0 |
|
|
.... |
|
|
|
|
a1 |
tx1 sends 1 BOS |
a2 |
2 BOS -> 3 BOS |
chk1 |
If a2
sends tx2
before tx1
is stored, but tx1
is stoed during tx2
under consensus. Of course, the Checkpoint
of tx2
is chk0
. What happened?
Current implementation will think, tx2
is invalid, that is, tx2
does not have latest checkpoint, so tx2
will be failed to get consensus.
This problem is caused because the validation just checks whether Checkpoint
of transaction is the latest checkpoint of account, or not.
If the validation checks that the Checkpoint
exists in transactions of the account and at that Checkpoint
the balance is sufficient or not, the problem will be solved.
This is new strategy.
How Checkpoint
can be made
checkpoint is: <subtracted>-<added>
<subtracted>
: hash of last paid transaction, it means balance is subtracted
<added>
: hash of last added transaction, it means balance is added
Validating Checkpoint
- if checkpoint is final checkpoint of source, check balance
- if not, try to find existing checkpoint of source
- if not, say no
- if found,
- check,
<subtracted>
is same with <added>
of final check
- if not, say no
- if same, check the balance of that time.
Checkpoint Changes Example
account |
initial checkpoint |
a0 |
tx0-tx0 |
a1 |
tx1-tx1 |
a2 |
tx2-tx2 |
source |
target |
transaction |
checkpoint of transaction |
checkpoint of source |
checkpoint of target |
a0 |
a1 |
tx3 |
tx0-tx0 |
a0: tx3-tx3 |
a1: tx1-tx3 |
a0 |
a2 |
tx4 |
tx3-tx3 |
a0: tx4-tx4 |
a2: tx2-tx4 |
a1 |
a0 |
tx5 |
tx1-tx3 |
a1: tx5-tx5 |
a0: tx4-tx5 |