lightninglabs / taproot-assets

A layer 1 daemon, for the Taproot Assets Protocol specification, written in Go (golang)
MIT License
465 stars 112 forks source link

[bug]: On signet, min-relay-fee is not met if fee is not specified. Fee will be 1 sat short #1171

Open habibitcoin opened 1 week ago

habibitcoin commented 1 week ago

Background

When using signet, it seems that calls to AnchorVirtualPSBT RPC and to SendAsset RPC will result in a transaction that does not meet the min-relay-fee. The vsize of the transaction ends up being 254.5 vB usually (see https://mempool.space/signet/tx/aff4e70f1816ec611da03a89889be79b81b57067355abe99c14e89f0f2085ba8#vin=0 as an example).

Here is an example txn that will not relay with a fee rate of barely under 1.00 sats/vB (size is 254.5, fee is 254)

02000000000102aee61b60b329cd99950230a146a11b16ff53c85109d352aee5a5e87088f62b990000000000000000000c6c3c8409df4c95942069945a9cd867d657d13b635814d7884580d9c74a64be01000000000000000003e803000000000000225120b5b88d39d530a564e1b6e2b714e0d4c16bc284b49778898f98faffd8db135b13e803000000000000225120b59492b62792ca980cd5dd087099897d63b6f85fea0680a43e792d70191ee54d00b5eb0b00000000225120d430711c2a954904278394c6c9378713534a2d1d5c37fbea58deebef95596cea0140510398932e106f72156dc13213a7999ef77544a8bf5ee11b7b24859555908b8bd18b30c5889233c95abcc4f7cd2dddc2eab36266f89c38adb137c6e6bdda3a960140a2ccf5834b81952fe1c3eac8276743d6c4571ba232cc98ea0129e7b3582cca21dab09f0f953b98e5f0f8768ec0a4fd400a6b36cc496cb96cef7c47ba75fde17300000000

I'm not sure exactly the problem here, perhaps something related to the nature of signet transactions (I havent seen this problem on other networks). Also unfortunately it seems not everyone has adopted package relay, so unable to use CPFP via package relay to unstuck the above txn using the below child:

02000000000101f18d47aae097b364ad0dc9409c8b917db47cf1f1535606283614b943d84ed4c202000000000000000001a784eb0b0000000022512044be1fcf86a056efc21c6775b3b348756f3e099a3da70bbe5726558db2b595ac0140b16fcf7770feb3190b6a1bc524c3f80244e7d09399e66808a91594b16289d2b25d341e597834fc7622dc5857576c1a3d72592fce3105636cd5b7a2aad3438e597f5d0300

Your environment

tapcli getinfo                       # version of `tapd`, `lnd`, and network
{
    "version": "0.4.1-alpha commit=622c7929",
    "lnd_version": "0.18.3-beta",
    "network": "signet",
    "lnd_identity_pubkey": "026580b3316c7b10f487235d8e3247ba960f4d96952aa0edb85a4e096501bb4acc",
    "node_alias": "Tajfi",
    "block_height": 220574,
    "block_hash": "00000109ab0a6ba26dd8b8fb078368e5af4d8ad6fbaca796933d1d1cc4ab6a82",
    "sync_to_chain": true
}
uname -mrsv                          # operating system 
Linux 6.8.0-1015-gcp #17~22.04.1-Ubuntu SMP Tue Sep  3 16:11:52 UTC 2024 x86_64

bitcoind --version  # version of `btcd`, `bitcoind`, or other backend
Bitcoin Core version v28.0.0

Steps to reproduce

Mint any asset and finalize the batch. Then try to spend the asset using the CLI and do NOT specify a fee rate.

Expected behavior

Transaction should be generated with 254.5 sats --> round up to 255 sats

Actual behavior

Transaction generated is 254 sats

dstadulis commented 4 days ago

@habibitcoin was this behavior encountered while using litd or tapd?

habibitcoin commented 2 days ago

@dstadulis was using tapd specifically

gijswijs commented 2 days ago

I wasn't able to reproduce the issue, but for testing purposes I use regtest. so that might have to do with it.

What I did is create an itest that creates a synthetic situation where the fees don't meet the min relay fee. That way I recreated the issue. PR #1191 should fix this by bumping the fees to the min relay fee before broadcasting.

habibitcoin commented 1 day ago

awesome @gijswijs that should work! and yeah, i couldn't reproduce on regtest either, seemed to be strictly a signet issue

jharveyb commented 1 day ago

What chain backend are you using for the lnd that's backing tapd for your signet setup?

It's possible that the fee floor LND is using is misconfigured, or the min relay fee LND is reading from that chain backend is not being propagated correctly.

From mempool.space it looks like the feerate for signet is often 1 sat/vB, but I think LND has sanity checks before TX broadcast that maybe should have caught this anyways.