Skip to content

Add print expected route #1005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ZZiigguurraatt
Copy link

Introduce a new function printExpectedRoute which is meant to be an improvement upon logBalance to give a more refined view of only the balances of the specific channels participating in the itest case.

  • Print channel sat and asset (if defined) balances between two nodes taking into account the channel reserve.
  • Check (shows (✔) or (x) )to see if satsToSend and assetsToSend are available to send/forward in the channel (if non-zero).
  • Check to see if the channel is actually active (A) or inactive (I).

Here is an example of the difference in output between logBalance and printExpectedRoute:

logBalance

litd_custom_channels_test.go:678: Charlie balance: local=785837    remote=14163    , localSat=90086    , remoteSat=6833      (before asset-to-asset)
litd_custom_channels_test.go:678: Dave    balance: local=114163    remote=785837   , localSat=4631585  , remoteSat=558784    (before asset-to-asset)
litd_custom_channels_test.go:678: Erin    balance: local=24004     remote=25996    , localSat=561723   , remoteSat=4531726   (before asset-to-asset)
litd_custom_channels_test.go:678: Fabia   balance: local=25996     remote=24004    , localSat=3894     , remoteSat=93026     (before asset-to-asset)
litd_custom_channels_test.go:678: Yara    balance: local=0         remote=100000   , localSat=0        , remoteSat=96920     (before asset-to-asset)

printExpectedRoute

assets_test.go:2028: actual channel capacities (before asset-to-asset):
assets_test.go:2029: expected route: [Charlie Dave Yara]
assets_test.go:2088: (A) cap: 100000 sat, Charlie->[bal: 90086 sat|res: 1000 sat|spend: 89086 sat], Dave->[bal: 6833 sat|res: 1062 sat|spend: 5771 sat], commit_fee: 2421
assets_test.go:2127: (✔) (A) cap: 800000 itest-asset-cents, Charlie->[bal: 785837 itest-asset-cents], Dave->[bal: 14163 itest-asset-cents]
assets_test.go:2088: (A) cap: 100000 sat, Dave->[bal: 96920 sat|res: 1000 sat|spend: 95920 sat], Yara->[bal: 0 sat|res: 1062 sat|spend: 18446744073709550554 sat], commit_fee: 2750
assets_test.go:2127: (✔) (A) cap: 100000 itest-asset-cents, Dave->[bal: 100000 itest-asset-cents], Yara->[bal: 0 itest-asset-cents]

I have not gone through and changed all 60+ uses of logBalance because I'd like to see if anyone else likes this feature before wasting time on it. If the output of this new function printExpectedRoute is not desired in litd_custom_channels_test.go, I'd at least like to get it added in assets_test.go so that I can use it temporarily in litd_custom_channels_test.go when debugging tests.

Also, this PR builds on top of #1004 but let me know if I should build on top of master instead.

@ZZiigguurraatt ZZiigguurraatt marked this pull request as ready for review March 21, 2025 18:01
@levmi levmi moved this from 🆕 New to 🏗 In progress in Taproot-Assets Project Board Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant