Skip to content

Commit

Permalink
motivation started in EIP, data structures refined
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Nov 10, 2023
1 parent 23a5db0 commit 2c5cf3c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
14 changes: 12 additions & 2 deletions papers/propagation.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
Improved Block Propagation
Sub-Blocks and Improved Confirmed Transactions Propagation
==========================

* Author: kushti
* Status: Proposed
* Created: 31-Oct-2023
* License: CC0
* Forking: Soft Fork
* Forking: Soft Fork

Motivation
----------

Currently, a block is generated every two minutes on average, and confirmed transactions are propagated along with
other block sections.

This is not efficient at all. Most of new block's transactions are already available in a node's mempool, and
bottlenecking network bandwidth after two minutes of delay is also downgrading network performance.

Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ object SubBlockAlgos {
object structures {
var lastBlock: Header = null // we ignore forks for now

val subBlocks: mutable.Set[ModifierId] = mutable.Set.empty
// all the sub-blocks known since the last block
val subBlocks: mutable.Map[ModifierId, Header] = mutable.Map.empty

// links from sub-blocks to their parent sub-blocks
val subBlockLinks: mutable.Map[ModifierId, ModifierId] = mutable.Map.empty

// only new transactions appeared in a sub-block
var subBlockTxs: Map[ModifierId, Array[Array[Byte]]] = Map.empty


Expand Down Expand Up @@ -186,10 +189,15 @@ object structures {
// todo: check if previous sub-block and transactions are downloaded
emptyResult
} else {
subBlocks += subBlockId
subBlocks += subBlockId -> sbHeader
if (subBlocks.contains(prevSbId)) {
val prevSb = subBlocks(prevSbId)
subBlockLinks.put(subBlockId, prevSbId)
(Seq.empty, Seq(sbHeader.id))
if(prevSb.transactionsRoot != sbHeader.transactionsRoot) {
(Seq.empty, Seq(sbHeader.id))
} else {
emptyResult // no new transactions
}
} else {
//todo: download prev sub block id
(Seq(prevSbId), Seq(sbHeader.id))
Expand Down

0 comments on commit 2c5cf3c

Please sign in to comment.