-
Notifications
You must be signed in to change notification settings - Fork 102
Add itest for MinRelayFee check in tapd #892
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Release Notes | ||
|
||
- [Lightning Terminal](#lightning-terminal) | ||
- [Bug Fixes](#bug-fixes) | ||
- [Functional Changes/Additions](#functional-changesadditions) | ||
- [Technical and Architectural Updates](#technical-and-architectural-updates) | ||
- [Integrated Binary Updates](#integrated-binary-updates) | ||
- [LND](#lnd) | ||
- [Loop](#loop) | ||
- [Pool](#pool) | ||
- [Faraday](#faraday) | ||
- [Taproot Assets](#taproot-assets) | ||
- [Contributors](#contributors-alphabetical-order) | ||
|
||
## Lightning Terminal | ||
|
||
### Bug Fixes | ||
|
||
### Functional Changes/Additions | ||
|
||
* [Add itest](https://github.com/lightninglabs/lightning-terminal/pull/892) for | ||
the MinRelayFee check added in Taproot Assets. The test ensures that | ||
transactions with fees below the minimum relay fee are rejected. | ||
|
||
### Technical and Architectural Updates | ||
|
||
## Integrated Binary Updates | ||
|
||
### LND | ||
|
||
### Loop | ||
|
||
### Pool | ||
|
||
### Faraday | ||
|
||
### Taproot Assets | ||
|
||
|
||
|
||
# Contributors (Alphabetical Order) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ import ( | |
"github.com/lightningnetwork/lnd/lntest" | ||
"github.com/lightningnetwork/lnd/lntest/port" | ||
"github.com/lightningnetwork/lnd/lntest/wait" | ||
"github.com/lightningnetwork/lnd/lnwallet/chainfee" | ||
"github.com/lightningnetwork/lnd/lnwire" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
@@ -2637,3 +2638,87 @@ func testCustomChannelsOraclePricing(_ context.Context, | |
noOpCoOpCloseBalanceCheck, | ||
) | ||
} | ||
|
||
// testCustomChannelsFee tests the whether the custom channel funding process | ||
// fails if the proposed fee rate is lower than the minimum relay fee. | ||
func testCustomChannelsFee(_ context.Context, | ||
net *NetworkHarness, t *harnessTest) { | ||
|
||
ctxb := context.Background() | ||
lndArgs := slices.Clone(lndArgsTemplate) | ||
litdArgs := slices.Clone(litdArgsTemplate) | ||
|
||
zane, err := net.NewNode( | ||
t.t, "Zane", lndArgs, false, true, litdArgs..., | ||
) | ||
require.NoError(t.t, err) | ||
|
||
litdArgs = append(litdArgs, fmt.Sprintf( | ||
"--taproot-assets.proofcourieraddr=%s://%s", | ||
proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), | ||
)) | ||
|
||
charlie, err := net.NewNode( | ||
t.t, "Charlie", lndArgs, false, true, litdArgs..., | ||
) | ||
require.NoError(t.t, err) | ||
dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) | ||
require.NoError(t.t, err) | ||
|
||
nodes := []*HarnessNode{charlie, dave} | ||
connectAllNodes(t.t, net, nodes) | ||
fundAllNodes(t.t, net, nodes) | ||
|
||
charlieTap := newTapClient(t.t, charlie) | ||
daveTap := newTapClient(t.t, dave) | ||
|
||
// Mint an assets on Charlie and sync Dave to Charlie as the universe. | ||
mintedAssets := itest.MintAssetsConfirmBatch( | ||
t.t, t.lndHarness.Miner.Client, charlieTap, | ||
[]*mintrpc.MintAssetRequest{ | ||
{ | ||
Asset: itestAsset, | ||
}, | ||
}, | ||
) | ||
cents := mintedAssets[0] | ||
assetID := cents.AssetGenesis.AssetId | ||
|
||
t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) | ||
syncUniverses(t.t, charlieTap, dave) | ||
t.Logf("Universes synced between all nodes, distributing assets...") | ||
|
||
// Fund a channel with a fee rate of zero. | ||
zeroFeeRate := uint32(0) | ||
|
||
_, err = charlieTap.FundChannel( | ||
ctxb, &tchrpc.FundChannelRequest{ | ||
AssetAmount: cents.Amount, | ||
AssetId: assetID, | ||
PeerPubkey: daveTap.node.PubKey[:], | ||
FeeRateSatPerVbyte: zeroFeeRate, | ||
PushSat: 0, | ||
}, | ||
) | ||
|
||
errSpecifyFeerate := "fee rate must be specified" | ||
require.ErrorContains(t.t, err, errSpecifyFeerate) | ||
|
||
// Fund a channel with a fee rate that is too low. | ||
tooLowFeeRate := uint32(1) | ||
tooLowFeeRateAmount := chainfee.SatPerVByte(tooLowFeeRate) | ||
|
||
_, err = charlieTap.FundChannel( | ||
ctxb, &tchrpc.FundChannelRequest{ | ||
AssetAmount: cents.Amount, | ||
AssetId: assetID, | ||
PeerPubkey: daveTap.node.PubKey[:], | ||
FeeRateSatPerVbyte: tooLowFeeRate, | ||
PushSat: 0, | ||
}, | ||
) | ||
|
||
errFeeRateTooLow := fmt.Sprintf("fee rate %s too low, "+ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This actually shows a problem with the sat/vByte fee rate... Because 1 sat/vByte is equal to 250 sat/kw but the absolute minimum relay fee there can ever be is defined as 253 sat/kw, this would mean that you could only fund channels with at least 2 sat/vBytes. Which is kind of unfortunate. |
||
"min_relay_fee: ", tooLowFeeRateAmount.FeePerKWeight()) | ||
require.ErrorContains(t.t, err, errFeeRateTooLow) | ||
} |
Uh oh!
There was an error while loading. Please reload this page.