Skip to content
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

Inscribing on high offset satpoints causes false high fee report #1844

Closed
gmart7t2 opened this issue Feb 27, 2023 · 0 comments · Fixed by #1853
Closed

Inscribing on high offset satpoints causes false high fee report #1844

gmart7t2 opened this issue Feb 27, 2023 · 0 comments · Fixed by #1853

Comments

@gmart7t2
Copy link
Contributor

We have 2 outputs worth 1 million and 100k. No inscriptions, nothing locked:

$ ord wallet outputs | jq -cM '.[]'
{"output":"09333af8d91af16b00db361ea8005908a12a10393efd54b794263547d7d11ad5:0","amount":1000000},
{"output":"08672f8ee4f222989fb61883bcbd0bf7777622c475b1b2fc65257d24edced3dc:1","amount":100000}
$ ord wallet inscriptions | jq -cM
[]
$ bitcoin listlockunspent | jq -cM
[]

We inscribe a short text message on the last sat of the bigger output. ord tells us the fee is almost a million sats:

$ echo hello > /tmp/hello.txt
$ ord wallet inscribe --satpoint 09333af8d91af16b00db361ea8005908a12a10393efd54b794263547d7d11ad5:0:999999 /tmp/hello.txt
{
  "commit": "25bd32cc6b2d65335743e5c5592f8f9a9bc9e209765ec0b416166a1ed89ccd36",
  "inscription": "f6677e67a5298dcd146fa25ea73a318a6135e4ad1bc1dd3b5bb54d16e733c522i0",
  "reveal": "f6677e67a5298dcd146fa25ea73a318a6135e4ad1bc1dd3b5bb54d16e733c522",
  "fees": 990254
}

We check the transactions and see that the fee wasn't really that big:

$ ctx=25bd32cc6b2d65335743e5c5592f8f9a9bc9e209765ec0b416166a1ed89ccd36
$ rtx=f6677e67a5298dcd146fa25ea73a318a6135e4ad1bc1dd3b5bb54d16e733c522
$ for tx in $ctx $rtx; do echo vsize: $(bitcoin getrawtransaction $tx 1 | jq .vsize), fee: $(bitcoin gettransaction $tx | jq '.fee*-1e8|round'); done
vsize: 255, fee: 255
vsize: 139, fee: 139
$ python -c "print 255 + 139"
394

We confirm by checking the remaining outputs. We're only missing 394 sats:

$ ord wallet outputs | jq -cM '.[]'
{"output":"f6677e67a5298dcd146fa25ea73a318a6135e4ad1bc1dd3b5bb54d16e733c522:0","amount":10000}
{"output":"25bd32cc6b2d65335743e5c5592f8f9a9bc9e209765ec0b416166a1ed89ccd36:0","amount":999999}
{"output":"25bd32cc6b2d65335743e5c5592f8f9a9bc9e209765ec0b416166a1ed89ccd36:2","amount":89607}
$ python -c "print (1000000 + 100000) - (10000 + 999999 + 89607)"
394
gmart7t2 added a commit to gmart7t2/ord that referenced this issue Feb 27, 2023
The inscribe command would calculate the reveal tx fee incorrectly whenever the reveal tx wasn't funded by the first output of the commit tx as is the case when you inscribe on a satpointvwith a non zero offset.

In such cases If the first output of the commit tx was much smaller than the 2nd the inscribe command would fail due to calculating a negative fee.

This commit fixes the problem and closes ordinals#1844.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant