Skip to content

Commit

Permalink
fix: persist the correct size of the txs
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Aug 23, 2024
1 parent 0d2b638 commit 63d4ef2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mempool/cat/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (memR *Reactor) ReceiveEnvelope(e p2p.Envelope) {
for _, tx := range protoTxs {
ntx := types.Tx(tx)
key := ntx.Key()
schema.WriteMempoolTx(memR.traceClient, string(e.Src.ID()), key[:], schema.Download)
schema.WriteMempoolTx(memR.traceClient, string(e.Src.ID()), key[:], len(tx), schema.Download)
// If we requested the transaction we mark it as received.
if memR.requests.Has(peerID, key) {
memR.requests.MarkReceived(peerID, key)
Expand Down Expand Up @@ -331,6 +331,7 @@ func (memR *Reactor) ReceiveEnvelope(e p2p.Envelope) {
memR.traceClient,
string(e.Src.ID()),
txKey[:],
len(tx),
schema.Upload,
)
}
Expand Down
2 changes: 2 additions & 0 deletions mempool/v1/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func (memR *Reactor) ReceiveEnvelope(e p2p.Envelope) {
memR.traceClient,
string(e.Src.ID()),
ntx.Hash(),
len(tx),
schema.Download,
)
err = memR.mempool.CheckTx(ntx, nil, txInfo)
Expand Down Expand Up @@ -303,6 +304,7 @@ func (memR *Reactor) broadcastTxRoutine(peer p2p.Peer) {
memR.traceClient,
string(peer.ID()),
memTx.tx.Hash(),
len(memTx.tx),
schema.Upload,
)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/trace/schema/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (m MempoolTx) Table() string {

// WriteMempoolTx writes a tracing point for a tx using the predetermined
// schema for mempool tracing.
func WriteMempoolTx(client trace.Tracer, peer string, txHash []byte, transferType TransferType) {
func WriteMempoolTx(client trace.Tracer, peer string, txHash []byte, size int, transferType TransferType) {
// this check is redundant to what is checked during client.Write, although it
// is an optimization to avoid allocations from the map of fields.
if !client.IsCollecting(MempoolTxTable) {
Expand All @@ -44,7 +44,7 @@ func WriteMempoolTx(client trace.Tracer, peer string, txHash []byte, transferTyp
client.Write(MempoolTx{
TxHash: bytes.HexBytes(txHash).String(),
Peer: peer,
Size: len(txHash),
Size: size,
TransferType: transferType,
})
}
Expand Down

0 comments on commit 63d4ef2

Please sign in to comment.