Skip to content

Add push_asset_amount to OpenChannelRequest and update validation logic#69

Merged
zoedberg merged 1 commit into
RGB-Tools:masterfrom
bitwalt:feat/push-asset-amount
Mar 17, 2026
Merged

Add push_asset_amount to OpenChannelRequest and update validation logic#69
zoedberg merged 1 commit into
RGB-Tools:masterfrom
bitwalt:feat/push-asset-amount

Conversation

@bitwalt
Copy link
Copy Markdown
Contributor

@bitwalt bitwalt commented Aug 1, 2025

  • Introduced push_asset_amount field in OpenChannelRequest struct to handle asset pushes in RGB channels.
  • Updated validation to ensure push_asset_amount is only used with RGB channels and does not exceed asset_amount.
  • Modified channel opening logic to calculate local and remote amounts based on push_asset_amount.
  • Added tests for validating push_asset_amount functionality and error conditions.

Closes #67

@bitwalt bitwalt force-pushed the feat/push-asset-amount branch 5 times, most recently from 30b9dbf to 7f638ea Compare March 10, 2026 17:15
Copy link
Copy Markdown
Member

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, please address the requested changes

Comment thread src/routes.rs Outdated
Comment thread src/routes.rs Outdated
Comment thread openapi.yaml Outdated
Comment thread src/test/push_rgb_assets.rs Outdated
Comment thread src/test/push_rgb_assets.rs Outdated
@bitwalt bitwalt force-pushed the feat/push-asset-amount branch from d82e0b7 to 1f8116b Compare March 11, 2026 11:55
@bitwalt
Copy link
Copy Markdown
Contributor Author

bitwalt commented Mar 11, 2026

ok fixes should have been addressed, there was a problem on full-push case that required changes also in rust-lightning due to non-zero opener local balance

Copy link
Copy Markdown
Member

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the requested change. Also please add some more checks/actions (payments, close channel, spend on-chain) after opening the channel with a push amount

Comment thread src/test/openchannel_push_asset_amount.rs Outdated
@bitwalt bitwalt force-pushed the feat/push-asset-amount branch from 1f8116b to fb17583 Compare March 12, 2026 12:33
@bitwalt
Copy link
Copy Markdown
Contributor Author

bitwalt commented Mar 12, 2026

Test updated with more checks (keysend, closing, spending on-onchain)

Copy link
Copy Markdown
Member

@nicbus nicbus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tests need to be further improved.

Comment thread src/test/openchannel_push_asset_amount.rs
Copy link
Copy Markdown
Member

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bitwalt please address #69 (comment) and rebase the commit on top of the updated master

@bitwalt bitwalt force-pushed the feat/push-asset-amount branch 3 times, most recently from 0f87740 to b70b080 Compare March 16, 2026 11:23
@bitwalt
Copy link
Copy Markdown
Contributor Author

bitwalt commented Mar 16, 2026

Changes has been addressed. Let me know if there are other required changes.
I was also thinking, could there be problems if one of the two nodes goes offline before the channel is confirmed, or during some phases of the channel opening ?

@bitwalt bitwalt force-pushed the feat/push-asset-amount branch from b70b080 to 9dfa995 Compare March 16, 2026 13:48
@zoedberg
Copy link
Copy Markdown
Member

Changes has been addressed. Let me know if there are other required changes.

On my PC the test openchannel_push_asset_amount::openchannel_push_asset_amount sometimes fails with these logs:

[...]
sending spontaneously Some(50) of asset Some("rgb:hg2~fj1r-Rj0bDO2-Osm~ps~-nbb6kMa-sMsSRuk-cQI4fno") from node 0.0.0.0:35265 to 02e33febb985a2bbea42746ebfe31683db94e46e0c30f7a5aa9b382b81db1e7723
2026-03-16T15:07:36.295232Z  INFO request{uri=/keysend request_id=7a03f191-6749-4a1e-a8a9-61d124470318}: rgb_lightning_node: STARTED
2026-03-16T15:07:36.299751Z ERROR rgb_lightning_node::routes: ERROR: failed to send payment: RouteNotFound
2026-03-16T15:07:36.302716Z  INFO request{uri=/keysend request_id=7a03f191-6749-4a1e-a8a9-61d124470318 status_code=200 OK}: rgb_lightning_node: ENDED in 7.503876ms
checking payment 35daa64c4a17c405987688c8bc730bc478c5a2a76a001e2c1280492e9d5be9cc is Pending on node 0.0.0.0:35265
listing payments for node 0.0.0.0:35265
2026-03-16T15:07:36.312249Z  INFO request{uri=/listpayments request_id=d5aedde4-14c3-41a4-b3d7-b2383705f8ff}: rgb_lightning_node: STARTED
2026-03-16T15:07:36.312481Z  INFO request{uri=/listpayments request_id=d5aedde4-14c3-41a4-b3d7-b2383705f8ff status_code=200 OK}: rgb_lightning_node: ENDED in 246.023µs
payment found but with status: Failed

thread 'test::openchannel_push_asset_amount::openchannel_push_asset_amount' (2643288) panicked at src/test/mod.rs:675:10:
called `Option::unwrap()` on a `None` value

I was also thinking, could there be problems if one of the two nodes goes offline before the channel is confirmed, or during some phases of the channel opening ?

LDK should handle this, but feel free to do more tests/checks if you think there might be problems.

Comment thread src/test/openchannel_push_asset_amount.rs Outdated
@bitwalt bitwalt force-pushed the feat/push-asset-amount branch 2 times, most recently from 25ddcbb to 28b7a47 Compare March 17, 2026 09:26
Comment thread .gitmodules Outdated
@bitwalt bitwalt force-pushed the feat/push-asset-amount branch from 28b7a47 to d419b04 Compare March 17, 2026 10:55
@zoedberg zoedberg merged commit cdf1a98 into RGB-Tools:master Mar 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support RGB Asset Push in Channel Opening

3 participants