MCPcopy Create free account
hub / github.com/DNAProject/DNA / PushTxResult

Method PushTxResult

http/websocket/websocket/server.go:392–416  ·  view source on GitHub ↗
(contractAddrs map[string]bool, txHashStr string, resp map[string]interface{})

Source from the content-addressed store, hash-verified

390}
391
392func (self *WsServer) PushTxResult(contractAddrs map[string]bool, txHashStr string, resp map[string]interface{}) {
393 self.Lock()
394 sessionId := self.TxHashMap[txHashStr]
395 delete(self.TxHashMap, txHashStr)
396 //avoid twice, will send in BroadcastToSubscribers
397 sub := self.SubscribeMap[sessionId]
398 if sub.SubscribeEvent {
399 if len(sub.ContractsFilter) == 0 {
400 self.Unlock()
401 return
402 }
403 for _, addr := range sub.ContractsFilter {
404 if contractAddrs[addr] {
405 self.Unlock()
406 return
407 }
408 }
409 }
410 self.Unlock()
411
412 s := self.SessionList.GetSessionById(sessionId)
413 if s != nil {
414 s.Send(marshalResp(resp))
415 }
416}
417func (self *WsServer) BroadcastToSubscribers(contractAddrs map[string]bool, sub int, resp map[string]interface{}) {
418 // broadcast SubscribeMap
419 self.Lock()

Callers 1

pushEventFunction · 0.80

Calls 3

marshalRespFunction · 0.85
GetSessionByIdMethod · 0.80
SendMethod · 0.65

Tested by

no test coverage detected