Skip to main content
. 2023 Oct 27;23(21):8762. doi: 10.3390/s23218762
Algorithm 4 Generalized delay calculation procedure
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Input:   tx → transaction to be deleted
              chain → current state of blockchain
Output:  D → expected delay until the deletion

Procedure

       last_block ← chain.get(chain.length - 1)
       prev_block ← chain.get(chain.length - 2)
       interval ← last_block.timestamp – prev_block.timestamp
       D ← interval

       tx_block ← chain.get(tx.block)
        while tx_block != last_block do
             D ← D + interval
             D ← D + GC_DELAY

             tx_block ← chain.get(tx_block + 1)

      return D