blockchain sandbox: UTXO chain, p2p mining, attacker node

This commit is contained in:
2026-07-26 20:37:26 +03:00
commit 7ce39c8964
18 changed files with 2536 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
package p2p
import "blockchain/chain"
type Msg interface {
msg()
}
type BlockMsg struct {
Block *chain.Block
From Peer
}
type TxMsg struct {
Tx *chain.Transaction
From Peer
}
type GetBlocksMsg struct {
Height int
From Peer
}
type BlocksMsg struct {
Blocks []*chain.Block
}
type GetPeersMsg struct {
From Peer
}
type PeersMsg struct {
Peers []Peer
}
func (BlockMsg) msg() {}
func (TxMsg) msg() {}
func (GetBlocksMsg) msg() {}
func (BlocksMsg) msg() {}
func (GetPeersMsg) msg() {}
func (PeersMsg) msg() {}