When estimating the claim tx fee for reverse swaps (send onchain), we used a dummy tx with a simple input and a simple output. This was a non-segwit tx with a size of 60 Bytes.
However, this tx structure is simpler than the actual claim tx, which is a segwit tx where the input has a witness with 3 elements: a signature, the preimage and the redeem script. A claim tx has approx. 310 Bytes / 148 vBytes. The actual size varies within a few bytes, depending on the output type and on signature size fluctuations (+/-1 Byte).
This PR extracts the low-level creation of the claim tx in it's own build_claim_tx_inner, which it then re-uses
in the actual claim tx: create_claim_tx
in constructing a dummy tx for the purposes of fee estimation: build_fake_claim_tx
This way, the claim tx fee estimation is based on a realistic tx.
The PR is split in 2 commits, for easier review: extracting the low-level build_claim_tx_inner and adding build_fake_claim_tx on top.
When estimating the claim tx fee for reverse swaps (send onchain), we used a dummy tx with a simple input and a simple output. This was a non-segwit tx with a size of 60 Bytes.
However, this tx structure is simpler than the actual claim tx, which is a segwit tx where the input has a witness with 3 elements: a signature, the preimage and the redeem script. A claim tx has approx. 310 Bytes / 148 vBytes. The actual size varies within a few bytes, depending on the output type and on signature size fluctuations (+/-1 Byte).
This PR extracts the low-level creation of the claim tx in it's own
build_claim_tx_inner
, which it then re-usescreate_claim_tx
build_fake_claim_tx
This way, the claim tx fee estimation is based on a realistic tx.
The PR is split in 2 commits, for easier review: extracting the low-level
build_claim_tx_inner
and addingbuild_fake_claim_tx
on top.Fixes #1054