Skip to content

[bug]: unreliable automatic sharding of assets #1581

Open
@ZZiigguurraatt

Description

@ZZiigguurraatt

I have the following network where dave tries to route a payment to fabia through two taproot asset channels between erin and fabia.

 Dave  --[sats]-->  Erin  --[assets]-->  Fabia
                      |                    ^
                      |                    |
                       -----[assets]-------

If I try to send a payment from erin to fabia, it has always automatically sharded okay in the cases I've tried.

If I try to send a payment from dave to fabia, sometimes it automatically shards okay.

If I manually shard, I've always been able to get the payment to route from dave to fabia.

I've created a rough itest that demonstrates a case where it does not automatically shard successfully: ZZiigguurraatt/lightning-terminal@8daea37

In the comments you'll find an example where we can adjust the taproot-assets.experimental.rfq.mockoracleassetsperbtc or manual sharding and get it to work. I'm not sure if the taproot-assets.experimental.rfq.mockoracleassetsperbtc actually has anything to do with the problem or if the sharding is struggling to work automatically at different asset/satoshi amounts and changing taproot-assets.experimental.rfq.mockoracleassetsperbtc is a way to trigger the problem easily.

You can run the itest with

make itest-only icase=sharding_problem

and then it fails with

    litd_custom_channels_test.go:219: Dave    balance: local=0         remote=0        , localSat=4996530  , remoteSat=0         (initial)
    litd_custom_channels_test.go:219: Erin    balance: local=10000000  remote=0        , localSat=191716   , remoteSat=4998654   (initial)
    litd_custom_channels_test.go:219: Fabia   balance: local=0         remote=10000000 , localSat=2124     , remoteSat=191716    (initial)
    assets_test.go:1926: Asking peer 0384b0c60abd9fbe984a2dd5ef1aa055cf13d6953fca514bdccc26b4eb65196dcb for quote to buy assets to receive for invoice over 6000000 units; waiting up to 300s
    assets_test.go:1971: Got quote for 9852216748 asset units per BTC
    assets_test.go:1989: Got quote for 60900000 mSats at 10.150000 msat/unit from peer 303338346230633630616264396662653938346132646435656631616130353563663133643639353366636135313462646363633236623465623635313936646362 with SCID 17681938970481137535
    assets_test.go:1616: 
                Error Trace:    /two_channel_test/itest/assets_test.go:1616
                                                        /two_channel_test/itest/assets_test.go:1572
                                                        /two_channel_test/itest/litd_custom_channels_test.go:232
                                                        /two_channel_test/itest/test_harness.go:103
                                                        /two_channel_test/itest/litd_test.go:88
                Error:          Received unexpected error:
                                rpc error: code = DeadlineExceeded desc = context deadline exceeded
                Test:           TestLightningTerminal/sharding_problem
itest error from [node:Bob]: receive topology client stream got err:graph subscription err: rpc error: code = Unknown desc = malformed header: missing HTTP content-type
    harness.go:381: finished test: , start height=438, end height=487, mined blocks=49
    harness.go:403: !============================================!
        Too many blocks (49) mined in one test! Tips:
        1. break test into smaller individual tests, especially if this is a table-drive test.
        2. use smaller CSV via `--bitcoin.defaultremotedelay=1.`
        3. use smaller CLTV via `--bitcoin.timelockdelta=18.`
        4. remove unnecessary CloseChannel when test ends.
        5. use `CreateSimpleNetwork` for efficient channel creation.
        
    harness.go:340: test failed, skipped cleanup
2025-06-03 18:16:43.28246954 +0000 UTC: itest error from [:bob-custom]: found nil RPC clients
=== NAME  TestLightningTerminal
    litd_test.go:102: Failure time: 2025-06-03 14:16:43.319
--- FAIL: TestLightningTerminal (143.89s)
    --- FAIL: TestLightningTerminal/sharding_problem (143.89s)
FAIL
make: *** [Makefile:252: run-itest-only] Error 255

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions