Remove old constants and print actual grpc server address (#1595)

* Remove unneeded old constants in the p2p

* Print the actual address of the grpc server

Co-authored-by: Ori Newman <orinewman1@gmail.com>
This commit is contained in:
Elichai Turkel 2021-03-10 16:33:51 +02:00 committed by GitHub
parent 1486a6312c
commit 3d668cc1bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 39 deletions

View File

@ -15,19 +15,6 @@ import (
// backing array multiple times.
const defaultTransactionAlloc = 2048
// MaxMassAcceptedByBlock is the maximum total transaction mass a block may accept.
const MaxMassAcceptedByBlock = 10000000
// MaxMassPerTx is the maximum total mass a transaction may have.
const MaxMassPerTx = MaxMassAcceptedByBlock / 2
// MaxTxPerBlock is the maximum number of transactions that could
// possibly fit into a block.
const MaxTxPerBlock = (MaxMassAcceptedByBlock / minTxPayload) + 1
// MaxBlockParents is the maximum allowed number of parents for block.
const MaxBlockParents = 10
// TxLoc holds locator data for the offset and length of where a transaction is
// located within a MsgBlock data buffer.
type TxLoc struct {

View File

@ -57,7 +57,7 @@ func (s *gRPCServer) listenOn(listenAddr string) error {
}
})
log.Infof("%s Server listening on %s", s.name, listenAddr)
log.Infof("%s Server listening on %s", s.name, listener.Addr())
return nil
}

View File

@ -21,11 +21,6 @@ func (x *BlockMessage) toAppMessage() (*appmessage.MsgBlock, error) {
if x == nil {
return nil, errors.Wrap(errorNil, "BlockMessage is nil")
}
if len(x.Transactions) > appmessage.MaxTxPerBlock {
return nil, errors.Errorf("too many transactions to fit into a block "+
"[count %d, max %d]", len(x.Transactions), appmessage.MaxTxPerBlock)
}
header, err := x.Header.toAppMessage()
if err != nil {
return nil, err
@ -47,16 +42,6 @@ func (x *BlockMessage) toAppMessage() (*appmessage.MsgBlock, error) {
}
func (x *BlockMessage) fromAppMessage(msgBlock *appmessage.MsgBlock) error {
if len(msgBlock.Transactions) > appmessage.MaxTxPerBlock {
return errors.Errorf("too many transactions to fit into a block "+
"[count %d, max %d]", len(msgBlock.Transactions), appmessage.MaxTxPerBlock)
}
if len(msgBlock.Header.ParentHashes) > appmessage.MaxBlockParents {
return errors.Errorf("block header has %d parents, but the maximum allowed amount "+
"is %d", len(msgBlock.Header.ParentHashes), appmessage.MaxBlockParents)
}
protoHeader := new(BlockHeaderMessage)
err := protoHeader.fromAppMessage(&msgBlock.Header)
if err != nil {

View File

@ -11,11 +11,6 @@ func (x *BlockHeaderMessage) toAppMessage() (*appmessage.MsgBlockHeader, error)
if x == nil {
return nil, errors.Wrapf(errorNil, "BlockHeaderMessage is nil")
}
if len(x.ParentHashes) > appmessage.MaxBlockParents {
return nil, errors.Errorf("block header has %d parents, but the maximum allowed amount "+
"is %d", len(x.ParentHashes), appmessage.MaxBlockParents)
}
parentHashes, err := protoHashesToDomain(x.ParentHashes)
if err != nil {
return nil, err
@ -48,11 +43,6 @@ func (x *BlockHeaderMessage) toAppMessage() (*appmessage.MsgBlockHeader, error)
}
func (x *BlockHeaderMessage) fromAppMessage(msgBlockHeader *appmessage.MsgBlockHeader) error {
if len(msgBlockHeader.ParentHashes) > appmessage.MaxBlockParents {
return errors.Errorf("block header has %d parents, but the maximum allowed amount "+
"is %d", len(msgBlockHeader.ParentHashes), appmessage.MaxBlockParents)
}
*x = BlockHeaderMessage{
Version: uint32(msgBlockHeader.Version),
ParentHashes: domainHashesToProto(msgBlockHeader.ParentHashes),