Skip to content

Commit

Permalink
Fixed block marking as sent
Browse files Browse the repository at this point in the history
  • Loading branch information
dchertkov committed Jan 18, 2018
1 parent ad31013 commit b10d3ea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/daemons/disseminator.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ func sendHashesResp(resp []byte, w io.Writer, logger *log.Entry) error {
case lr == 0:
return nil
// We got response that mean that node doesn't know about some transactions. We need to send them
case lr > consts.HashSize:
for len(resp) > consts.HashSize {
case lr >= consts.HashSize:
for len(resp) >= consts.HashSize {
// Parse the list of requested transactions
txHash := converter.BytesShift(&resp, consts.HashSize)
tr := &model.Transaction{}
Expand Down
2 changes: 1 addition & 1 deletion packages/model/info_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (ib *InfoBlock) Create(transaction *DbTransaction) error {

// MarkSent update model sent field
func (ib *InfoBlock) MarkSent() error {
return DBConn.Model(ib).Update("sent", "1").Error
return DBConn.Model(ib).Update("sent", 1).Error
}

// BlockGetUnsent returns InfoBlock
Expand Down
2 changes: 1 addition & 1 deletion packages/tcpserver/type1.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func getUnknownTransactions(buf *bytes.Buffer) ([]byte, error) {
var needTx []byte
for buf.Len() > 0 {
newDataTxHash := buf.Next(consts.HashSize)
if len(newDataTxHash) == 0 {
if len(newDataTxHash) != consts.HashSize {
log.WithFields(log.Fields{"len": len(newDataTxHash), "type": consts.ProtocolError}).Error("wrong transactions hash size")
return nil, errors.New("wrong transactions hash size")
}
Expand Down

0 comments on commit b10d3ea

Please sign in to comment.