mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-09 06:12:32 +00:00
broadcast is using refreshUTXOs
, so it should be protected by lock (#2061)
This commit is contained in:
parent
24c94b38be
commit
b84d6fed2c
@ -13,9 +13,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *server) Broadcast(_ context.Context, request *pb.BroadcastRequest) (*pb.BroadcastResponse, error) {
|
func (s *server) Broadcast(_ context.Context, request *pb.BroadcastRequest) (*pb.BroadcastResponse, error) {
|
||||||
s.lock.Lock()
|
|
||||||
defer s.lock.Unlock()
|
|
||||||
|
|
||||||
txIDs, err := s.broadcast(request.Transactions, request.IsDomain)
|
txIDs, err := s.broadcast(request.Transactions, request.IsDomain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -25,6 +22,8 @@ func (s *server) Broadcast(_ context.Context, request *pb.BroadcastRequest) (*pb
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) broadcast(transactions [][]byte, isDomain bool) ([]string, error) {
|
func (s *server) broadcast(transactions [][]byte, isDomain bool) ([]string, error) {
|
||||||
|
s.lock.Lock()
|
||||||
|
defer s.lock.Unlock()
|
||||||
|
|
||||||
txIDs := make([]string, len(transactions))
|
txIDs := make([]string, len(transactions))
|
||||||
var tx *externalapi.DomainTransaction
|
var tx *externalapi.DomainTransaction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user