-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace go-p2p with internal implementation in blocktx (#679)
- Loading branch information
1 parent
631726a
commit 22fd0dc
Showing
20 changed files
with
258 additions
and
1,193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
internal/blocktx/blockchain_communication/block_message.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package blockchaincommunication | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/libsv/go-p2p/chaincfg/chainhash" | ||
"github.com/libsv/go-p2p/wire" | ||
) | ||
|
||
// BlockMessage only stores the transaction IDs of the block, not the full transactions | ||
type BlockMessage struct { | ||
Header *wire.BlockHeader | ||
Height uint64 | ||
TransactionHashes []*chainhash.Hash | ||
Size uint64 | ||
} | ||
|
||
func (bm *BlockMessage) Bsvdecode(io.Reader, uint32, wire.MessageEncoding) error { | ||
return nil | ||
} | ||
func (bm *BlockMessage) BsvEncode(io.Writer, uint32, wire.MessageEncoding) error { | ||
return nil | ||
} | ||
func (bm *BlockMessage) Command() string { | ||
return "block" | ||
} | ||
func (bm *BlockMessage) MaxPayloadLength(uint32) uint64 { | ||
return wire.MaxExtMsgPayload | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
internal/blocktx/peer_handler_test.go → ...blockchain_communication/p2p/init_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package blocktx | ||
package blocktx_p2p | ||
|
||
import ( | ||
"testing" | ||
|
Oops, something went wrong.