keep-network / keep-core

The smart contracts and reference client behind the Keep network
https://keep.network
MIT License
118 stars 73 forks source link

Include extra data of deposits for sweep fee estimation #3766

Closed lukasz-zimnoch closed 7 months ago

lukasz-zimnoch commented 7 months ago

Refs: https://github.com/keep-network/tbtc-v2/issues/749

Bitcoin scripts of deposits embedding 32-byte extra data are longer (126 bytes) than the scripts of regular deposits not holding extra data (92 bytes). That means the actual virtual size of the resulting deposit sweep transaction is greater than the size assumed by the sweep fee estimator. Here we adjust the fee estimator to always take the longer script for calculations to avoid underestimation of the transaction fee. This approach is not ideal but is safe as it makes sure transactions are not rejected due to too low network fees.