mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
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:
parent
1486a6312c
commit
3d668cc1bd
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user