diff --git a/common/directoryBlock/directoryBlock.go b/common/directoryBlock/directoryBlock.go index eb38806cd3..564b3c7b23 100644 --- a/common/directoryBlock/directoryBlock.go +++ b/common/directoryBlock/directoryBlock.go @@ -282,13 +282,12 @@ func (e *DirectoryBlock) String() string { out.WriteString(fmt.Sprintf("%20s %v\n", "fullhash:", fh.String())) out.WriteString(e.GetHeader().String()) - out.WriteString("entries: \n") + out.WriteString("entries:\n") for i, entry := range e.DBEntries { out.WriteString(fmt.Sprintf("%5d %s", i, entry.String())) } return (string)(out.DeepCopyBytes()) - } func (b *DirectoryBlock) MarshalBinary() (rval []byte, err error) { diff --git a/common/factoid/fblock.go b/common/factoid/fblock.go index a7fe14b6df..21742a6923 100644 --- a/common/factoid/fblock.go +++ b/common/factoid/fblock.go @@ -346,18 +346,17 @@ func (b *FBlock) UnmarshalBinaryData(data []byte) ([]byte, error) { return nil, err } - // txLimit is the maximum number of transactions (min 78 bytes) that could - // fit into the remaining unread portion of the buffer. + // txLimit is the maximum number of transactions (min 20 bytes for an empty + // coinbase tx) that could fit into the unread portion of the buffer. l := buf.Len() - txLimit := uint32(l / 78) + txLimit := uint32(l / 20) if txCount > txLimit { - //return nil, fmt.Errorf( - // "Error: FBlock.Unmarshal: transaction count %d higher than space "+ - // "in body %d (uint underflow?)", - // txCount, txLimit, - //) - fmt.Println("Got here", txCount, txLimit) + return nil, fmt.Errorf( + "Error: FBlock.Unmarshal: transaction count %d higher than space "+ + "in body %d (uint underflow?)", + txCount, txLimit, + ) } b.Transactions = make([]interfaces.ITransaction, int(txCount), int(txCount))