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

Method RemoveTimeoverTxHashes

http/websocket/session/session.go:109–123  ·  view source on GitHub ↗

remove timew over transaction hashes

()

Source from the content-addressed store, hash-verified

107
108//remove timew over transaction hashes
109func (self *Session) RemoveTimeoverTxHashes() (remove []TxHashInfo) {
110 self.Lock()
111 defer self.Unlock()
112 index := len(self.TxHashArr)
113 now := time.Now().Unix()
114 for k, v := range self.TxHashArr {
115 if (now - v.StartTime) < int64(cfg.DEFAULT_GEN_BLOCK_TIME*10) {
116 index = k
117 break
118 }
119 }
120 remove = self.TxHashArr[0:index]
121 self.TxHashArr = self.TxHashArr[index:]
122 return remove
123}
124
125//append transaction hash
126func (self *Session) AppendTxHash(txhash string) {

Callers 1

OnDataHandleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected