Commit graph

34802 commits

Author SHA1 Message Date
James Dorfman
a7c455e6bf
Merge pull request #1178 from psgreco/master-fix-linter
Fix lint
2022-09-26 12:21:26 -04:00
Pablo Greco
90c4bf99f6 Fix lint 2022-09-26 12:09:28 -03:00
Pablo Greco
f1dd3de8e1
Merge pull request #1172 from apoelstra/2022-09--wallet-fix
wallet: don't clear out all the blinding data when dropping change
2022-09-26 11:43:30 -03:00
Andrew Poelstra
e5e3ec2700
wallet: account for issuances during coin selection
Prior to coin selection we need to indicate that the issuances will take
extra space, otherwise we may fail to select enough coins to cover our
fees, triggering the new "fee needed exceeds fees available" assertion.
2022-09-22 13:20:29 +00:00
Andrew Poelstra
3c896b11e0
test: rename elements_regression_1172 to follow naming convention 2022-09-20 21:17:50 +00:00
Andrew Poelstra
79fd90f064
wallet: extend fix to "dropped change is the last blinded output" case 2022-09-20 21:17:47 +00:00
Andrew Poelstra
fac694be4c
wallet: don't clear out all the blinding data when dropping change
The Elements 22 blinding logic has an edge case where when we drop change,
leaving only a single blinded output, we recompute a bunch of blinding
data to handle the potential for us to have 0 inputs and 1 output to blind.
(BlindTransaction will fail in this case because it cannot make the
transaction balance with only one output to mess with.)

In this recomputation, we dropped more data than we meant to, causing us
to incorrectly blind an output.
2022-09-20 17:40:47 +00:00
Andrew Poelstra
23e91d0ef8
wallet: fix some fee calculation bugs
First, this reverts commit ca2d72ae8b to reinstate
an assertion that was added in Bitcoin #22686. It did not compile because our
`change_and_fee` variable is a map rather than number; I changed it to use
`map_change_and_fee.at(policyAsset)` to match the equivalent change 2 lines down
from a5d97b363b (merge of Bitcoin #22008).

Then fix the following bugs:

1. Change the new test in rpc_fundrawtransaction.py to bump the -maxtxfee value,
   which we'd otherwise exceed, failing the test and masking actual failures.
   (This was just caused by the extreme fee settings of the test combined with
   Elements' large transactions.)
2. Change the fee-output size estimation for `tx_noinputs_size` to be 46 rather
   than 44 bytes; we forgot that even null surjection/rangeproofs need a 0 byte
   when output witnesses are present. This mistake triggered the new assertion.
3. Correct the logic in which change outputs are sometimes dropped even when
   they are the only blinded output in a transaction with blinded inputs. This
   would cause the new test to fail with `bad-txn-inputs-ne-outputs`; I'm very
   surprised that no existing tests hit this.

   (I have an existing comment block in this code where I "promise" that I had
   a good reason for doing something mysterious related to blinding. I was not
   able to reverse-engineer my intention here, though I think it is related to
   this, but since I couldn't understand it I just left this block intact and
   worked around it.)
4. This then triggered the assertion again since the coin selection code
   assumes that sufficiently-small change will always be dropped. If we prevent
   this drop we will have under-funded the transaction.

   To fix this we add Yet Another Flag `may_need_blinded_dummy` in which we add
   extra weight to `tx_noinputs_size` in the case that we're doing a blinded tx
   but have no blind destinations. We turn this off after coin selection if it
   turns out that we don't have any blinded inputs, though ofc at that point
   much of the damage/inefficiency has already been done..
5. Fix some constants in other functional tests which assumed precise fee
   calculations; these precise values changed because of fixes (2) and (4).

There is one new FIXME, which is that the "dummy change" value will now be a
zero-valued OP_RETURN but we still put a full-size rangeproof and surjection
proof on it. There is some plausible privacy benefit to this but not much,
and wasting 5000+ bytes rather than the ~65 needed for an exact-value proof
is not worth it. We will fix this in the future when we overhaul the wallet
blinding logic.
2022-09-20 17:39:24 +00:00
Glenn Willen
2273079c45
elements: Fix build by removing newly-added assertion from upstream that doesn't make sense with assets 2022-09-20 17:38:44 +00:00
Andrew Chow
dfc3e891d7
wallet: Assert that enough was selected to cover the fees
When the fee is not subtracted from the outputs, the amount that has
been reserved for the fee (change_and_fee - change_amount) must be
enough to cover the fee that is needed. It would be a bug to not do so,
so use an assert to make this obvious if such a situation were to occur.

Github-Pull: bitcoin/bitcoin#22686
Rebased-From: d9262324e8
2022-09-20 17:38:44 +00:00
Pablo Greco
1cfcf1c360
Merge pull request #1155 from delta1/getnewblockhex-commitments
rpc: change getnewblockhex to take multiple commitments
2022-09-07 10:51:44 -03:00
Byron Hambly
5d10ff9f52
lint: fix typo in tx-format doc 2022-09-07 14:44:07 +02:00
Byron Hambly
661c6c7094
feat: change getnewblockhex to take multiple commitments
Modifies the getnewblockhex json rpc call to accept an array of
commitments instead of a single commitment.

Backwards compatibility is maintained by first attempting to parse as a
string for a singular commitment.
2022-09-07 14:43:10 +02:00
James Dorfman
f49e97dd47
Merge pull request #1162 from psgreco/master-fix-fuzzer
Add more CPUs to the fuzzer test
2022-09-06 19:53:19 -04:00
Pablo Greco
ed31d2215f
Merge pull request #1165 from achow101/explicit-pset-fields-tests
pset: Tests and bug fixes for input explicit value and asset fields
2022-09-06 20:01:50 -03:00
Andrew Chow
66290e60cf tests: Tests for pset input explicit value, asset, and proofs 2022-09-06 16:26:49 -04:00
Andrew Chow
2bf627e282 psbt: Fix check for missing asset and its proof 2022-09-06 15:57:21 -04:00
Andrew Chow
6e6a92209c psbt: Store m_asset_proof for PSBT_IN_ELEMENTS_ASSET_PROOF 2022-09-06 15:56:57 -04:00
Andrew Chow
547b3e30ca psbt: Check subkey_len not key.size() 2022-09-06 15:56:39 -04:00
James Dorfman
457a5645fe
Merge pull request #869 from stevenroose/win-installer
Fix Bitcoin name usage in Windows installer
2022-09-06 15:50:12 -04:00
Pablo Greco
b4935a51c0
Merge pull request #1157 from achow101/explicit-pset-fields
pset: Add input explicit value, assets, and proofs, and issuance blinding flag
2022-09-06 16:00:45 -03:00
Pablo Greco
c66363bdc6 Add more CPUs to the fuzzer test 2022-09-06 18:55:06 +00:00
Andrew Chow
9ecbf38050 pset: Respect issuance needs blinded flag 2022-09-06 11:41:02 -04:00
Andrew Chow
cf870ed8d0 rpc: Implement decodepsbt for issuance needs blinded flag 2022-09-06 11:41:02 -04:00
Andrew Chow
9599661475 pset: Implement de/ser of issuance needs blinded flag 2022-09-06 11:41:02 -04:00
Andrew Chow
6291af43f9 doc: Specify flag for blinding issuances 2022-09-06 11:38:03 -04:00
Andrew Chow
4bacc852e9 rpc: Add input explicit value, asset, and proofs to decodepsbt 2022-09-06 11:38:01 -04:00
Andrew Chow
be602495f9 pset: Implement VerifyBlindProofs for PSBTInput 2022-09-06 11:37:14 -04:00
Andrew Chow
59658ece6d pset: Implement de/ser of input explicit value, assets, and proofs 2022-09-06 11:32:41 -04:00
Andrew Chow
172a959c7a doc: Specify input explicit values and assets and their proofs 2022-09-06 11:32:35 -04:00
Steven Roose
da236e8ad9
Merge ElementsProject/elements#1160: Fix createblindedaddress help message
fb5132b7bb Fix createblindedaddress help message (Andrea Bonel)

Pull request description:

ACKs for top commit:
  delta1:
    ACK fb5132b
  stevenroose:
    utACK fb5132b7bb

Tree-SHA512: dd60dac485815b8e02a6dd239862fdc079ad53a7079b75ded3fbd1552a88514b0e5168749d2ad186b589ebbe9d73a1d490f263978bbc67b516ec461e191ef139
2022-09-06 16:06:11 +02:00
Pablo Greco
3e646d4888
Merge pull request #1159 from ElementsProject/elements-tx-format-fix-typo
docs: fix typo in elements-tx-format.md
2022-09-05 16:58:10 -03:00
Andrea Bonel
fb5132b7bb Fix createblindedaddress help message 2022-09-05 11:35:19 -03:00
James Dorfman
6c55d1d53f docs: fix typo in elements-tx-format.md and remove trailing whitespace 2022-09-02 11:26:29 -04:00
James Dorfman
03b646930f
Merge pull request #1154 from andreabonel/master-fix_issue_1151
Elements-qt: Correctly display the amount in the sender's wallet after using Send button
2022-09-01 13:26:40 -04:00
James Dorfman
872478b1be
docs: describe elements transaction serialization format (#1148) 2022-09-01 13:24:11 -04:00
Andrea Bonel
60b913e341 Elements-qt: Correctly display the amount in the sender's wallet after using Send button 2022-08-31 19:12:50 -03:00
Pablo Greco
53da86e398
Merge pull request #1150 from allenpiscitello/pset-issuance-unblinded
Changing PSET to not blind asset issuances by default.
2022-08-24 22:20:42 -03:00
Allen Piscitello
dd2d758bc6 fixed minor issues found in review 2022-08-24 16:31:42 -05:00
Allen Piscitello
2da7d75ee9 removing test that fails due to blinded issuances, which results in incorrect reissuance token ids 2022-08-24 13:36:08 -05:00
Allen Piscitello
420de43c1c removing code to blind issuances. PSET should be modified to include an option to blind or unblind issuances, defaulting to unblind. 2022-08-24 09:42:29 -05:00
Pablo Greco
0be72f4c39
Merge pull request #1146 from andreabonel/master_issue_1144
Elements-qt: Fix arrows to increase/decrease Amount
2022-08-18 13:59:45 -03:00
Pablo Greco
debf46b89e
Merge pull request #1145 from allenpiscitello/pset-fixes
Fixing issuance cases and half blinded cases in PSET
2022-08-18 13:40:04 -03:00
Allen Piscitello
5954b10a1a Fixing issuance cases and half blinded cases in PSET 2022-08-18 11:20:02 -05:00
Andrea Bonel
38e9490de5 Elements-qt: Fix arrows to increase/decrease Amount 2022-08-18 13:16:37 -03:00
Pablo Greco
fa809aff5e
Merge pull request #1141 from ElementsProject/roconnor-blockstream-patch-1
Fix tapscript comment
2022-08-12 13:01:41 -03:00
roconnor-blockstream
707cf20b12
Fix tapscript comment
In elements tapscript is verison 0xc4
2022-08-12 11:56:15 -04:00
Andrew Poelstra
6422e50652
Merge ElementsProject/elements#1140: Fix Icon position in dmg
7fb99ff33f Fix Icon position in dmg (Pablo Greco)

Pull request description:

  Mac installer is showing the elements icon in a bad position
  ![image](https://user-images.githubusercontent.com/12950210/184251990-2496a5fc-de3a-450f-88d7-bce4188224f2.png)

  This small fix puts it back where it should be
  ![image](https://user-images.githubusercontent.com/12950210/184252039-0455a9ce-39f8-44cf-8d78-e8b1669e15e3.png)

ACKs for top commit:
  apoelstra:
    utACK 7fb99ff33f. Confirmed that it only touches Mac stuff.

Tree-SHA512: cbe3cd3ae4b5d461dc7f993ca0ea11f6ff1759a616d4d96d3a7ca9eda59cd2dc8e6664f2708d168bc9d84a8158adef73d0c995d6a8d40fd31311e4591f6747fd
2022-08-12 15:52:39 +00:00
Pablo Greco
7fb99ff33f Fix Icon position in dmg 2022-08-11 21:29:05 +00:00
Pablo Sebastian Greco
6132c01d60
Merge pull request #1121 from jgriffiths/pset_updates
PSET: Various fixes
2022-08-09 16:16:02 -03:00