SiaFoundation / walletd

A new Sia wallet
https://sia.tech/software/walletd
MIT License
14 stars 6 forks source link

The transaction flow should use the txpool recommended fee endpoint #89

Closed alexfreska closed 2 months ago

alexfreska commented 4 months ago

@n8maninger does walletds fee endpoint returns recommended fee per byte? Meaning the fee should be calculated as fee * bytes in encoded transaction? If so, what is the best way to calculate the fee if the exact transaction size is not known until after calling /fund, which requires passing the fee.

n8maninger commented 4 months ago

It is the recommended fee per byte.

The correct way would be to call fund, release the inputs, estimate the size and multiply by fee, then call fund again with the fee estimate.

The way you should do it is to get the recommended fee per byte and multiply it by 1000 bytes.

alexfreska commented 4 months ago

The correct way would be to call fund, release the inputs, estimate the size and multiply by fee, then call fund again with the fee estimate.

@n8maninger isn't there a slight chance it would select different inputs?

The way you should do it is to get the recommended fee per byte and multiply it by 1000 bytes.

Do you mean to do this rather than the tedious "correct" way, just charge for 1000 bytes and thats roughly always good?

n8maninger commented 2 months ago

Do you mean to do this rather than the tedious "correct" way, just charge for 1000 bytes and thats roughly always good?

Exactly. Most transactions are less than 1000 bytes and the cost difference is negligible.