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

Function TransactionHandle

p2pserver/message/utils/msg_handler.go:226–237  ·  view source on GitHub ↗

TransactionHandle handles the transaction message from peer

(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

Source from the content-addressed store, hash-verified

224
225// TransactionHandle handles the transaction message from peer
226func TransactionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{}) {
227 log.Trace("[p2p]receive transaction message", data.Addr, data.Id)
228
229 var trn = data.Payload.(*msgTypes.Trn)
230
231 if !txCache.Contains(trn.Txn.Hash()) {
232 txCache.Add(trn.Txn.Hash(), nil)
233 actor.AddTransaction(trn.Txn)
234 } else {
235 log.Tracef("[p2p]receive duplicate Transaction message, txHash: %x\n", trn.Txn.Hash())
236 }
237}
238
239// VersionHandle handles version handshake protocol from peer
240func VersionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{}) {

Callers 1

TestTransactionHandleFunction · 0.85

Calls 5

TraceFunction · 0.92
TracefFunction · 0.92
AddMethod · 0.80
AddTransactionMethod · 0.80
HashMethod · 0.65

Tested by 1

TestTransactionHandleFunction · 0.68