(dbID proto.DatabaseID, h *hash.Hash)
| 639 | } |
| 640 | |
| 641 | func (s *Service) getBlock(dbID proto.DatabaseID, h *hash.Hash) (count int32, height int32, b *types.Block, err error) { |
| 642 | var blockData []byte |
| 643 | err = s.db.Writer().QueryRow(getBlockByHashSQL, string(dbID), h.String()).Scan(&height, &count, &blockData) |
| 644 | if err != nil { |
| 645 | if errors.Cause(err) == sql.ErrNoRows { |
| 646 | err = ErrNotFound |
| 647 | return |
| 648 | } |
| 649 | |
| 650 | err = errors.Wrapf(err, "query block by hash failed: %s, %s", dbID, h.String()) |
| 651 | return |
| 652 | } |
| 653 | |
| 654 | err = utils.DecodeMsgPack(blockData, &b) |
| 655 | if err != nil { |
| 656 | err = errors.Wrapf(err, "decode block failed: %s", dbID) |
| 657 | } |
| 658 | |
| 659 | return |
| 660 | } |
| 661 | |
| 662 | func (s *Service) getAllSubscriptions() (subscriptions map[proto.DatabaseID]int32, err error) { |
| 663 | subscriptions = map[proto.DatabaseID]int32{} |
no test coverage detected