MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / BenchmarkValidateTxn

Function BenchmarkValidateTxn

transaction_benchmark_test.go:222–241  ·  view source on GitHub ↗

BenchmarkValidateTxn measures transaction reference validation

(b *testing.B)

Source from the content-addressed store, hash-verified

220
221// BenchmarkValidateTxn measures transaction reference validation
222func BenchmarkValidateTxn(b *testing.B) {
223 setupBenchmarkConfig()
224 mockDS := setupMockDataSource()
225
226 ledgerforgeInstance := &LedgerForge{
227 datasource: mockDS,
228 config: setupBenchmarkConfig(),
229 }
230
231 ctx := context.Background()
232
233 b.ResetTimer()
234 for i := 0; i < b.N; i++ {
235 txn := createTestTransaction("source-001", "dest-001", fmt.Sprintf("ref-%d", i), 100.00)
236 err := ledgerforgeInstance.validateTxn(ctx, txn)
237 if err != nil {
238 b.Fatal(err)
239 }
240 }
241}
242
243// BenchmarkHashBalanceID measures the hash function used for queue assignment
244func BenchmarkHashBalanceID(b *testing.B) {

Callers

nothing calls this directly

Calls 5

validateTxnMethod · 0.95
setupBenchmarkConfigFunction · 0.85
setupMockDataSourceFunction · 0.85
createTestTransactionFunction · 0.85
FatalMethod · 0.45

Tested by

no test coverage detected