Skip to content

Bug: count in defined activity produces count-1 events (one less than expected) #222

Open
@alexzaitsev

Description

@alexzaitsev

Describe the bug

count in defined activity produces one event less than expected. For example, this activity transfers 75 satoshi instead of expected 100:

        {
            "source": "alice",
            "destination": "grace",
            "interval_secs": 1,
            "amount_msat": 25000,
            "count": 4
        }

To Reproduce

Steps to reproduce the behavior:

  1. Checking balance on grace (receiver): "balance": "2625".
  2. Running sim-cli (with more logs in produce_events, no functionality changed):
2025-02-24T00:44:31.404Z INFO  [sim_cli] Connected to alice - Node ID: 020abed80867adb94d6d48748d8c9b22d64401b458f93d65644d60e4c9a2a361ba.
2025-02-24T00:44:31.427Z INFO  [sim_cli] Connected to judy - Node ID: 0367c0f31a850862bdeb5e6c41d6bda200831022d60841bc79a5bc0b5ed62c9c63.
2025-02-24T00:44:31.451Z INFO  [sim_cli] Connected to carol - Node ID: 03b7a5cafdbd65eb3a05eeb1740fa1773c3a2bd697f03af93e14996aa75b142dcb.
2025-02-24T00:44:31.475Z INFO  [sim_cli] Connected to erin - Node ID: 02f59712b098d1ca2342d6da800e756e3e97bda93e6a59bc5a9fc25ce8d09d0dc5.
2025-02-24T00:44:31.498Z INFO  [sim_cli] Connected to ivan - Node ID: 03029b147528c3efd367985bf6f601d04374d843bf808ac2e21919955b8e5edec2.
2025-02-24T00:44:31.521Z INFO  [sim_cli] Connected to grace - Node ID: 02a6da494f563088e7e498aed58197cd342496710e2b85d1240054f1caffcf1708.
2025-02-24T00:44:31.521Z INFO  [simln_lib] Running the simulation forever.
2025-02-24T00:44:31.636Z INFO  [simln_lib] Simulation is running on regtest.
2025-02-24T00:44:31.636Z INFO  [simln_lib] Simulating 1 activity on 6 nodes.
2025-02-24T00:44:31.636Z INFO  [simln_lib] Summary of results will be reported every 60s.
2025-02-24T00:44:31.636Z INFO  [simln_lib] Starting activity producer for alice(020abe...a361ba): static payment of 25000 to grace(02a6da...cf1708) every 1s.
===current_count=0
===target_count=4
Generated payment: alice(020abe...a361ba) -> grace(02a6da...cf1708): 25000 msat.
send result: Ok(())
===current_count=1
===target_count=4
Generated payment: alice(020abe...a361ba) -> grace(02a6da...cf1708): 25000 msat.
send result: Ok(())
===current_count=2
===target_count=4
Generated payment: alice(020abe...a361ba) -> grace(02a6da...cf1708): 25000 msat.
send result: Ok(())
===current_count=3
===target_count=4
Generated payment: alice(020abe...a361ba) -> grace(02a6da...cf1708): 25000 msat.
send result: Ok(())
===current_count=4
===target_count=4
2025-02-24T00:44:35.645Z INFO  [simln_lib] Payment count has been met for alice(020abe...a361ba): 4 payments. Stopping the activity.
2025-02-24T00:44:35.645Z INFO  [simln_lib] All producers finished. Shutting down.
  1. Checking balance again: "balance": "2700",.
    As we see the balance is 2700 but the expected balance is 2725.
  2. Check result report:
source,destination,amount_msat,hash,dispatch_time,htlc_count,payment_outcome
020abed80867adb94d6d48748d8c9b22d64401b458f93d65644d60e4c9a2a361ba,02a6da494f563088e7e498aed58197cd342496710e2b85d1240054f1caffcf1708,25000,f1b9a8fe1548fbc98ecf0e5fe01861607f5e26ba47e6992235a141d4db599291,1740358196162,1,Success
020abed80867adb94d6d48748d8c9b22d64401b458f93d65644d60e4c9a2a361ba,02a6da494f563088e7e498aed58197cd342496710e2b85d1240054f1caffcf1708,25000,2579008af17feb6b4cc7af439e1e594739ca42a83c840ac45f5a78c903bb4ca4,1740358197163,1,Success
020abed80867adb94d6d48748d8c9b22d64401b458f93d65644d60e4c9a2a361ba,02a6da494f563088e7e498aed58197cd342496710e2b85d1240054f1caffcf1708,25000,2d20a3cf8f9d0aa519dec58d9dcbe378554c9fa72317fccef0d5221a130ec3ff,1740358198165,1,Success

There are 3 events (4 expected).

Config

{
    "nodes": [
        {
            "id": "alice",
            "address": "127.0.0.1:10001",
            "cert": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/alice/tls.cert",
            "macaroon": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon"
        },
        {
            "id": "judy",
            "address": "127.0.0.1:10010",
            "cert": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/judy/tls.cert",
            "macaroon": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/judy/data/chain/bitcoin/regtest/admin.macaroon"
        },
        {
            "id": "carol",
            "address": "127.0.0.1:10003",
            "cert": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/carol/tls.cert",
            "macaroon": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/carol/data/chain/bitcoin/regtest/admin.macaroon"
        },
        {
            "id": "erin",
            "address": "127.0.0.1:10005",
            "cert": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/erin/tls.cert",
            "macaroon": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/erin/data/chain/bitcoin/regtest/admin.macaroon"
        },
        {
            "id": "ivan",
            "address": "127.0.0.1:10009",
            "cert": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/ivan/tls.cert",
            "macaroon": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/ivan/data/chain/bitcoin/regtest/admin.macaroon"
        },
        {
            "id": "grace",
            "address": "127.0.0.1:10007",
            "cert": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/grace/tls.cert",
            "macaroon": "/Users/p3ngu1n/.polar/networks/1/volumes/lnd/grace/data/chain/bitcoin/regtest/admin.macaroon"
        }
    ],
    "activity": [
        {
            "source": "alice",
            "destination": "grace",
            "interval_secs": 1,
            "amount_msat": 25000,
            "count": 4
        }
    ]
}

I inspected produce_events function but didn't see anything unusual.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions