Skip to content

Commit

Permalink
[feature] finally decided on the type of transactions to be done on P…
Browse files Browse the repository at this point in the history
…luto
  • Loading branch information
theghostmac committed Dec 20, 2023
1 parent 1b0ec4b commit 01a8b6c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
20 changes: 2 additions & 18 deletions internal/core/blockchain/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ func (b *Block) EncodeBinary(w io.Writer) error {
// The DecodeBinary method is used to decode the Block structure from binary format.
// It first decodes the Header of the block, and then decodes each transaction in the Transactions field of the Block structure.
func (b *Block) DecodeBinary(r io.Reader) error {
// Decode the Header.
if err := b.Header.DecodeBinary(r); err != nil {
return err
}

// Decode the transactions.
for _, tx := range b.Transactions {
if err := tx.DecodeBinary(r); err != nil {
return err
Expand All @@ -93,24 +95,6 @@ func (b *Block) DecodeBinary(r io.Reader) error {
return nil
}

//// The DecodeBinary method is used to decode the Block structure from binary format.
//// It first decodes the Header of the block, and then decodes each transaction in the Transactions field of the Block structure.
//func (b *Block) DecodeBinary(r io.Reader) error {
// // Decode the Header
// if err := b.Header.DecodeBinary(r); err != nil {
// return err
// }
//
// // Decode the Transactions
// for i := range b.Transactions {
// if err := b.Transactions[i].DecodeBinary(r); err != nil {
// return err
// }
// }
//
// return nil
//}

func (b *Block) Hasher() utils.Hash {
return utils.Hash{} // TODO
}
2 changes: 1 addition & 1 deletion internal/network/local_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (lt *LocalTransport) SendAMessage(destination NetworkAddress, payload []byt

peer, ok := lt.Peers[destination]
if !ok {
return fmt.Errorf("%s: could not send a messag to %s", lt.address, destination)
return fmt.Errorf("%s: could not send a message to %s", lt.address, destination)
}

peer.consumerChannel <- RPC{
Expand Down
2 changes: 1 addition & 1 deletion internal/network/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package network

import "sync"

type NetworkAddress string
type NetworkAddress string // Ethereum uses 30303 for example. I want to be able to specify my own when I run from scratch.

type RPC struct {
Source string
Expand Down

0 comments on commit 01a8b6c

Please sign in to comment.