|
Algorithm 3 Algorithm for primary and secondary chain synchronization. |
Require: Transactions in txpool: Tx, fixed time: T
-
1:
while Every T time do
-
2:
package all Tx in txpool into new block BLOCK ← Generate block.
-
3:
Add new BLOCK to the privacy-chain ← Update chain.
-
4:
if Nodes sync to privacy-chain with new BLOCK then
-
5:
Each node will compare the Tx.Diffp(TD) in the new BLOCK with the TD they have.
-
6:
if hash(TD) = Tx.hash(TD) then
-
7:
Make a copy of the new BLOCK.
-
8:
Replace(Tx.Diffp(TD), TD) ← Replace Tx.Diffp(TD) with TD to form a new Replica-Block.
-
9:
add Replica-Block to the node’s own self-chain.
-
10:
end if
-
11:
end if
-
12:
end while
|